ReST und Unterstreichen in Nikola

Manch­mal mag man was un­ter­strei­chen. *kur­si­v* bzw. <em>­­kur­­si­v</em> macht aber kur­si­v. Klar, das kann man per Sty­les­heet än­dern, aber was ist wenn man Bei­des braucht?

In mei­nem Blog­sys­tem (Ni­ko­la) geht das so:

  • in plug­ins/un­­der.plu­­gin:

    [Co­re]
     na­me = rest_un­der
     mo­du­le = un­der
      
     [Ni­ko­la]
     com­pi­ler = rest
     plu­gin­ca­te­go­ry = Com­pi­ler­Ex­ten­sion
      
     [Do­cu­men­ta­tion]
     au­t­hor = Matt­hi­as Ur­lichs
     ver­si­on = 0.1
     web­si­te = htt­ps://­matt­hi­as.ur­lichs.­de/
     de­s­crip­ti­on = Un­der­Li­ne the mar­ked tex­t
     
  • in plug­ins/un­­der.­­py:

    # -*- co­ding: ut­f-8 -*- 
      
     # Co­py­right © 2015 Matt­hi­as Ur­lichs 
      
     """reST ro­le for un­der­li­ning.""" 
      
     from   do­cu­tils   im­port   no­des 
     from   do­cu­tils.par­ser­s.rst   im­port   ro­les 
      
     from   ni­ko­la.plu­gin_­ca­te­go­ries   im­port   Res­tEx­ten­si­on 
      
     class   Plu­gin(Res­tEx­ten­si­on): 
      
           """Plu­gin for doc ro­le.""" 
      
           na­me   =   'rest_un­der' 
      
           def   set_­si­te(self,   si­te): 
               """­Set Ni­ko­la si­te.""" 
               ro­les.re­gis­ter_­ca­no­ni­cal_ro­le('u',   un­der_ro­le) 
               re­turn   su­per(Plu­gin,   self).set_­si­te(si­te) 
      
      
     def   un­der_ro­le(na­me,   raw­text,   text,   li­ne­no,   in­li­ner, 
                    op­ti­ons={},   con­tent=[]): 
           """­Ge­ne­ra­te a un­der­li­ne-class em­pha­sis.""" 
           op­ti­ons   =   dict(**op­ti­ons) 
           op­ti­ons['clas­ses']   =   ['un­der­li­ne'] 
           re­turn   [no­des.em­pha­sis(raw­text,   text,   *con­tent,   **op­ti­ons)],[] 
     
  • in fi­les/as­­sets/css/­­cu­­stom.css:

    em.un­der­li­ne   {   font-sty­le:   nor­mal;   tex­t-­de­cora­ti­on:   un­der­li­ne;   } 
     
  • … und schon kannst du un­­ter­strei­chen.

    … und schon kannst du  :u:`un­ter­strei­chen`.
     

Bit­te sehr.

Kommentare

Comments powered by Disqus