Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## docutils-develop — For developer discussions of the implementation.

You can subscribe to this list here.

2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 Jan Feb Mar Apr (5) May (27) Jun (22) Jul (72) Aug (82) Sep (86) Oct (138) Nov (100) Dec (62) Jan (122) Feb (147) Mar (92) Apr (82) May (101) Jun (153) Jul (37) Aug (34) Sep (46) Oct (46) Nov (6) Dec (38) Jan (64) Feb (81) Mar (36) Apr (194) May (329) Jun (272) Jul (68) Aug (74) Sep (150) Oct (57) Nov (62) Dec (63) Jan (78) Feb (30) Mar (137) Apr (78) May (54) Jun (122) Jul (72) Aug (110) Sep (80) Oct (75) Nov (125) Dec (79) Jan (100) Feb (15) Mar (41) Apr (67) May (30) Jun (11) Jul (14) Aug (22) Sep (20) Oct (14) Nov (11) Dec (15) Jan (17) Feb (16) Mar (35) Apr (21) May (33) Jun (50) Jul (12) Aug (7) Sep (2) Oct (6) Nov (5) Dec (2) Jan (14) Feb (20) Mar (35) Apr (9) May (57) Jun (21) Jul (42) Aug (4) Sep (13) Oct (76) Nov (40) Dec (55) Jan (26) Feb (15) Mar (3) Apr (67) May (32) Jun (39) Jul (59) Aug (31) Sep (59) Oct (64) Nov (21) Dec (10) Jan (21) Feb (3) Mar (116) Apr (33) May (6) Jun (28) Jul (21) Aug (23) Sep (146) Oct (70) Nov (31) Dec (57) Jan (33) Feb (22) Mar (11) Apr (21) May (51) Jun (47) Jul (35) Aug (26) Sep (25) Oct (34) Nov (61) Dec (51) Jan (75) Feb (31) Mar (26) Apr (16) May (24) Jun (24) Jul (31) Aug (46) Sep (36) Oct (28) Nov (37) Dec (21) Jan (16) Feb (56) Mar (31) Apr (44) May (45) Jun (29) Jul (38) Aug (18) Sep (12) Oct (16) Nov (21) Dec (11) Jan (13) Feb (14) Mar (28) Apr (7) May (72) Jun (33) Jul (21) Aug (1) Sep (6) Oct (14) Nov (18) Dec (22) Jan (23) Feb (108) Mar (76) Apr (114) May (60) Jun Jul Aug Sep Oct Nov Dec
S M T W T F S

1
(1)
2

3
(2)
4

5

6
(5)
7
(5)
8
(3)
9
(2)
10

11
(1)
12

13
(1)
14

15

16

17

18

19
(1)
20
(2)
21

22

23

24

25

26
(1)
27
(2)
28
(4)
29
(1)

Showing results of 31

