Bugs item #1830442, was opened at 2007-11-12 13:50
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=422030&aid=1830442&group_id=38414
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: lpezard (lpezard)
Assigned to: Nobody/Anonymous (nobody)
Summary: Replace with role :sup: does not work with language_code: fr
Initial Comment:
Here is my original posting to docutils-user mailing list and David Goodger reply:
My posting:
-----------
I've tried the following replacements:
.. |Na+| replace:: Na\ :sup:`+`
Le |Na+| est l'ion sodium.
.. |K+| replace:: K\ :sup:`+`
Le |K+| est l'ion potassium
every thing works fine if I leave the language_code to en, but obviously this is french so that I change my docutils.conf to language_code: fr and then I obtain the following error:
test.txt:5: (ERROR/3) Error in "replace" directive: may contain a single paragraph only.
test.txt:5: (WARNING/2) Substitution definition "Na+" empty or invalid.
.. |Na+| replace:: Na\ :sup:`+`
test.txt:7: (ERROR/3) Undefined substitution referenced: "Na+".
It does not work for the first replacement |Na+| but works as expected for the second one |K+|. I must admit that I don't understand.
David Goodger's reply:
----------------------
I don't understand why the first replacement gives an error while the second one doesn't, either. But I found the root cause: Docutils isn't finding the role "sup", because it expects the French "exp" or
"exposant". If you're going to be using the French variant of Docutils, you should be using the French directive & role names too:
.. |Na+| remplace:: Na\ :exp:`+`
Le |Na+| est l'ion sodium.
.. |K+| remplace:: K\ :exp:`+`
Le |K+| est l'ion potassium
This works fine; no errors. For a "dictionary" of equivalencies, see http://docutils.sourceforge.net/docutils/parsers/rst/languages/fr.py . I don't know if these are documented somewhere else (they ought to be).
I don't understand, yet, why there's an error at all. There shouldn't be. The English directive names & role names should be fallback defaults. But I don't have time to solve it now.
Please file a bug on SourceForge so this doesn't get lost. Please include:
"A secondary bug is that an error in the "replace" directive isn't propagating through to the substitution definition error reporting."
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=422030&aid=1830442&group_id=38414

Bugs item #1830380, was opened at 2007-11-12 12:01
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=422030&aid=1830380&group_id=38414
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: lpezard (lpezard)
Assigned to: Nobody/Anonymous (nobody)
Summary: Replace with role :sup: does not work with language_code: fr
Initial Comment:
Here is my original posting to docutils-user mailing list and David Goodger reply:
My posting:
-----------
I've tried the following replacements:
.. |Na+| replace:: Na\ :sup:`+`
Le |Na+| est l'ion sodium.
.. |K+| replace:: K\ :sup:`+`
Le |K+| est l'ion potassium
every thing works fine if I leave the language_code to en, but obviously this is french so that I change my docutils.conf to language_code: fr and then I obtain the following error:
test.txt:5: (ERROR/3) Error in "replace" directive: may contain a single paragraph only.
test.txt:5: (WARNING/2) Substitution definition "Na+" empty or invalid.
.. |Na+| replace:: Na\ :sup:`+`
test.txt:7: (ERROR/3) Undefined substitution referenced: "Na+".
It does not work for the first replacement |Na+| but works as expected for the second one |K+|. I must admit that I don't understand.
David Goodger's reply:
----------------------
I don't understand why the first replacement gives an error while the second one doesn't, either. But I found the root cause: Docutils isn't finding the role "sup", because it expects the French "exp" or
"exposant". If you're going to be using the French variant of Docutils, you should be using the French directive & role names too:
.. |Na+| remplace:: Na\ :exp:`+`
Le |Na+| est l'ion sodium.
.. |K+| remplace:: K\ :exp:`+`
Le |K+| est l'ion potassium
This works fine; no errors. For a "dictionary" of equivalencies, see http://docutils.sourceforge.net/docutils/parsers/rst/languages/fr.py . I don't know if these are documented somewhere else (they ought to be).
I don't understand, yet, why there's an error at all. There shouldn't be. The English directive names & role names should be fallback defaults. But I don't have time to solve it now.
Please file a bug on SourceForge so this doesn't get lost. Please include:
"A secondary bug is that an error in the "replace" directive isn't propagating through to the substitution definition error reporting."
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=422030&aid=1830380&group_id=38414

