From: David G. <go...@py...> - 2016-02-28 23:20:33
|
On Sun, Feb 28, 2016 at 5:00 PM, Tom Roche <Tom...@po...> wrote: > > [footnotes follow .sig] > > Can one style a non-link replacement (e.g., emphasize text with a subscript) without a `raw` directive? What I mean: What you're asking for is nested inline markup via substitution, and that is not currently possible, no. Suggestion: rather than a substitution, use the Unicode subscript characters, e.g. CO₂, FFCO₂, H₂O. Superscripts too: E=mc². These can be styled with emphasis: *CO₂*, **FFCO₂**, etc. For easy character entry, explore the "compose key" functionality (https://en.wikipedia.org/wiki/Compose_key) standard in Linux distros and easily added to MacOS & Windows systems. David Goodger <http://python.net/~goodger> > I see FAQ section 2.16[1]: >> Inline markup can be combined with hyperlinks using substitution definitions and references with the "replace" directive. For example: > > However I want to combine inline markup and a substitution providing a subscript, for something like the following reST: > > fail1> Cities produce more than 70% of global fossil-fuel |CO2| emissions (*|FFCO2|*). We have cutting-edge science relating how cities and regions settle and use their land (LULC) to their |FFCO2| emissions. > > fail1> .. |CO2| replace:: CO\ :sub:`2` > fail1> .. |FFCO2| replace:: FFCO\ :sub:`2` > > to show (when rendered, e.g., by `restview`) "FFCO2" > > * the first time in italic, the second time not > * both times with '2' subscripted > * neither times with the '|' showing > > The above fragment fails, as > > - only the second "FFCO2" is subscripted > - the first "FFCO2" both shows the pipes and does not subscript > > I also tried > > fail2> Cities produce more than 70% of global fossil-fuel |CO2| emissions (|iFFCO2|). We have cutting-edge science relating how cities and regions settle and use their land (LULC) to their FFCO2 emissions. > > fail2> .. |CO2| replace:: CO\ :sub:`2` > fail2> .. |FFCO2| replace:: FFCO\ :sub:`2` > fail2> .. |iFFCO2| replace:: *|FFCO2|* > > which produces identical (failed results). Thanks to FAQ section 2.16[1] I learned I could do the following, which works: > > works> Cities produce more than 70% of global fossil-fuel |CO2| emissions (|iFFCO2|). We have cutting-edge science relating how cities and regions settle and use their land (*LULC*) to their |FFCO2| emissions. > > works> .. |CO2| replace:: CO\ :sub:`2` > works> .. |FFCO2| replace:: FFCO\ :sub:`2` > works> .. |iFFCO2| raw:: html > works> > works> <em>FFCO<sub>2</sub></em> > > but I'd prefer to do this (and similar simple styling of replacements) without `raw` directives. Is that currently possible? > > If possible please reply to me (directly) as well as the list, and > TIA, Tom Roche <Tom...@po...> > > [1]: http://docutils.sourceforge.net/FAQ.html#is-nested-inline-markup-possible > |