1 2 > >> (Page 1 of 2)
 Re: [Docutils-develop] ASCII math converts ASCII math to MathML From: Guenter Milde - 2012-02-29 08:50:06 Hi Paul and all Docutils developers, On 2012-02-28, Paul Tremblay wrote: > I am not that well versed in latex to know exactly how to convert it. > Converting latex to mathml might not require a complete reworking of my > code. For example, ASCIImath uses > text(apple) > Whereas latex uses > \text(apple) > If latex is indeed that close to ASCIImath, (This is because ASCIImath is modelled after TeX - with simplifications for the user) > it doesn't seem to make sense to use latex, since ASCIImath math > doesn't need the back slashes. Yes, backslashes are hard to type, especially on a German keyboard (Alt-Gr+ß). Also, ASCIImath looks much more similar to non-math rST. This makes it also a viable output option for text formats (rst, man-page, txt) and other formats witout proper math support. This becomes especially useful and readable if combined with Unicode math character replacements (already implemented for TeX math input), e.g. ∫ s_δ(x-x') dx However, there are many use cases for TeX math input even for people not knowing the details of the TeX math syntax, e.g. drag-and-drop of equations from documents made with LyX (or some other LaTeX front-end) or the Wikipedia. This means that conversion between ASCIImath and TeX-math could make ASCIImath a "full citizen" in standard rst (maybe even the default?). > Converting latex to mathml sounds like I would need to write a whole new > library. Do you mean "converting asciimath to TeX"? > Like I said, I don't know the syntax of latex. My hope was that the JavaScript sources might help in devising the ASCIImath<->TeX math converter. How did you start when programming the Python lib? Also, there are plenty of test cases as Wikipedia (as well as the current Docutils math and the various longer-existing Docutils math extensions (including Sphinx)) all use TeX-math as math input format. For a start, see docutils/test/functional/input/data/math.txt and the various math_output* files in docutils/test/functional 
 [Docutils-develop] [ docutils-Bugs-3495454 ] http://diveintopython.org/ is gone From: SourceForge.net - 2012-02-28 23:39:57 Bugs item #3495454, was opened at 2012-02-28 15:39 Message generated for change (Tracker Item Submitted) made by jakub-wilk You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3495454&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: Jakub Wilk (jakub-wilk) Assigned to: Nobody/Anonymous (nobody) Summary: http://diveintopython.org/ is gone Initial Comment: roman.py contains the following text: This program is part of "Dive Into Python", a free Python tutorial for experienced programmers. Visit http://diveintopython.org/ for the latest version. However, http://diveintopython.org/ currently reads: The requested resource / is no longer available on this server and there is no forwarding address. Please remove all references to this resource. You might want to remove the URL, or maybe point the mirror that apparently someone provides: http://www.diveintopython.net/ ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3495454&group_id=38414 
 Re: [Docutils-develop] ASCII math converts ASCII math to MathML From: Paul Tremblay - 2012-02-28 18:24:58 Attachments: Message as HTML Hi Guenter, If you think a directive option would work better than an option, then I would go with the directive option. I suppose one could mix different types of math in a document. I am not that well versed in latex to know exactly how to convert it. Converting latex to mathml might not require a complete reworking of my code. For example, ASCIImath uses text(apple) Whereas latex uses \text(apple) If latex is indeed that close to ASCIImath, it doesn't seem to make sense to use latex, since ASCIImath math doesn't need the back slashes. Converting latex to mathml sounds like I would need to write a whole new library. Like I said, I don't know the syntax of latex. Paul On Tue, Feb 28, 2012 at 8:04 AM, Guenter Milde wrote: > On 2012-02-28, Paul Tremblay wrote: > > On 2/27/12 6:18 AM, Guenter Milde wrote: > >> On 2012-02-19, Paul Tremblay wrote: > > >>> I've written a library that converts ASCII Math to Mathml: > >>> https://sourceforge.net/projects/asciimathpython/ > >> Good news. > > >> How is this related to ASCIIMathML_? > > >> .. _ASCIIMathML: http://pypi.python.org/pypi/asciimathml/ > > > My asciitomathml is much more complete than the ASCIIMathML in your > > link. I originally started working on the ASCIIMathML project, but found > > the code inscrutable and not easily changed. My own library is complete, > > and handles all cases of ASCII math. I imagine it handles nearly all > > types of math markup. > > I see. This makes it a good candidate for Docutils indeed and it makes me > want more (-: > > ASCIIMathML.js (http://www1.chapman.edu/~jipsen/mathml/asciimath.html) > accepts standard LaTeX notation as an alternative. Do you think your > library could be used as basis for an improved LaTeX -> MathML translator > for Docutils? > > Also, an ASCII-Math -> LaTeX converter would be very desirable for > adoption of ASCII-Math as rst math input format. There is a JavaScript > script at http://dlippman.imathas.com/asciimathtex/ASCIIMath2TeX.js How > difficult would it be to write a Python-based ASCIImath - LaTeX math > converter? > > ... > > > In order for the math input to be recognized, the rst2xml.py script > > could simply accept two options. Other scripts could likewise accept > > these options: > > > --math-input ascii > > IMV, the input format should rather be given in the document. Otherwise > documents may render invalid/untranslatable. I envisage a directive option > and derived roles like: > > .. math:: > :input: asciimath > > .. role:: asciimath(math) > :input: asciimath > > > > --math-output mathml > > This could be easily done by making the setting of the HTML writer a > generic one. > > We could use list of accepted output formats in order of preference > (idea by David) with defaults like:: > > [html4css1 writer] > > math-output: mathjax, mathml, html, literal > > [html4strict writer] > > math-output: mathml, mathjax, html, literal > > [latex2e writer] > > math-output: latex, literal > > which could be overridden in a config file or the command line like > > rst2html --math-output=html,mathml,literal > > > Thanks > > Günter > > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Docutils-develop mailing list > Docutils-develop@... > https://lists.sourceforge.net/lists/listinfo/docutils-develop > > Please use "Reply All" to reply to the list. >   Re: [Docutils-develop] ASCII math converts ASCII math to MathML From: Guenter Milde - 2012-02-28 13:05:06 On 2012-02-28, Paul Tremblay wrote: > On 2/27/12 6:18 AM, Guenter Milde wrote: >> On 2012-02-19, Paul Tremblay wrote: >>> I've written a library that converts ASCII Math to Mathml: >>> https://sourceforge.net/projects/asciimathpython/ >> Good news. >> How is this related to ASCIIMathML_? >> .. _ASCIIMathML: http://pypi.python.org/pypi/asciimathml/ > My asciitomathml is much more complete than the ASCIIMathML in your > link. I originally started working on the ASCIIMathML project, but found > the code inscrutable and not easily changed. My own library is complete, > and handles all cases of ASCII math. I imagine it handles nearly all > types of math markup. I see. This makes it a good candidate for Docutils indeed and it makes me want more (-: ASCIIMathML.js (http://www1.chapman.edu/~jipsen/mathml/asciimath.html) accepts standard LaTeX notation as an alternative. Do you think your library could be used as basis for an improved LaTeX -> MathML translator for Docutils? Also, an ASCII-Math -> LaTeX converter would be very desirable for adoption of ASCII-Math as rst math input format. There is a JavaScript script at http://dlippman.imathas.com/asciimathtex/ASCIIMath2TeX.js How difficult would it be to write a Python-based ASCIImath - LaTeX math converter? ... > In order for the math input to be recognized, the rst2xml.py script > could simply accept two options. Other scripts could likewise accept > these options: > --math-input ascii IMV, the input format should rather be given in the document. Otherwise documents may render invalid/untranslatable. I envisage a directive option and derived roles like: .. math:: :input: asciimath .. role:: asciimath(math) :input: asciimath > --math-output mathml This could be easily done by making the setting of the HTML writer a generic one. We could use list of accepted output formats in order of preference (idea by David) with defaults like:: [html4css1 writer] math-output: mathjax, mathml, html, literal [html4strict writer] math-output: mathml, mathjax, html, literal [latex2e writer] math-output: latex, literal which could be overridden in a config file or the command line like rst2html --math-output=html,mathml,literal Thanks Günter   Re: [Docutils-develop] ASCII math converts ASCII math to MathML From: Paul Tremblay - 2012-02-28 01:20:28 On 2/27/12 6:18 AM, Guenter Milde wrote: > On 2012-02-19, Paul Tremblay wrote: > >> I've written a library that converts ASCII Math to Mathml: >> https://sourceforge.net/projects/asciimathpython/ > Good news. > > How is this related to ASCIIMathML_? > > .. _ASCIIMathML: http://pypi.python.org/pypi/asciimathml/ > > >> It would take only 10 or 15 lines of code to actually use this library. >> One would only have to include a visit for the math_block and math >> elements in the writers/docutils_xml.py, and likewise include a few in >> the HTML writer. > How would the math input format be recognized? > > My asciitomathml is much more complete than the ASCIIMathML in your link. I originally started working on the ASCIIMathML project, but found the code inscrutable and not easily changed. My own library is complete, and handles all cases of ASCII math. I imagine it handles nearly all types of math markup. A lot has changed since the thread in 2008. Firefox can handle MathML without any special plugins; it simply works. Likewise, FOP, the Java converter that converts FO to PDF, handles MathML without any fuss. You download an extra jar, put it in a directory, and then the MathML gets converted to PDF. In order for the math input to be recognized, the rst2xml.py script could simply accept two options. Other scripts could likewise accept these options: --math-input ascii --math-output mathml The default for both, without any option, would be latex. Paul   Re: [Docutils-develop] ASCII math converts ASCII math to MathML From: Guenter Milde - 2012-02-27 11:18:55 On 2012-02-19, Paul Tremblay wrote: > I've written a library that converts ASCII Math to Mathml: > https://sourceforge.net/projects/asciimathpython/ Good news. How is this related to ASCIIMathML_? .. _ASCIIMathML: http://pypi.python.org/pypi/asciimathml/ > It would take only 10 or 15 lines of code to actually use this library. > One would only have to include a visit for the math_block and math > elements in the writers/docutils_xml.py, and likewise include a few in > the HTML writer. How would the math input format be recognized? It seems like the whole math handling needs to be restructured to be more open to new formats. See the May 2008 thread for an discussion: (http://osdir.com/ml/text.docutils.devel/2008-05/threads.html) Thanks for keeping this up, Günter   Re: [Docutils-develop] [ docutils-Patches-3487220 ] Broken link in docs From: Guenter Milde - 2012-02-27 09:19:09 On 2012-02-13, SourceForge.net wrote: > https://sourceforge.net/tracker/?func=detail&atid=422032&aid=3487220&group_id=38414 > Note that the currently published docs state that the default > math_output is MathJax: it seems no more true, the default in 0.8.1 > being MathML. The current version doesn't say anything about the > default: I think it should be specified. Anyway, the online version is > definitely out of date. The online version of config.txt describes the (changed) default value in the developer version Docutils 0.9 [repository]. Note: With the "html4css1" writer, the resulting HTML document does not validate, as there is no DTD for MathML + XHTML Transitional. However, MathML-enabled browsers will render it fine. Note: The "html4strict" writer in the sandbox uses MathML as default math-output. It produces valid MathML + XHTML 4.1. Günter   [Docutils-develop] [ docutils-Patches-3487220 ] Broken link in docs From: SourceForge.net - 2012-02-26 11:04:22 Patches item #3487220, was opened at 2012-02-13 02:21 Message generated for change (Comment added) made by grubert You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422032&aid=3487220&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: Closed Resolution: None Priority: 5 Private: No Submitted By: https://www.google.com/accounts () Assigned to: Nobody/Anonymous (nobody) Summary: Broken link in docs Initial Comment: Broken link in docs/user/config.txt.:Patch attached. Note that the currently published docs state that the default math_output is MathJax: it seems no more true, the default in 0.8.1 being MathML. The current version doesn't say anything about the default: I think it should be specified. Anyway, the online version is definitely out of date. ---------------------------------------------------------------------- >Comment By: engelbert gruber (grubert) Date: 2012-02-26 03:04 Message: applied the patch, thanks ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422032&aid=3487220&group_id=38414   [Docutils-develop] [ docutils-Bugs-3485089 ] wrong format for NOTE From: SourceForge.net - 2012-02-20 21:47:22 Bugs item #3485089, was opened at 2012-02-06 13:00 Message generated for change (Comment added) made by dkuhlman You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3485089&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: ODT Writer Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Vjacheslav (fyodorov) Assigned to: Dave Kuhlman (dkuhlman) Summary: wrong format for NOTE Initial Comment: While processing this text: word internal is placed out of note. .. note:: Note note: internal Last line ---------------------------------------------------------------------- >Comment By: Dave Kuhlman (dkuhlman) Date: 2012-02-20 13:47 Message: I don't see a reasonable way to fix this. There are 10 different styles for 10 different kinds of admonitions. We'd have to add a new admonition block quote style for each of those. And, that would not cover enumerated lists and bullet lists inside of admonitions. Then there are literal lists and ... I suspect that we'll have to accept that admonitions are a restricted sort of thing for the purposes of generating ODF-ODT documents. In ODF-ODT elements do not nest (bullet lists and enumerated lists are an exception) and styles do not cascade/inherit. If you can think of some reasonable approach to solving this problem, please let me know. - Dave ---------------------------------------------------------------------- Comment By: Vjacheslav (fyodorov) Date: 2012-02-06 13:04 Message: Sorry. Please add some spaces before word "internal" to have it nested into note to reproduce. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3485089&group_id=38414   Re: [Docutils-develop] [Docutils-checkins] SF.net SVN: docutils:[7325] trunk/docutils From: David Goodger - 2012-02-20 20:58:50 On Thu, Jan 26, 2012 at 08:08, wrote: > Modified: trunk/docutils/test/functional/input/standalone_rst_latex.txt > =================================================================== > --- trunk/docutils/test/functional/input/standalone_rst_latex.txt 2012-01-26 09:57:04 UTC (rev 7324) > +++ trunk/docutils/test/functional/input/standalone_rst_latex.txt 2012-01-26 13:08:04 UTC (rev 7325) > @@ -20,6 +20,7 @@ > .. include:: data/latex_encoding.txt > .. include:: data/hyperlinking.txt > .. include:: data/urls.txt > +.. include:: data/section_titles.txt > .. unusual combinations (from newlatex, for interactive testing) > .. include:: data/latex.txt > > > Modified: trunk/docutils/test/functional/input/standalone_rst_xetex.txt > =================================================================== > --- trunk/docutils/test/functional/input/standalone_rst_xetex.txt 2012-01-26 09:57:04 UTC (rev 7324) > +++ trunk/docutils/test/functional/input/standalone_rst_xetex.txt 2012-01-26 13:08:04 UTC (rev 7325) > @@ -18,6 +18,7 @@ > .. include:: data/latex_encoding.txt > .. include:: data/hyperlinking.txt > .. include:: data/urls.txt > +.. include:: data/section_titles.txt Günter, you seem to have forgotten to "svn add" & commit the file test/functional/input/data/section_titles.txt. I get failures running the test suite, errors in the output: +{\color{red}SEVERE/4} in \texttt{functional/input/standalone\_rst\_xetex.txt}, line~21 + +Problems with "include" directive path: +IOError: {[}Errno 2{]} No such file or directory: 'functional/input/data/section\_titles.txt'. +% +\begin{quote}{\ttfamily \raggedright \noindent +..~include::~data/section\_titles.txt\\ +~ +} Please add & commit the file, thanks. -- David Goodger ;   [Docutils-develop] ASCII math converts ASCII math to MathML From: Paul Tremblay - 2012-02-19 20:22:37 Attachments: screen_shot1.png screen_shot2.png Hi group, I've written a library that converts ASCII Math to Mathml: https://sourceforge.net/projects/asciimathpython/ I've included two screenshots from the project page. It would take only 10 or 15 lines of code to actually use this library. One would only have to include a visit for the math_block and math elements in the writers/docutils_xml.py, and likewise include a few in the HTML writer. As it stands now, I use a separate script to read in the docutils tree to convert the ASCII math to MathML before converting the document to FO, and then to PDF. Paul   [Docutils-develop] [ docutils-Patches-3487220 ] Broken link in docs From: SourceForge.net - 2012-02-13 10:21:39 Patches item #3487220, was opened at 2012-02-13 02:21 Message generated for change (Tracker Item Submitted) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422032&aid=3487220&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: https://www.google.com/accounts () Assigned to: Nobody/Anonymous (nobody) Summary: Broken link in docs Initial Comment: Broken link in docs/user/config.txt.:Patch attached. Note that the currently published docs state that the default math_output is MathJax: it seems no more true, the default in 0.8.1 being MathML. The current version doesn't say anything about the default: I think it should be specified. Anyway, the online version is definitely out of date. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422032&aid=3487220&group_id=38414   Re: [Docutils-develop] [ docutils-Bugs-3485089 ] wrong format for NOTE From: Dave Kuhlman - 2012-02-11 03:23:58 Thanks for that example. I'll look into it. - Dave K. -- Dave Kuhlman http://www.rexx.com/~dkuhlman ----- Original Message ----- > From: Guenter Milde > To: docutils-develop@... > Cc: > Sent: Tuesday, February 7, 2012 12:23 AM > Subject: Re: [Docutils-develop] [ docutils-Bugs-3485089 ] wrong format for NOTE > > On 2012-02-06, SourceForge.net wrote: >> Bugs item #3485089, was opened at 2012-02-06 13:00 >> > https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3485089&group_id=38414 > >> Category: ODT Writer >> Submitted By: Vjacheslav (fyodorov) > >> Summary: wrong format for NOTE > >> Initial Comment: > >> While processing this text: word internal is placed out of note. > >> .. note:: Note >> note: > >> internal > >> Last line > > To make sure this has nothing to do with *parsing* the note, I recommend the > following minimal example: > > .. note:: > > Note, first paragraph > > Note, second paragraph > > block-quote nested inside the note > appears to be outside in ODT output. > > First paragraph after the note. > > > Would be interesting to test with other block level elements. > > Günter > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just$99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Docutils-develop mailing list > Docutils-develop@... > https://lists.sourceforge.net/lists/listinfo/docutils-develop > > Please use "Reply All" to reply to the list. > 
 Re: [Docutils-develop] sandbox procedures From: David Goodger - 2012-02-09 03:25:01 On Wed, Feb 8, 2012 at 22:21, Paul Tremblay wrote: > A few weeks ago it was noted that sandbox projects aptly named get more > attention than those named after the developer--that is, a project named > "xsl_fo" is more useful than one named Paul Tremblay. > > Which brings me to my question: can I create a new sandbox directory, or > does someone with higher permissions need to do so? You should be able to do it. Please do. Just don't clobber any other project, and remove the obsolete stuff (use "svn rename" to keep the history). David Goodger 
 [Docutils-develop] sandbox procedures From: Paul Tremblay - 2012-02-09 03:21:14 A few weeks ago it was noted that sandbox projects aptly named get more attention than those named after the developer--that is, a project named "xsl_fo" is more useful than one named Paul Tremblay. Which brings me to my question: can I create a new sandbox directory, or does someone with higher permissions need to do so? My own sandbox has two different projects: (1) xsl stylesheets for converting reStructred text to FO and (2) stylesheets for converting reStructured text to docbook. Project 1 is very complete, thoroughly tested, and thoroughly documented. Project 2 is relatively complete and will become more so over time. Paul 
 [Docutils-develop] [ docutils-Bugs-3484857 ] "invalid option block" for roles that start new lines From: SourceForge.net - 2012-02-08 21:11:09 Bugs item #3484857, was opened at 2012-02-06 00:34 Message generated for change (Comment added) made by milde You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3484857&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: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Michael Forbes (mforbes) Assigned to: Nobody/Anonymous (nobody) Summary: "invalid option block" for roles that start new lines Initial Comment: If a role even incidentally starts a new line, the "invalid option block" is triggered. I am not completely sure if this is a bug in the code or in the definition of the rst format but it is highly counter-intuitive and can be triggered "automatically" when code is wrapped. Is there a simple consistent workaround? I would have expected that, since I have started the text in the block, that the "option searcher" would stop looking for an options block and simply process the role. Here is a complete MWE: ----------------------- # This is okay since the second line starts with text okay = """ .. note:: Hi. Here is an equation :math:a=b """ # This fails because the second line starts with the :math: role bad = """ .. note:: Hi. Here is an equation :math:a=b """ import docutils.utils import docutils.parsers.rst p = docutils.parsers.rst.Parser() d = docutils.utils.new_document( 'bug', docutils.frontend.OptionParser(components=(p,)).get_default_values()) p.parse(okay, d) p.parse(bad, d) ----------------------- Running this yields: ------------- bug:2: (ERROR/3) Error in "note" directive: invalid option block. .. note:: Hi. Here is an equation :math:a=b -------------- Michael. P.S. I doubt this is relevant, but here is the system information: Mac OS X 10.5.8 Python 2.7.2 -- EPD 7.2-1 (32-bit) Docutils Version '0.8.1' ---------------------------------------------------------------------- Comment By: Günter Milde (milde) Date: 2012-02-08 13:11 Message: Fixed; thanks for the bug report. You can download a current snapshot from: http://docutils.svn.sourceforge.net/viewvc/docutils/trunk/docutils/?view=tar ---------------------------------------------------------------------- Comment By: Günter Milde (milde) Date: 2012-02-06 07:23 Message: > I would have expected that, since I have started the text in the block, that the "option searcher" would stop looking for an options block and simply process the role. This would prevent options for short notes like: .. note:: A note with option :name: example 1 However, as a field list can be distinguished from a role by the whitespace required aftter the field-marker, the problem can be solved by looking for a field-marker instead of looking for lines starting with a colon. Note: you still need a blank line before the content if it is a field list. Note: in the rare case of a field-list marker lookalike on the start of a line, you need a blank line, too:: .. note:: This is a strange example :that: fails because of the colon-wrapped :that: at beginning of the line. ---------------------------------------------------------------------- Comment By: Michael Forbes (mforbes) Date: 2012-02-06 00:40 Message: The workaround is to *always* include a blank line before the content. (This looks poor, but is safe): ------- .. note:: This example is fine even though the equation :math:a=b starts a new line. ------ Michael. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3484857&group_id=38414 
 Re: [Docutils-develop] Patch for [ 3484857 ] (false positive "invalid option block") From: David Goodger - 2012-02-08 15:07:26 On Wed, Feb 8, 2012 at 03:28, Guenter Milde wrote: > On 2012-02-07, David Goodger wrote: >> What error? > > The rst syntax error: > > .. image:: picture.png >   :: 50 > > in an input file which is tested in test_images.py ... > This means that these misspelled options go undetected until the > user realises that the image does not load and may be hard to spot. > > In my view, this is a rare case and not worth a special syntax checker > for the image directive. Agreed. -- David Goodger ; 
 Re: [Docutils-develop] Patch for [ 3484857 ] (false positive "invalid option block") From: Guenter Milde - 2012-02-08 08:28:38 On 2012-02-07, David Goodger wrote: > On Tue, Feb 7, 2012 at 14:41, Guenter Milde wrote: >>> Instead of a hard-coded regular expression string, why don't you use >>> self.patterns['field_marker']? >> Because with >> -            if re.match(r':([^:\\]|\\.)*:( |$)', line): >> + if re.match(self.patterns['field_marker'], line): >> alltests.py returns: >> FAILED (failures=1, errors=32) >> The errors are: KeyError: 'field_marker', the failure is: > OK, I think this is because the parsing takes place in a class other > than Body (a subclass), which has its own set of patterns. Try: > Body.patterns['field_marker'] This solves the issue. >> * a more complicated pattern (as it needs to extract the field name) > Yes, but I think that's minor. The existing pattern is tested, working > code, and most importantly, it has a name (it's not a hard-coded > unexplained constant). Agreed. >> * one more undetected error. > What error? The rst syntax error: .. image:: picture.png :: 50 in an input file which is tested in test_images.py The joining of image arguments, if there are multiple lines in the link block, they are stripped of leading and trailing whitespace and joined together, is practical in the intended use case but can lead to unexpected behaviour if whitespace-separated tokens of the link block are not parts of one URL. The following two misspellings were detected in Docutils <= 0.8 (the option block was started by any line starting with a colon which led to problems with named roles in other directives): ["""\ .. image:: picture.png :scale 50 """, """\ """], ["""\ .. image:: picture.png :: 50 """, """\ """], # a missing leading colon went undetected also in Docutils <= 0.8: ["""\ .. image:: picture.png scale: 50 """, """\ """], This means that these misspelled options go undetected until the user realises that the image does not load and may be hard to spot. In my view, this is a rare case and not worth a special syntax checker for the image directive. Thanks, Günter   Re: [Docutils-develop] Patch for [ 3484857 ] (false positive "invalid option block") From: David Goodger - 2012-02-07 20:27:18 On Tue, Feb 7, 2012 at 14:41, Guenter Milde wrote: > On 2012-02-07, David Goodger wrote: >> On Tue, Feb 7, 2012 at 04:42, Guenter Milde wrote: >>> On 2012-02-06, SourceForge.net wrote: >>>> Bugs item #3484857, was opened at 2012-02-06 00:34 > > ... > >>> This is why I propose the following patch:: > >>> Index: docutils/parsers/rst/states.py >>> =================================================================== >>> --- docutils/parsers/rst/states.py (Revision 7326) >>> +++ docutils/parsers/rst/states.py (Arbeitskopie) >>> @@ -2142,8 +2142,9 @@ > >>> def parse_directive_options(self, option_presets, option_spec, arg_block): >>> options = option_presets.copy() >>> - for i in range(len(arg_block)): >>> - if arg_block[i][:1] == ':': >>> + for i, line in enumerate(arg_block): >>> + # if line[:1] == ':': >>> + if re.match(r':([^:\\]|\\.)*:( |$)', line): >>>                 opt_block = arg_block[i:] >>>                 arg_block = arg_block[:i] >>>                 break > >> Instead of a hard-coded regular expression string, why don't you use >> self.patterns['field_marker']? > > Because with > > -            if re.match(r':([^:\\]|\\.)*:( |$)', line): > + if re.match(self.patterns['field_marker'], line): > > alltests.py returns: > > FAILED (failures=1, errors=32) > > The errors are: KeyError: 'field_marker', the failure is: OK, I think this is because the parsing takes place in a class other than Body (a subclass), which has its own set of patterns. Try: Body.patterns['field_marker'] (i.e., Body instead of self.) > I.e. even when fixing the key error (which is not really clear to me, > seems to be related with nested_list_parse or embedded_directives) there is > > * a more complicated pattern (as it needs to extract the field name) Yes, but I think that's minor. The existing pattern is tested, working code, and most importantly, it has a name (it's not a hard-coded unexplained constant). If the existing pattern doesn't work, at least make the pattern a class attribute and give it a name (e.g. "directive_option_pattern") for self-documentation. > * one more undetected error. What error? >> Otherwise +1. > > Fine. > > If you can fix these issues, I am fine with using the existing pattern. > Otherwise I suggest to use the pattern tailored for the task. Body.patterns['field_marker'] *is* tailored for exactly that task. Yes, it does more than absolutely necessary, but DRY (don't repeat yourself) wins IMO. -- David Goodger ;   Re: [Docutils-develop] Patch for [ 3484857 ] (false positive "invalid option block") From: Guenter Milde - 2012-02-07 19:41:37 On 2012-02-07, David Goodger wrote: > On Tue, Feb 7, 2012 at 04:42, Guenter Milde wrote: >> On 2012-02-06, SourceForge.net wrote: >>> Bugs item #3484857, was opened at 2012-02-06 00:34 ... >> This is why I propose the following patch:: >> Index: docutils/parsers/rst/states.py >> =================================================================== >> --- docutils/parsers/rst/states.py (Revision 7326) >> +++ docutils/parsers/rst/states.py (Arbeitskopie) >> @@ -2142,8 +2142,9 @@ >> def parse_directive_options(self, option_presets, option_spec, arg_block): >> options = option_presets.copy() >> - for i in range(len(arg_block)): >> - if arg_block[i][:1] == ':': >> + for i, line in enumerate(arg_block): >> + # if line[:1] == ':': >> + if re.match(r':([^:\\]|\\.)*:( |$)', line): >>                 opt_block = arg_block[i:] >>                 arg_block = arg_block[:i] >>                 break > Instead of a hard-coded regular expression string, why don't you use > self.patterns['field_marker']? Because with -            if re.match(r':([^:\\]|\\.)*:( |$)', line): + if re.match(self.patterns['field_marker'], line): alltests.py returns: FAILED (failures=1, errors=32) The errors are: KeyError: 'field_marker', the failure is: Testing Docutils 0.9 [repository] with Python 2.7.2+ on 2012-02-07 at 20:20:12 Working directory: /home/milde/Code/Python/docutils-svn/docutils/test Docutils package: /home/milde/Code/Python/docutils-svn/docutils/docutils test_parsers/test_rst/test_directives/test_images.py: totest['images'][16]; test_parser (DocutilsTestSupport.ParserTestCase) input: .. image:: picture.png :: 50 -: expected +: output + - - - Error in "image" directive: - invalid option block. - - .. image:: picture.png - :: 50 I.e. even when fixing the key error (which is not really clear to me, seems to be related with nested_list_parse or embedded_directives) there is * a more complicated pattern (as it needs to extract the field name) * one more undetected error. > Otherwise +1. Fine. If you can fix these issues, I am fine with using the existing pattern. Otherwise I suggest to use the pattern tailored for the task. Günter   Re: [Docutils-develop] Patch for [ 3484857 ] (false positive "invalid option block") From: David Goodger - 2012-02-07 14:50:38 On Tue, Feb 7, 2012 at 04:42, Guenter Milde wrote: > On 2012-02-06, SourceForge.net wrote: >> Bugs item #3484857, was opened at 2012-02-06 00:34 >> https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3484857&group_id=38414 >> Submitted By: Michael Forbes (mforbes) > ... > >> If a role even incidentally starts a new line, the "invalid option >> block" is triggered. > >> I am not completely sure if this is a bug in the code or in the >> definition of the rst format but it is highly counter-intuitive and can >> be triggered "automatically" when code is wrapped. Is there a simple >> consistent workaround? > >> Comment By: Michael Forbes (mforbes) 2012-02-06 00:40 > >> Message: >> The workaround is to *always* include a blank line before the content. > > Another workaround is to use postfix notation:: > > .. note:: This example is fine even though the equation > a=b:math: starts a new line. > >>>Comment By: Günter Milde (milde) 2012-02-06 07:23 > >>> I would have expected that, since I have started the text in the block, >> that the "option searcher" would stop looking for an options block and >> simply process the role. > >> This would prevent options for short notes like: > > .. math:: f(x) = sin(x) > :name: eq:sinx > >> However, as a field list can be distinguished from a role by the >> whitespace required aftter the field-marker, the problem can be solved >> by looking for a field-marker instead of looking for lines starting >> with a colon. > >> Note: you still need a blank line before the content if it is a field >> list. > >> Note: in the rare case of a field-list marker lookalike on the start of a >> line, you need a blank line, too:: > >> .. note:: This is a strange example >> :that: fails because of the colon-wrapped :that: at beginning of the >> line. > > > While problem was hidden before the addition of "math" and "code" inline > markup roles as well as the common "name" and "class" attributes to most > directives, it is not solved by reversing these changes. The following > example fails, too:: > > .. sidebar:: :PEP:287: reStructuredText Docstring Format > > This PEP proposes that the reStructuredText markup be adopted as a > standard markup format for structured plaintext documentation in Python > docstrings, and for PEPs and ancillary documents as well. > > In this case, the offending part is the compulsory "title" argument, so that > the only workaround (except paraphrasing) would be postfix notation > > .. sidebar:: 287:PEP:: reStructuredText Docstring Format > > which clearly is not "natural" and easy to read in this case. > > This is why I propose the following patch:: > > Index: docutils/parsers/rst/states.py > =================================================================== > --- docutils/parsers/rst/states.py (Revision 7326) > +++ docutils/parsers/rst/states.py (Arbeitskopie) > @@ -2142,8 +2142,9 @@ > > def parse_directive_options(self, option_presets, option_spec, arg_block): > options = option_presets.copy() > - for i in range(len(arg_block)): > - if arg_block[i][:1] == ':': > + for i, line in enumerate(arg_block): > + # if line[:1] == ':': > + if re.match(r':([^:\\]|\\.)*:( |$)', line): >                 opt_block = arg_block[i:] >                 arg_block = arg_block[:i] >                 break Instead of a hard-coded regular expression string, why don't you use self.patterns['field_marker']? Otherwise +1. -- David Goodger > Which changes the behaviour in case of errors in the option block: > > Currently, > >  .. image:: picture.png >    :scale 50 > > reports an "invalid option block". > > With the patch, it inserts an invalid URL just like :: > >  .. image:: picture.png >    scale: 50 > > This is IMO less of a problem than having to explain: > >  Never start a directive argument (or a subsequent line of a directive >  argument) with a colon, because Docutils checks for misspelled option >  blocks. > > The following test of the new behaviour fails without the patch: > > --- test/test_parsers/test_rst/test_directives/test_admonitions.py      (Revision 7326) > +++ test/test_parsers/test_rst/test_directives/test_admonitions.py      (Arbeitskopie) > @@ -111,6 +111,35 @@ >             No blank lines in-between. >  """], >  ["""\ > +.. note:: Content before options > +   is possible too. > +   :class: mynote > + > +.. note:: :strong:a role is not an option. > +   :name: role not option > + > +.. note:: a role is > +   :strong:not an option, even if its starts a line. > +""", > +"""\ > + > +     > +         > +            Content before options > +            is possible too. > +     > +         > +             > +                a role is not an option > +            . > +     > +         > +            a role is > +             > +                not an option > +            , even if its starts a line. > +"""], > +["""\ >  .. note:: >  """, >  """\ 
 [Docutils-develop] Patch for [ 3484857 ] (false positive "invalid option block") From: Guenter Milde - 2012-02-07 09:42:34 On 2012-02-06, SourceForge.net wrote: > Bugs item #3484857, was opened at 2012-02-06 00:34 > https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3484857&group_id=38414 > Submitted By: Michael Forbes (mforbes) ... > If a role even incidentally starts a new line, the "invalid option > block" is triggered. > I am not completely sure if this is a bug in the code or in the > definition of the rst format but it is highly counter-intuitive and can > be triggered "automatically" when code is wrapped. Is there a simple > consistent workaround? > Comment By: Michael Forbes (mforbes) 2012-02-06 00:40 > Message: > The workaround is to *always* include a blank line before the content. Another workaround is to use postfix notation:: .. note:: This example is fine even though the equation a=b:math: starts a new line. >>Comment By: Günter Milde (milde) 2012-02-06 07:23 >> I would have expected that, since I have started the text in the block, > that the "option searcher" would stop looking for an options block and > simply process the role. > This would prevent options for short notes like: .. math:: f(x) = sin(x) :name: eq:sinx > However, as a field list can be distinguished from a role by the > whitespace required aftter the field-marker, the problem can be solved > by looking for a field-marker instead of looking for lines starting > with a colon. > Note: you still need a blank line before the content if it is a field > list. > Note: in the rare case of a field-list marker lookalike on the start of a > line, you need a blank line, too:: > .. note:: This is a strange example > :that: fails because of the colon-wrapped :that: at beginning of the > line. While problem was hidden before the addition of "math" and "code" inline markup roles as well as the common "name" and "class" attributes to most directives, it is not solved by reversing these changes. The following example fails, too:: .. sidebar:: :PEP:287: reStructuredText Docstring Format This PEP proposes that the reStructuredText markup be adopted as a standard markup format for structured plaintext documentation in Python docstrings, and for PEPs and ancillary documents as well. In this case, the offending part is the compulsory "title" argument, so that the only workaround (except paraphrasing) would be postfix notation .. sidebar:: 287:PEP:: reStructuredText Docstring Format which clearly is not "natural" and easy to read in this case. This is why I propose the following patch:: Index: docutils/parsers/rst/states.py =================================================================== --- docutils/parsers/rst/states.py (Revision 7326) +++ docutils/parsers/rst/states.py (Arbeitskopie) @@ -2142,8 +2142,9 @@ def parse_directive_options(self, option_presets, option_spec, arg_block): options = option_presets.copy() - for i in range(len(arg_block)): - if arg_block[i][:1] == ':': + for i, line in enumerate(arg_block): + # if line[:1] == ':': + if re.match(r':([^:\\]|\\.)*:( |\$)', line): opt_block = arg_block[i:] arg_block = arg_block[:i] break Which changes the behaviour in case of errors in the option block: Currently, .. image:: picture.png :scale 50 reports an "invalid option block". With the patch, it inserts an invalid URL just like :: .. image:: picture.png scale: 50 This is IMO less of a problem than having to explain: Never start a directive argument (or a subsequent line of a directive argument) with a colon, because Docutils checks for misspelled option blocks. The following test of the new behaviour fails without the patch: --- test/test_parsers/test_rst/test_directives/test_admonitions.py (Revision 7326) +++ test/test_parsers/test_rst/test_directives/test_admonitions.py (Arbeitskopie) @@ -111,6 +111,35 @@ No blank lines in-between. """], ["""\ +.. note:: Content before options + is possible too. + :class: mynote + +.. note:: :strong:a role is not an option. + :name: role not option + +.. note:: a role is + :strong:not an option, even if its starts a line. +""", +"""\ + + + + Content before options + is possible too. + + + + a role is not an option + . + + + a role is + + not an option + , even if its starts a line. +"""], +["""\ .. note:: """, """\ 
 Re: [Docutils-develop] [ docutils-Bugs-3485089 ] wrong format for NOTE From: Guenter Milde - 2012-02-07 08:24:02 On 2012-02-06, SourceForge.net wrote: > Bugs item #3485089, was opened at 2012-02-06 13:00 > https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3485089&group_id=38414 > Category: ODT Writer > Submitted By: Vjacheslav (fyodorov) > Summary: wrong format for NOTE > Initial Comment: > While processing this text: word internal is placed out of note. > .. note:: Note > note: > internal > Last line To make sure this has nothing to do with *parsing* the note, I recommend the following minimal example: .. note:: Note, first paragraph Note, second paragraph block-quote nested inside the note appears to be outside in ODT output. First paragraph after the note. Would be interesting to test with other block level elements. Günter 
 [Docutils-develop] [ docutils-Bugs-3485089 ] wrong format for NOTE From: SourceForge.net - 2012-02-06 21:04:43 Bugs item #3485089, was opened at 2012-02-06 13:00 Message generated for change (Comment added) made by fyodorov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3485089&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: ODT Writer Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Vjacheslav (fyodorov) Assigned to: Dave Kuhlman (dkuhlman) Summary: wrong format for NOTE Initial Comment: While processing this text: word internal is placed out of note. .. note:: Note note: internal Last line ---------------------------------------------------------------------- >Comment By: Vjacheslav (fyodorov) Date: 2012-02-06 13:04 Message: Sorry. Please add some spaces before word "internal" to have it nested into note to reproduce. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3485089&group_id=38414 
 [Docutils-develop] [ docutils-Bugs-3485089 ] wrong format for NOTE From: SourceForge.net - 2012-02-06 21:00:12 Bugs item #3485089, was opened at 2012-02-06 13:00 Message generated for change (Tracker Item Submitted) made by fyodorov You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3485089&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: ODT Writer Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Vjacheslav (fyodorov) Assigned to: Dave Kuhlman (dkuhlman) Summary: wrong format for NOTE Initial Comment: While processing this text: word internal is placed out of note. .. note:: Note note: internal Last line ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=422030&aid=3485089&group_id=38414 

Showing results of 31

1 2 > >> (Page 1 of 2)