You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(15) |
Oct
(21) |
Nov
(18) |
Dec
(59) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(43) |
Feb
(35) |
Mar
(78) |
Apr
(65) |
May
(163) |
Jun
(169) |
Jul
(137) |
Aug
(77) |
Sep
(47) |
Oct
(27) |
Nov
(43) |
Dec
(68) |
| 2004 |
Jan
(61) |
Feb
(39) |
Mar
(11) |
Apr
(42) |
May
(86) |
Jun
(82) |
Jul
(24) |
Aug
(26) |
Sep
(37) |
Oct
(62) |
Nov
(131) |
Dec
(43) |
| 2005 |
Jan
(31) |
Feb
(56) |
Mar
(65) |
Apr
(165) |
May
(106) |
Jun
(97) |
Jul
(65) |
Aug
(150) |
Sep
(78) |
Oct
(115) |
Nov
(41) |
Dec
(26) |
| 2006 |
Jan
(50) |
Feb
(39) |
Mar
(56) |
Apr
(67) |
May
(89) |
Jun
(68) |
Jul
(116) |
Aug
(65) |
Sep
(58) |
Oct
(103) |
Nov
(28) |
Dec
(52) |
| 2007 |
Jan
(92) |
Feb
(60) |
Mar
(124) |
Apr
(96) |
May
(69) |
Jun
(79) |
Jul
(25) |
Aug
(22) |
Sep
(7) |
Oct
(17) |
Nov
(27) |
Dec
(32) |
| 2008 |
Jan
(57) |
Feb
(87) |
Mar
(51) |
Apr
(43) |
May
(56) |
Jun
(62) |
Jul
(25) |
Aug
(82) |
Sep
(58) |
Oct
(42) |
Nov
(38) |
Dec
(86) |
| 2009 |
Jan
(50) |
Feb
(33) |
Mar
(84) |
Apr
(90) |
May
(109) |
Jun
(37) |
Jul
(22) |
Aug
(51) |
Sep
(93) |
Oct
(86) |
Nov
(31) |
Dec
(62) |
| 2010 |
Jan
(33) |
Feb
(57) |
Mar
(62) |
Apr
(43) |
May
(30) |
Jun
(49) |
Jul
(20) |
Aug
(40) |
Sep
(152) |
Oct
(38) |
Nov
(15) |
Dec
(32) |
| 2011 |
Jan
(29) |
Feb
(25) |
Mar
(65) |
Apr
(45) |
May
(27) |
Jun
(11) |
Jul
(14) |
Aug
(8) |
Sep
(13) |
Oct
(117) |
Nov
(60) |
Dec
(19) |
| 2012 |
Jan
(23) |
Feb
(32) |
Mar
(24) |
Apr
(41) |
May
(56) |
Jun
(24) |
Jul
(15) |
Aug
(11) |
Sep
(26) |
Oct
(21) |
Nov
(12) |
Dec
(31) |
| 2013 |
Jan
(32) |
Feb
(24) |
Mar
(39) |
Apr
(44) |
May
(44) |
Jun
(8) |
Jul
(9) |
Aug
(12) |
Sep
(34) |
Oct
(19) |
Nov
(5) |
Dec
(9) |
| 2014 |
Jan
(22) |
Feb
(12) |
Mar
(7) |
Apr
(2) |
May
(13) |
Jun
(17) |
Jul
(8) |
Aug
(10) |
Sep
(7) |
Oct
(4) |
Nov
|
Dec
(39) |
| 2015 |
Jan
(13) |
Feb
(12) |
Mar
(12) |
Apr
(40) |
May
(5) |
Jun
(22) |
Jul
(3) |
Aug
(42) |
Sep
(5) |
Oct
(10) |
Nov
|
Dec
(10) |
| 2016 |
Jan
(9) |
Feb
(43) |
Mar
(5) |
Apr
(14) |
May
(17) |
Jun
(5) |
Jul
(5) |
Aug
(22) |
Sep
(5) |
Oct
|
Nov
(4) |
Dec
(18) |
| 2017 |
Jan
(28) |
Feb
(29) |
Mar
(9) |
Apr
(23) |
May
(48) |
Jun
(5) |
Jul
(32) |
Aug
(9) |
Sep
(13) |
Oct
(13) |
Nov
(6) |
Dec
(4) |
| 2018 |
Jan
(6) |
Feb
(5) |
Mar
(1) |
Apr
(2) |
May
(5) |
Jun
(17) |
Jul
(12) |
Aug
(15) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(6) |
Mar
(3) |
Apr
(5) |
May
(10) |
Jun
(6) |
Jul
(6) |
Aug
|
Sep
(11) |
Oct
(18) |
Nov
(10) |
Dec
(7) |
| 2020 |
Jan
(3) |
Feb
(14) |
Mar
(2) |
Apr
(1) |
May
(5) |
Jun
|
Jul
(1) |
Aug
(11) |
Sep
(8) |
Oct
|
Nov
(1) |
Dec
(14) |
| 2021 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
(8) |
May
(23) |
Jun
(7) |
Jul
(10) |
Aug
(1) |
Sep
|
Oct
(7) |
Nov
(10) |
Dec
(2) |
| 2022 |
Jan
|
Feb
(21) |
Mar
|
Apr
(3) |
May
(7) |
Jun
(4) |
Jul
(1) |
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
(18) |
Feb
|
Mar
(1) |
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2024 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
| 2025 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
(1) |
May
(3) |
Jun
(6) |
Jul
(22) |
Aug
(5) |
Sep
(9) |
Oct
(30) |
Nov
|
Dec
|
|
From: Guenter M. <mi...@us...> - 2017-07-18 18:31:55
|
On 2017-07-18, Tony Narlock wrote: > Is there a way to get the equivalent to “.. contents::” from publish_parts? According to http://docutils.sourceforge.net/docs/api/publisher.html#publish-parts-details, no. > If not, is there any way to get the table of contents programmatically? This could be done in a wrapper; or a custom writer or front-end. Places to look include the transforms.parts.Content() and the used HTML writer. > If not, is there any reason / issue with it being a feature? I don't know. > The practical use is a developer pulling out parts the HTML output would > like control over the table of contents output. The simple and secure approach would be CSS styling --- unless the task is more complicated. Günter |
|
From: Guenter M. <mi...@us...> - 2017-07-18 18:21:17
|
On 2017-07-18, Alan Isaac wrote:
I expected this_ to work, but it produced an invalid link.
.. this:: [mycite]_
.. [mycite]
My Citation Details.
> Are such indirect references allowed?
Yes, if you use the correct syntax::
.. _this: [mycite]_
.. [mycite]
My Citation Details.
(In your example, you used a *directive* "this".)
Günter
|
|
From: Alan I. <ala...@gm...> - 2017-07-18 16:14:34
|
I expected this_ to work, but it produced an invalid link.
.. this:: [mycite]_
.. [mycite]
My Citation Details.
Are such indirect references allowed?
Thanks,
Alan Isaac
(using rst2html5)
|
|
From: Tony N. <to...@gi...> - 2017-07-18 06:54:43
|
Hello docutils users, Is there a way to get the equivalent to “.. contents::” from publish_parts? http://docutils.sourceforge.net/0.4/docs/api/publisher.html If not, is there any way to get the table of contents programmatically? If not, is there any reason / issue with it being a feature? The practical use is a developer pulling out parts the HTML output would like control over the table of contents output. |
|
From: David G. <go...@py...> - 2017-06-21 15:26:33
|
On Wed, Jun 21, 2017 at 8:57 AM, Luis Gomez <lui...@gm...> wrote: > Hello, > > I'm using substitutions to insert images in section headings, but it's less > than ideal when I have to link to those sections > > Take, for example, the following ReST: > > |icon1| My Section > ================ > > This will result in a section link of "icon1-my-section". To refer to this > section elsewhere in the document, I have to write `icon1 My Section`_. > > I would like a way to allow that same section to be referred by `My > Section`_, and the resulting link to be "my-section", as if the substitution > text wasn't there. Is it possible to omit the text content of a substitution > in a section heading? Not currently. Workaround that will give you what you want: .. _My Section: |icon1| My Section ================ If your output is HTML, you could also add an icon via CSS styling. > If not, could this be considered for a future feature? Please add a feature request, else it will be forgotten: https://sourceforge.net/p/docutils/feature-requests/ David Goodger <http://python.net/~goodger> |
|
From: Luis G. <lui...@gm...> - 2017-06-21 13:57:15
|
Hello, I'm using substitutions to insert images in section headings, but it's less than ideal when I have to link to those sections Take, for example, the following ReST: |icon1| My Section ================ This will result in a section link of "icon1-my-section". To refer to this section elsewhere in the document, I have to write `icon1 My Section`_. I would like a way to allow that same section to be referred by `My Section`_, and the resulting link to be "my-section", as if the substitution text wasn't there. Is it possible to omit the text content of a substitution in a section heading? If not, could this be considered for a future feature? Thanks! Luis Gomez p.s. I'm not subscribed to the mailing list. |
|
From: Guenter M. <mi...@us...> - 2017-06-10 19:26:01
|
On 2017-06-07, Benoit Barthelet wrote: > [-- Type: text/plain, Encoding: --] > Hello, > I'm finding myself writing in rst and pasting long parts of code using the > .. code:: directive (BTW For complete code files, you can also use the "include" directive with the "code" option. http://docutils.sourceforge.net/docs/ref/rst/directives.html#including-an-external-document-fragment ) > I'd like to be able to have togglable code when using rst2html. > If I'm correct I can achieve that with or without javascript, in both case > I seem to be missing one part of the puzzle to make it work effortlessly. > With javascript, as described in > https://stackoverflow.com/a/25543713/3581357 I can create a container and > have the js code handle the toggle, this works fine for me, except that I'm > unable to find a way to add the js code in question to the rst2html cli. You can specify a custom html template to replace the default docutils/writers/html4css1/template.txt http://docutils.sourceforge.net/docs/user/config.html#template Also, you can pass class arguments to (almost) any rST element using either the "class" directive or (for directives) the "class" option:: .. code-block:: xml :class: toggle-hide So, maybe you don't need to wrap in a "container". > I see there is a --script flag but only for rst2html5. There is no such thing for rst2html5.py shipping with docutils. http://docutils.sourceforge.net/docs/user/config.html#html5-writer > Without javascript it seems like css can be used to get the toggle effect > as described here: > https://siongui.github.io/2017/02/27/css-only-toggle-dom-element/ > That solution would be quite elegant, ids could be changed to classes and > the css modified accordingly, but I don't see a way to add a <input > id="element-toggle" type="checkbox" /> which this solution is ultimately > based on. There is indeed not rST for an HTML <input> element. You could use raw HTML. > Is it where I should write my own directive as described here > http://docutils.sourceforge.net/docs/howto/rst-directives.html ? You would not only need a custom directive, but also an extension to the HTML writer (unless you let the custom directive generate raw HTML). Günter |
|
From: Benoit B. <ben...@gm...> - 2017-06-07 08:54:23
|
Hello, I'm finding myself writing in rst and pasting long parts of code using the .. code:: directive I'd like to be able to have togglable code when using rst2html. If I'm correct I can achieve that with or without javascript, in both case I seem to be missing one part of the puzzle to make it work effortlessly. With javascript, as described in https://stackoverflow.com/a/25543713/3581357 I can create a container and have the js code handle the toggle, this works fine for me, except that I'm unable to find a way to add the js code in question to the rst2html cli. I see there is a --script flag but only for rst2html5. Without javascript it seems like css can be used to get the toggle effect as described here: https://siongui.github.io/2017/02/27/css-only-toggle-dom-element/ That solution would be quite elegant, ids could be changed to classes and the css modified accordingly, but I don't see a way to add a <input id="element-toggle" type="checkbox" /> which this solution is ultimately based on. Is it where I should write my own directive as described here http://docutils.sourceforge.net/docs/howto/rst-directives.html ? thanks for your pointers for a beginner rst writer -- benoit barthelet http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE |
|
From: Guenter M. <mi...@us...> - 2017-06-03 14:56:40
|
On 2017-01-28, Matěj Cepl wrote: > I have written a bit longer document using rST (all discussed > files are in https://mcepl.fedorapeople.org/tmp/harry_potter/), > and then convered it to LaTeX just with plain rst2xetex (using > 0.13.1). Mind, that despite the name, rst2xetex does not generate plain TeX for XeTeX but LaTeX for XeTeX/LuaTeX (compile with `xelatex` or `xeluatex` commands). > The resulting file is > https://mcepl.fedorapeople.org/tmp/harry_potter/harry-potter-odpoved-brachovi.pdf > and the problem I have it is that footnotes are quite often not > on the page they referred to (see page 8 for an example). This is a know problem of the LaTeX writer. > Is there some configuration or something which would persuade > docutils not to mess with footenotes and use plain \footnote{} > in LaTeX? There is just a TODO entry in docs/dev/todo.txt: * footnotes + True footnotes with LaTeX auto-numbering (as option ``--latex-footnotes``) (also for target-footnotes): - attach footnote text to footnote-symbol node - write \footnote{<footnote text>} - consider cases where LaTeX does not support footnotes (inside tables, headings, ...)? - consider multiple footnote refs to common footnote text. The problem is that in the source, the footnote text is not known when the footnote mark is parsed. We would need a transform to connect these so that the footnote-mark is written as \footnote{<footnote text>} Günter |
|
From: engelbert g. <eng...@gm...> - 2017-05-29 12:56:14
|
On 29 May 2017 at 04:37, Ben Finney <ben...@be...> wrote: > Ben Finney <ben...@be...> writes: > > > Version parsing of Python distributions should accept […] > > My apologies, I gave the wrong PEP reference. That should be: > > Version parsing of Python distributions should accept PEP 386 values > <URL:https://www.python.org/dev/peps/pep-0386/>. > superceeded by https://www.python.org/dev/peps/pep-0440/ > -- > \ “When [science] permits us to see the far side of some new | > `\ horizon, we remember those who prepared the way – seeing for | > _o__) them also.” —Carl Sagan, _Cosmos_, 1980 | > Ben Finney > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Docutils-users mailing list > Doc...@li... > https://lists.sourceforge.net/lists/listinfo/docutils-users > > Please use "Reply All" to reply to the list. > |
|
From: Ben F. <ben...@be...> - 2017-05-29 02:37:31
|
Ben Finney <ben...@be...> writes: > Version parsing of Python distributions should accept […] My apologies, I gave the wrong PEP reference. That should be: Version parsing of Python distributions should accept PEP 386 values <URL:https://www.python.org/dev/peps/pep-0386/>. -- \ “When [science] permits us to see the far side of some new | `\ horizon, we remember those who prepared the way – seeing for | _o__) them also.” —Carl Sagan, _Cosmos_, 1980 | Ben Finney |
|
From: Ben F. <ben...@be...> - 2017-05-29 02:24:05
|
Kfir Ilani <kfi...@ir...> writes: > docutils latest package version is 0.14rc1 > while other packages try to parse the version (such as sphinx), it fails > due to parse error for int() What are the “other packages”? Version parsing of Python distributions should accept PEP 396 values <URL:https://www.python.org/dev/peps/pep-0396/>. > Can you please update docutils version to contains only integers (as > universal format) Rather, the tool needs to be updated to accept the standard PEP 396 version format. -- \ “The supreme vice is shallowness.” —Oscar Wilde, _De | `\ Profundis_, 1897 | _o__) | Ben Finney |
|
From: Kfir I. <kfi...@ir...> - 2017-05-28 16:16:17
|
docutils latest package version is 0.14rc1
while other packages try to parse the version (such as sphinx), it fails
due to parse error for int()
File
"/Users/ci/workspace/wrk_automation_utils_mac_debug/.eggs/Sphinx-1.3.1-py2.7.egg/sphinx/util/compat.py",
line 17, in
docutils_version = tuple(int(x) for x in _du_version.split('.')[:2])
ValueError: invalid literal for int() with base 10: '14rc1'
Can you please update docutils version to contains only integers (as
universal format)
Thanks
Kfir Ilani
|
|
From: Dave K. <dku...@da...> - 2017-05-22 23:34:14
|
Günter,
Here is an update -- I did the following:
1. Merged your change for Jython import of locale module.
2. Added notes to HISTORY.txt.
3. Committed changes to the central repository.
Dave K
On Sun, May 21, 2017 at 10:22:39AM +0000, Guenter Milde wrote:
> Dear Dave,
>
> On 2017-05-19, Dave Kuhlman wrote:
>
> > I did the following:
>
> > 1. Merged your changes (patch file below) into my local repository.
>
> > 2. Did a bit of testing. I had an exception when a document
> > contained an admonition. I fixed that.
>
> > 3. Committed these changes to the central repository.
>
> > Thank you for your help with this.
>
> > Let me know if/when there is something more I can do.
>
> I have one more patch that makes the code failsafe for Python
> implementations missing the locale module (e.g. Jython).
>
> If you could add a short summary of changed to the HISTORY.txt file,
> we should be ready for release.
>
> Thanks,
>
> Günter
>
>
>
> Index: __init__.py
> ===================================================================
> --- __init__.py (Revision 8070)
> +++ __init__.py (Arbeitskopie)
> @@ -24,7 +24,10 @@
> import copy
> import urllib2
> import docutils
> -import locale
> +try:
> + import locale # module missing in Jython
> +except ImportError:
> + pass
> from docutils import frontend, nodes, utils, writers, languages
> from docutils.readers import standalone
> from docutils.transforms import references
> @@ -589,7 +592,10 @@
> elif len(subtag) == 1:
> break # 1-letter tag is never before valid region tag
> if region_code is None:
> - rcode = locale.normalize(language_code)
> + try:
> + rcode = locale.normalize(language_code)
> + except NameError:
> + rcode = language_code
> rcode = rcode.split('_')
> if len(rcode) > 1:
> rcode = rcode[1].split('.')
> @@ -596,11 +602,10 @@
> region_code = rcode[0]
> if region_code is None:
> self.document.reporter.warning(
> - 'invalid language-region. '
> - 'Could not find region with locale.normalize(). '
> - 'If language is supplied, then you must specify '
> - 'both language and region (ll-RR). Examples: '
> - 'es-MX (Spanish, Mexico), en-AU (English, Australia).')
> + 'invalid language-region.\n'
> + ' Could not find region with locale.normalize().\n'
> + ' Please specify both language and region (ll-RR).\n'
> + ' Examples: es-MX (Spanish, Mexico), en-AU (English, Australia).')
> # Update the style ElementTree with the language and region.
> # Note that we keep a reference to the modified node because
> # it is possible that ElementTree will throw away the Python
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Docutils-users mailing list
> Doc...@li...
> https://lists.sourceforge.net/lists/listinfo/docutils-users
>
> Please use "Reply All" to reply to the list.
--
Dave Kuhlman
http://www.davekuhlman.org
|
|
From: Guenter M. <mi...@us...> - 2017-05-21 10:23:01
|
Dear Dave,
On 2017-05-19, Dave Kuhlman wrote:
> I did the following:
> 1. Merged your changes (patch file below) into my local repository.
> 2. Did a bit of testing. I had an exception when a document
> contained an admonition. I fixed that.
> 3. Committed these changes to the central repository.
> Thank you for your help with this.
> Let me know if/when there is something more I can do.
I have one more patch that makes the code failsafe for Python
implementations missing the locale module (e.g. Jython).
If you could add a short summary of changed to the HISTORY.txt file,
we should be ready for release.
Thanks,
Günter
Index: __init__.py
===================================================================
--- __init__.py (Revision 8070)
+++ __init__.py (Arbeitskopie)
@@ -24,7 +24,10 @@
import copy
import urllib2
import docutils
-import locale
+try:
+ import locale # module missing in Jython
+except ImportError:
+ pass
from docutils import frontend, nodes, utils, writers, languages
from docutils.readers import standalone
from docutils.transforms import references
@@ -589,7 +592,10 @@
elif len(subtag) == 1:
break # 1-letter tag is never before valid region tag
if region_code is None:
- rcode = locale.normalize(language_code)
+ try:
+ rcode = locale.normalize(language_code)
+ except NameError:
+ rcode = language_code
rcode = rcode.split('_')
if len(rcode) > 1:
rcode = rcode[1].split('.')
@@ -596,11 +602,10 @@
region_code = rcode[0]
if region_code is None:
self.document.reporter.warning(
- 'invalid language-region. '
- 'Could not find region with locale.normalize(). '
- 'If language is supplied, then you must specify '
- 'both language and region (ll-RR). Examples: '
- 'es-MX (Spanish, Mexico), en-AU (English, Australia).')
+ 'invalid language-region.\n'
+ ' Could not find region with locale.normalize().\n'
+ ' Please specify both language and region (ll-RR).\n'
+ ' Examples: es-MX (Spanish, Mexico), en-AU (English, Australia).')
# Update the style ElementTree with the language and region.
# Note that we keep a reference to the modified node because
# it is possible that ElementTree will throw away the Python
|
|
From: Dave K. <dku...@da...> - 2017-05-19 18:22:57
|
Günter,
I did the following:
1. Merged your changes (patch file below) into my local repository.
2. Did a bit of testing. I had an exception when a document
contained an admonition. I fixed that.
3. Committed these changes to the central repository.
Thank you for your help with this. Let me know if/when there is
something more I can do.
Dave K
On Thu, May 18, 2017 at 07:42:35PM +0000, Guenter Milde wrote:
> Dear Dave,
>
> On 2017-05-16, Dave Kuhlman wrote:
>
> > I did the commit.
>
> > And, before I did so, I took Matěj's suggestion about using
> > ``locale.normalize(lang), so now you can use::
>
> > $ rst2odt.py -l cs somedoc.txt somedoc.odt
> > $ rst2odt.py -l es somedoc.txt somedoc.odt
>
> > to get Czech and Spanish (Spain).
>
> Fine.
>
> > And, of course, you can override the region, for example::
>
> > $ rst2odt.py -l cs-GB somedoc.txt somedoc.odt
> > $ rst2odt.py -l es-mx somedoc.txt somedoc.odt
>
> > to get British English and Mexican Spanish.
>
>
> I suggest the patch below to allow for BCP 47 tags like
>
> de-Latf-AT # second tag is script, region in 3rd position
> de-latf # second tag is script, no region given
> de-1901 # second tag is variant (here: spelling), no region given
>
>
> Further changes:
>
> The RuntimeError if locale.normalize fails to find a region tag is
> replaced with a Warning: a missing region tag does not prevent export
> of a functional output document.
>
> The RuntimeError for empty "self.visitor.language_code" is removed on the
> assumption that if a user calls ``--language=""``, this indicates that no
> language should be written into the output --- which is exactly what happens
> in this case.
>
> From the function "languages.normalize_language_tag()", we only need the
> replacement of "_" by "-". This is better done with a string method.
>
>
> Günter
>
>
> Dir: /home/milde/Code/Python/docutils-svn/docutils/docutils/writers/odf_odt/
>
> Index: __init__.py
> ===================================================================
> --- __init__.py (Revision 8069)
> +++ __init__.py (Arbeitskopie)
> @@ -572,38 +572,35 @@
> s1 = self.get_stylesheet()
> # Set default language in document to be generated.
> # Language is specified by the -l/--language command line option.
> - # Allowed values are "ll", "ll-rr" or "ll_rr", where ll is language
> - # and rr is region. If region is omitted, we use
> + # The format is described in BCP 47. If region is omitted, we use
> # local.normalize(ll) to obtain a region.
> language_code = None
> region_code = None
> - if len(self.visitor.normalized_language_code) > 0:
> - language_ids = self.visitor.normalized_language_code[0].split('-')
> - if len(language_ids) == 2:
> - language_code = language_ids[0]
> - region_code = language_ids[1]
> - elif len(language_ids) == 1:
> - language_code = language_ids[0]
> + if self.visitor.language_code:
> + language_ids = self.visitor.language_code.replace('_','-')
> + language_ids = language_ids.split('-')
> + # first tag is primary language tag
> + language_code = language_ids[0].lower()
> + # 2-letter region subtag may follow in 2nd or 3rd position
> + for subtag in language_ids[1:]:
> + if len(subtag) == 2 and subtag.isalpha():
> + region_code = subtag.upper()
> + break
> + elif len(subtag) == 1:
> + break # 1-letter tag is never before valid region tag
> + if region_code is None:
> rcode = locale.normalize(language_code)
> rcode = rcode.split('_')
> if len(rcode) > 1:
> - rcode = rcode[1]
> - rcode = rcode.split('.')
> - if len(rcode) >= 1:
> - region_code = rcode[0]
> + rcode = rcode[1].split('.')
> + region_code = rcode[0]
> if region_code is None:
> - raise RuntimeError(
> + self.document.reporter.warning(
> 'invalid language-region. '
> 'Could not find region with locale.normalize(). '
> 'If language is supplied, then you must specify '
> - 'both lanauge and region (ll-rr). Examples: '
> - 'es-mx (Spanish, Mexico), en-au (English, Australia).')
> - else:
> - raise RuntimeError(
> - 'invalid language-region. '
> - 'Format must be "ll-rr" or "ll_rr", where ll is language '
> - 'and rr is region. '
> - 'See https://en.wikipedia.org/wiki/IETF_language_tag')
> + 'both language and region (ll-RR). Examples: '
> + 'es-MX (Spanish, Mexico), en-AU (English, Australia).')
> # Update the style ElementTree with the language and region.
> # Note that we keep a reference to the modified node because
> # it is possible that ElementTree will throw away the Python
> @@ -888,8 +885,6 @@
> self.language = languages.get_language(
> self.language_code,
> document.reporter)
> - self.normalized_language_code = languages.normalize_language_tag(
> - self.language_code)
> self.format_map = {}
> if self.settings.odf_config_file:
> from ConfigParser import ConfigParser
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Docutils-users mailing list
> Doc...@li...
> https://lists.sourceforge.net/lists/listinfo/docutils-users
>
> Please use "Reply All" to reply to the list.
--
Dave Kuhlman
http://www.davekuhlman.org
|
|
From: Guenter M. <mi...@us...> - 2017-05-18 19:42:58
|
Dear Dave,
On 2017-05-16, Dave Kuhlman wrote:
> I did the commit.
> And, before I did so, I took Matěj's suggestion about using
> ``locale.normalize(lang), so now you can use::
> $ rst2odt.py -l cs somedoc.txt somedoc.odt
> $ rst2odt.py -l es somedoc.txt somedoc.odt
> to get Czech and Spanish (Spain).
Fine.
> And, of course, you can override the region, for example::
> $ rst2odt.py -l cs-GB somedoc.txt somedoc.odt
> $ rst2odt.py -l es-mx somedoc.txt somedoc.odt
> to get British English and Mexican Spanish.
I suggest the patch below to allow for BCP 47 tags like
de-Latf-AT # second tag is script, region in 3rd position
de-latf # second tag is script, no region given
de-1901 # second tag is variant (here: spelling), no region given
Further changes:
The RuntimeError if locale.normalize fails to find a region tag is
replaced with a Warning: a missing region tag does not prevent export
of a functional output document.
The RuntimeError for empty "self.visitor.language_code" is removed on the
assumption that if a user calls ``--language=""``, this indicates that no
language should be written into the output --- which is exactly what happens
in this case.
>From the function "languages.normalize_language_tag()", we only need the
replacement of "_" by "-". This is better done with a string method.
Günter
Dir: /home/milde/Code/Python/docutils-svn/docutils/docutils/writers/odf_odt/
Index: __init__.py
===================================================================
--- __init__.py (Revision 8069)
+++ __init__.py (Arbeitskopie)
@@ -572,38 +572,35 @@
s1 = self.get_stylesheet()
# Set default language in document to be generated.
# Language is specified by the -l/--language command line option.
- # Allowed values are "ll", "ll-rr" or "ll_rr", where ll is language
- # and rr is region. If region is omitted, we use
+ # The format is described in BCP 47. If region is omitted, we use
# local.normalize(ll) to obtain a region.
language_code = None
region_code = None
- if len(self.visitor.normalized_language_code) > 0:
- language_ids = self.visitor.normalized_language_code[0].split('-')
- if len(language_ids) == 2:
- language_code = language_ids[0]
- region_code = language_ids[1]
- elif len(language_ids) == 1:
- language_code = language_ids[0]
+ if self.visitor.language_code:
+ language_ids = self.visitor.language_code.replace('_','-')
+ language_ids = language_ids.split('-')
+ # first tag is primary language tag
+ language_code = language_ids[0].lower()
+ # 2-letter region subtag may follow in 2nd or 3rd position
+ for subtag in language_ids[1:]:
+ if len(subtag) == 2 and subtag.isalpha():
+ region_code = subtag.upper()
+ break
+ elif len(subtag) == 1:
+ break # 1-letter tag is never before valid region tag
+ if region_code is None:
rcode = locale.normalize(language_code)
rcode = rcode.split('_')
if len(rcode) > 1:
- rcode = rcode[1]
- rcode = rcode.split('.')
- if len(rcode) >= 1:
- region_code = rcode[0]
+ rcode = rcode[1].split('.')
+ region_code = rcode[0]
if region_code is None:
- raise RuntimeError(
+ self.document.reporter.warning(
'invalid language-region. '
'Could not find region with locale.normalize(). '
'If language is supplied, then you must specify '
- 'both lanauge and region (ll-rr). Examples: '
- 'es-mx (Spanish, Mexico), en-au (English, Australia).')
- else:
- raise RuntimeError(
- 'invalid language-region. '
- 'Format must be "ll-rr" or "ll_rr", where ll is language '
- 'and rr is region. '
- 'See https://en.wikipedia.org/wiki/IETF_language_tag')
+ 'both language and region (ll-RR). Examples: '
+ 'es-MX (Spanish, Mexico), en-AU (English, Australia).')
# Update the style ElementTree with the language and region.
# Note that we keep a reference to the modified node because
# it is possible that ElementTree will throw away the Python
@@ -888,8 +885,6 @@
self.language = languages.get_language(
self.language_code,
document.reporter)
- self.normalized_language_code = languages.normalize_language_tag(
- self.language_code)
self.format_map = {}
if self.settings.odf_config_file:
from ConfigParser import ConfigParser
|
|
From: Matěj C. <mc...@ce...> - 2017-05-17 01:01:13
|
On 2017-05-16, 21:48 GMT, Dave Kuhlman wrote: > And, Matěj, thanks for being patient with me and thank you for > all your help with this. You did all the real work. Thank you! Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mc...@ce... GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 Of course I'm respectable. I'm old. Politicians, ugly buildings, and whores all get respectable if they last long enough. --John Huston in "Chinatown." |
|
From: Dave K. <dku...@da...> - 2017-05-16 21:54:04
|
> Thank you for that suggestion, Matěj. I did know about that.
Rats. Meant to say I did *not* know.
And, Matěj, thanks for being patient with me and thank you for all
your help with this.
Dave K.
On Tue, May 16, 2017 at 02:29:00PM -0700, Dave Kuhlman wrote:
> Günter and Matěj,
>
> I did the commit.
>
> And, before I did so, I took Matěj's suggestion about using
> ``locale.normalize(lang), so now you can use::
>
> $ rst2odt.py -l cs somedoc.txt somedoc.odt
> $ rst2odt.py -l es somedoc.txt somedoc.odt
>
> to get Czech and Spanish (Spain).
>
> And, of course, you can override the region, for example::
>
> $ rst2odt.py -l cs-GB somedoc.txt somedoc.odt
> $ rst2odt.py -l es-mx somedoc.txt somedoc.odt
>
> to get British English and Mexican Spanish.
>
> Thank you for that suggestion, Matěj. I did know about that.
>
> Dave K.
>
>
> On Tue, May 16, 2017 at 12:10:04PM +0000, Guenter Milde wrote:
> > On 2017-05-16, Matej Cepl wrote:
> > > On 16/05/17 01:42, Dave Kuhlman wrote:
> >
> > >> 1. Images that use ":width: xx%" are scaled to the line width.
> > ...
> >
> > >> 2. The header/title of an admonition (for example, a note) now
> > >> follows the style of the admonition header
> > ...
> >
> > >> 3. The unit test error that you found is fixed.
> > ...
> >
> > Wonderfull. Thanks a lot for taking care of this.
> >
> > >> Please let me know if we are getting closer, what else needs fixing,
> > >> etc.
> >
> > > This works for me. As far as me I would get this let be released.
> >
> > I second this, please commit and then it may be really time for 0.14!
> >
> >
> > I have one remaining question:
> >
> > I understand, that LO/OO expects both, language and region tag of a document
> > to be set.
> > I also understand that auto-filling the region tag is tricky.
> >
> > What happens exactly, if in an rst2odt-exported document the language tag is
> > set but the region tag is missing:
> >
> > a) an error/warning
> > b) the region is set to "US"
> > c) the region is set according to the users locale?
> >
> > What should Docutils do in these cases?
> >
> > >> By default, it was passing in "en" as the language, whereas now it
> > >> needs to be "en-US" or to be omitted. I overrode it with "en-US".
> >
> > Ther problem here is, that according to our specs, the default for
> > "language-code" is
> >
> > Default: English ("en"). Options: ``--language, -l``.
> >
> > Unless absolutely required otherwise, I suggest passing just "en".
> >
> > If this is not possible, the odt writer could use a different default
> > (this needs to be documented).
> >
> > Rationale: not only Mexican and Castillean Spaniards disagree about the
> > default region tag for a language, narrowing "en" to American English
> > must at least be documented.
> >
> > But this may also be sorted out later.
> >
> >
> > Thanks again,
> >
> > Günter
> >
> >
> > ------------------------------------------------------------------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Docutils-users mailing list
> > Doc...@li...
> > https://lists.sourceforge.net/lists/listinfo/docutils-users
> >
> > Please use "Reply All" to reply to the list.
>
> --
>
> Dave Kuhlman
> http://www.davekuhlman.org
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Docutils-users mailing list
> Doc...@li...
> https://lists.sourceforge.net/lists/listinfo/docutils-users
>
> Please use "Reply All" to reply to the list.
--
Dave Kuhlman
http://www.davekuhlman.org
|
|
From: Dave K. <dku...@da...> - 2017-05-16 21:34:09
|
Günter and Matěj,
I did the commit.
And, before I did so, I took Matěj's suggestion about using
``locale.normalize(lang), so now you can use::
$ rst2odt.py -l cs somedoc.txt somedoc.odt
$ rst2odt.py -l es somedoc.txt somedoc.odt
to get Czech and Spanish (Spain).
And, of course, you can override the region, for example::
$ rst2odt.py -l cs-GB somedoc.txt somedoc.odt
$ rst2odt.py -l es-mx somedoc.txt somedoc.odt
to get British English and Mexican Spanish.
Thank you for that suggestion, Matěj. I did know about that.
Dave K.
On Tue, May 16, 2017 at 12:10:04PM +0000, Guenter Milde wrote:
> On 2017-05-16, Matej Cepl wrote:
> > On 16/05/17 01:42, Dave Kuhlman wrote:
>
> >> 1. Images that use ":width: xx%" are scaled to the line width.
> ...
>
> >> 2. The header/title of an admonition (for example, a note) now
> >> follows the style of the admonition header
> ...
>
> >> 3. The unit test error that you found is fixed.
> ...
>
> Wonderfull. Thanks a lot for taking care of this.
>
> >> Please let me know if we are getting closer, what else needs fixing,
> >> etc.
>
> > This works for me. As far as me I would get this let be released.
>
> I second this, please commit and then it may be really time for 0.14!
>
>
> I have one remaining question:
>
> I understand, that LO/OO expects both, language and region tag of a document
> to be set.
> I also understand that auto-filling the region tag is tricky.
>
> What happens exactly, if in an rst2odt-exported document the language tag is
> set but the region tag is missing:
>
> a) an error/warning
> b) the region is set to "US"
> c) the region is set according to the users locale?
>
> What should Docutils do in these cases?
>
> >> By default, it was passing in "en" as the language, whereas now it
> >> needs to be "en-US" or to be omitted. I overrode it with "en-US".
>
> Ther problem here is, that according to our specs, the default for
> "language-code" is
>
> Default: English ("en"). Options: ``--language, -l``.
>
> Unless absolutely required otherwise, I suggest passing just "en".
>
> If this is not possible, the odt writer could use a different default
> (this needs to be documented).
>
> Rationale: not only Mexican and Castillean Spaniards disagree about the
> default region tag for a language, narrowing "en" to American English
> must at least be documented.
>
> But this may also be sorted out later.
>
>
> Thanks again,
>
> Günter
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Docutils-users mailing list
> Doc...@li...
> https://lists.sourceforge.net/lists/listinfo/docutils-users
>
> Please use "Reply All" to reply to the list.
--
Dave Kuhlman
http://www.davekuhlman.org
|
|
From: Matěj C. <mc...@ce...> - 2017-05-16 15:01:12
|
On 2017-05-16, 12:10 GMT, Guenter Milde wrote: > Unless absolutely required otherwise, I suggest passing just > "en". > > If this is not possible, the odt writer could use a different default > (this needs to be documented). > > Rationale: not only Mexican and Castillean Spaniards disagree about the > default region tag for a language, narrowing "en" to American English > must at least be documented. What about locale.normalize() (https://is.gd/dZe2bZ)? In [1]: import locale In [2]: locale.normalize('en') Out[2]: 'en_US.ISO8859-1' In [3]: locale.normalize('cs') Out[3]: 'cs_CZ.ISO8859-2' In [4]: locale.normalize('es') Out[4]: 'es_ES.ISO8859-1' In [5]: locale.normalize('fr') Out[5]: 'fr_FR.ISO8859-1' In [6]: (that encoding is bad, I would prefer UTF-8 all the time, but that’s another point) Best, Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mc...@ce... GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 Of course I'm respectable. I'm old. Politicians, ugly buildings, and whores all get respectable if they last long enough. --John Huston in "Chinatown." |
|
From: Guenter M. <mi...@us...> - 2017-05-16 12:10:26
|
On 2017-05-16, Matej Cepl wrote:
> On 16/05/17 01:42, Dave Kuhlman wrote:
>> 1. Images that use ":width: xx%" are scaled to the line width.
...
>> 2. The header/title of an admonition (for example, a note) now
>> follows the style of the admonition header
...
>> 3. The unit test error that you found is fixed.
...
Wonderfull. Thanks a lot for taking care of this.
>> Please let me know if we are getting closer, what else needs fixing,
>> etc.
> This works for me. As far as me I would get this let be released.
I second this, please commit and then it may be really time for 0.14!
I have one remaining question:
I understand, that LO/OO expects both, language and region tag of a document
to be set.
I also understand that auto-filling the region tag is tricky.
What happens exactly, if in an rst2odt-exported document the language tag is
set but the region tag is missing:
a) an error/warning
b) the region is set to "US"
c) the region is set according to the users locale?
What should Docutils do in these cases?
>> By default, it was passing in "en" as the language, whereas now it
>> needs to be "en-US" or to be omitted. I overrode it with "en-US".
Ther problem here is, that according to our specs, the default for
"language-code" is
Default: English ("en"). Options: ``--language, -l``.
Unless absolutely required otherwise, I suggest passing just "en".
If this is not possible, the odt writer could use a different default
(this needs to be documented).
Rationale: not only Mexican and Castillean Spaniards disagree about the
default region tag for a language, narrowing "en" to American English
must at least be documented.
But this may also be sorted out later.
Thanks again,
Günter
|
|
From: Matej C. <mc...@ce...> - 2017-05-16 07:55:29
|
On 16/05/17 01:42, Dave Kuhlman wrote: > 1. Images that use ":width: xx%" are scaled to the line width. Note > that if, after generating the .odt file, you edit it with > LibreOffice Writer, and you use menu item Format/Page to modify > the page width, the image size does *not* automatically adjust. > Is this a needed feature? If it is, you could try to right-click > on the image and edit its properties. But, none of that seemed > satisfactory to me. I don’t think it is necessary. I believe that the primary use of rst2odt is for sharing the document for review (tracking changes and notes are working really well with LOWriter) or for providing camera-ready copies of documents for those who prefer Word-like format. For both cases I would just need to be sure that images look like when run through other rst2* programs. If somebody wants to take .odt for serious editing, she can very well make sure images work for her. > 2. The header/title of an admonition (for example, a note) now > follows the style of the admonition header (for example, > rststyle-admon-note-hdr, rststyle-admon-warning-hdr, etc). I was > mistakenly using the admonition title after it had been > translated (for example, to "Poznámka!") to generate the style. > And, there is no style named "rststyle-admon-Poznámka!-hdr". Perfect. Thanks. > 3. The unit test error that you found is fixed. By default, it was > passing in "en" as the language, whereas now it needs to be > "en-US" or to be omitted. I overrode it with "en-US". Awesome. > Wow. This is turning out to be more fun than I thought it would. > > Please let me know if we are getting closer, what else needs fixing, > etc. This works for me. As far as me I would get this let be released. Thank you very much, Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mc...@ce... GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 Of course I'm respectable. I'm old. Politicians, ugly buildings, and whores all get respectable if they last long enough. --John Huston in "Chinatown." |
|
From: Dave K. <dku...@da...> - 2017-05-16 00:06:12
|
Matěj, Here is what I believe I fixed: 1. Images that use ":width: xx%" are scaled to the line width. Note that if, after generating the .odt file, you edit it with LibreOffice Writer, and you use menu item Format/Page to modify the page width, the image size does *not* automatically adjust. Is this a needed feature? If it is, you could try to right-click on the image and edit its properties. But, none of that seemed satisfactory to me. 2. The header/title of an admonition (for example, a note) now follows the style of the admonition header (for example, rststyle-admon-note-hdr, rststyle-admon-warning-hdr, etc). I was mistakenly using the admonition title after it had been translated (for example, to "Poznámka!") to generate the style. And, there is no style named "rststyle-admon-Poznámka!-hdr". 3. The unit test error that you found is fixed. By default, it was passing in "en" as the language, whereas now it needs to be "en-US" or to be omitted. I overrode it with "en-US". The modified files are attached to a separate message. Wow. This is turning out to be more fun than I thought it would. Please let me know if we are getting closer, what else needs fixing, etc. Dave -- Dave Kuhlman http://www.davekuhlman.org |
|
From: Matej C. <mc...@ce...> - 2017-05-13 08:25:45
|
On 13/05/17 00:33, Dave Kuhlman wrote: > The reason for the small scale factor is that your image is quite > large. The size returned by PIL (the Python Image Library) > for your image (frantisek_xaversky.jpg) is 2448 X 3264. That's > pixels, I suppose. The conversion factor that I found at > http://www.unitconversion.org/unit_converter/typography-ex.html > is 1 px = 0.0264 cm. So, for example, 2448 * 0.0264 * .15 = > 9.69 cm, which is a reasonable starting width for your image on a > page, and you can adjust from there. I think we have misunderstanding here. http://docutils.sourceforge.net/docs/ref/rst/directives.html#image says, that ``width`` parameter has as units “length or percentage of the current line width”. It seems to me you think that percent means the scaling factor. It doesn’t. rst2xetex does it perfectly well (see PDF I have attached to one of the earlier emails to you). Best, Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mc...@ce... GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 Of course I'm respectable. I'm old. Politicians, ugly buildings, and whores all get respectable if they last long enough. --John Huston in "Chinatown." |