2007/10/26, David Goodger <goodger@...>:
> The latest version should be fine, but needs to be tested well. I
> don't have time to test.
If I say to the SVN in the pep branch to get docutils to the version
5461, the problem with Unicode is already fixed.
Everything runs smoothly with the newer version. The generated htmls
are a bit different, but as far I saw, with small changes that are for
better. For example...
<div class="section">
<h2><a class="toc-backref" href="#id33" id="numbers"
name="numbers">Numbers</a></h2>
...changed for...
<div class="section" id="numbers">
<h2><a class="toc-backref" href="#id33">Numbers</a></h2>
. This and other change takes all the changes I saw reviewing several
files. The other one is that now we don't have 'class ="reference"',
but 'class ="reference internal"' or 'class ="reference external"'.
Visually, I didn't find any difference in all the files I checked.
Here I attach the diff for PEP 3000, as an example.
If you don't see any problem, I'll commit the change that makes this
branch to get the newer version of docutils.
Thanks!
--
. Facundo
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/

On 31.10.07, Nicolas Girard wrote:
> Hi,
> for personal use in any case, and for anyone interested if any, I'd like to
> change the way the LaTeX writer deals with::
> .. class:: c1...ci...cn
> upon sections and paragraphs.
Actually, I'd like to see a generic solution as currently the handling of
classes is breaking `syntax highlight via pygments`__.
__ http://docutils.sourceforge.net/sandbox/code-block-directive/docs/syntax-highlight.html#writing
However, converting classes in the sense of CSS to something equivalent
in latex is a hard task.
* Class settings should be ignored by writers that do not implement them.
Currently, you can style the html output with some class argument
without affecting the PDF generation.
With your proposal, such an rst-file would fail to convert to PDF if
you do not have a stylesheet that defines all the \AtBegin* and \AtEnd*
commands.
* The order of the class arguments is irrelevant:
``.. class:: c1 ci cn`` == ``.. class:: ci cn c1``
* The scope of class settings should be confined to the "classified"
object (doctree elemet).
> whereas I'd like it to generate something like
> \AtBeginc1
...
> \AtEndc1
CamelCase commands are in LaTeX an indication for "use only in preamble
or packages".
Günter

As there is IMO quite a lot to discuss here, I'd like to transfer this to
the devel list.
> Bugs item #1822272, was opened at 2007-10-29 18:36
> The problem is, hyperref is included before many extensions, among which the one that the user may specify using the --stylesheet command-line option.
> This is highly likely to trigger incompatibilities.
> Comment By: Nicolas Girard (ngirard) Date: 2007-11-01 16:35
> > there are two problems ::
> > 1. the writer needs to read latex which might give new errors
> Well, which ones ? Given the question
> "Does the 'user stylesheet' s include hyperref",
> isn't the answer as straightforward as:
> 1. executing "kpathsea s" to locate the stylesheet file
> 2. opening the stylesheet file
> 3. looking for a line containing "\usepackage" or "\RequirePackage" and
> "hyperref", regardless of the comments
IMO, this is too complicated, I like the clear distinction of rst->tex
conversion (which works also without LaTeX installed) and tex->pdf
done independently (and maybe on a different computer).
> > A solution to this problem might be to have a default docutils latex
> > style file that can be *replaced* by user-specific one [...] See also
> > latex2e_external_stylesheet__ for a proposal of such a latex writer
> > and style file.
__ http://docutils.sourceforge.net/sandbox/latex-variants/latex2e_external_stylesheet/
> Well, I'd vote for *any* way of solving this boring incompatibility stuff.
Docutils is modular, so you can "easily" sub-class the latex writer and
change the offending parts. This way, a custom latex writer will keep
pace with the official one.
An documented example for such a custom latex writer is the
`latex2e_listings writer`__
__ http://docutils.sourceforge.net/sandbox/latex-variants/latex2e_listings/
It should be fairly easy to modify it to place a
\RequirePackage{hyperref} at the end of the preamble instead of the
earlier call.
> Okay, why not your proposal ?
1. It is a massive change that needs proper discussion.
2. It will introduce backwards incompatibilities:
* command line options (and config settings) will be obsoleted by
definitions in the style sheet (one could also provide a set of
styles to choose from).
and either
* custom style sheets currently in use would have to \include a
default one,
or
* the writer would have to append fallback definitions to the
document.
3. It seems not to be a case of urgent need to the docutils developers.
> Has it been approved ?
No
> What's the status about it ?
* It is a working example to kickstart this discussion.
* It is a "sandbox project", i.e. affiliated to docutils but no official
part of it.
* It should be possible to install it and use it to solve your problem.
Mail me if you need help or further documentation.
Günter

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

CountryState

JavaScript is required for this form.

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details