Re: Replace with citation not as expected
Françoise Pinsard <[email protected]>
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <c8f35c79b4e1cd63d9090942d305e1e7.squirrel@skyros.locean-ipsl.upmc.fr> |
thanks for the hint but I tried and failed with
"Substitution definition contains illegal element"
here the full material (in/out).
$ cat tp.rst
.. rst2html.py tp.rst > tp.html
..
Citation references, like [CIT2002]_.
Another one |CIT2002_STYLE|.
.. |CIT2002_STYLE| replace:: mystyle [CIT2002]_
.. [CIT2002] Author. 2002.
$ rst2html.py tp.rst > tp.html
tp.rst:8: (ERROR/3) Substitution definition contains illegal element:
<citation_reference ids="id2" refname="cit2002">
CIT2002
.. |CIT2002_STYLE| replace:: mystyle [CIT2002]_
tp.rst:6: (ERROR/3) Undefined substitution referenced: "CIT2002_STYLE".
What am I missing ?
On Wed, August 12, 2015 4:36 pm, David Goodger wrote:
> In your example, try adding an underscore after the citation in the
> substitution definition. Replace:
>
> .. |CIT2002_STYLE| replace:: mystyle [CIT2002]
>
> with:
>
> .. |CIT2002_STYLE| replace:: mystyle [CIT2002]_
>
> Without the trailing underscore, it's just bracketed text. The output
> in the example looks right to me, based on the input.
>
> DG
>
>
> On Wed, Aug 12, 2015 at 7:31 AM, Françoise Pinsard
> <[email protected]> wrote:
>>
>> Hi
>>
>> Python 2.7.10 :: Anaconda 2.3.0 (x86_64)
>> rst2html.py (Docutils 0.12 [release], Python 2.7.10, on darwin)
>>
>> Here an example to illustrate something strange when I put a citation
>> in a replace ...
>>
>> tp.rst :
>>
>> Citation references, like [CIT2002]_.
>>
>> Another one |CIT2002_STYLE|.
>>
>> .. [CIT2002] Author. 2002.
>>
>> .. |CIT2002_STYLE| replace:: mystyle [CIT2002]
>>
>> rst2html produce (div class document content) ::
>>
>> <p>Citation references, like <a class="citation-reference"
>> href="#cit2002" id="id1">[CIT2002]</a>.</p>
>> <p>Another one mystyle [CIT2002].</p>
>> <table class="docutils citation" frame="void" id="cit2002"
>> rules="none">
>> <colgroup><col class="label" /><col /></colgroup>
>> <tbody valign="top">
>> <tr><td class="label"><a class="fn-backref"
>> href="#id1">[CIT2002]</a></td><td>Author. 2002.</td></tr>
>>
>> while I expected ::
>>
>> <p>Citation references, like <a class="citation-reference"
>> href="#cit2002" id="id1">[CIT2002]</a>.</p>
>> <p>Another one mystyle <a class="citation-reference" href="#cit2002"
>> id="id1">[CIT2002]</a>.</p>
>>
>> this problem was initially and indirectly raised using
>> sphinxcontrib-bitex
>> see
>> https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/84
>>
>> Regards
>>
>>
>> --
>> Françoise
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Docutils-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/docutils-users
>>
>> Please use "Reply All" to reply to the list.
>
--
Françoise
------------------------------------------------------------------------------