|
From: <dku...@us...> - 2017-05-22 23:24:09
|
Revision: 8072
http://sourceforge.net/p/docutils/code/8072
Author: dkuhlman
Date: 2017-05-22 23:24:06 +0000 (Mon, 22 May 2017)
Log Message:
-----------
Enable use of Jython without import exception of locale
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docutils/writers/odf_odt/__init__.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2017-05-21 10:16:33 UTC (rev 8071)
+++ trunk/docutils/HISTORY.txt 2017-05-22 23:24:06 UTC (rev 8072)
@@ -87,7 +87,17 @@
* tools/dev/generate_punctuation_chars.py: New skript
to test and update utils.punctuation_chars.
+* docutils/writers/odf_ odt/__init__.py:
+ - Command line option -l/--language now sets the default language
+ of the generated ODF document.
+ - The use of image directive options :width: (%), :scale:, etc now
+ set the width/height/size of images in the generated ODF
+ documents.
+ - The heading/title of admonitions now reflects the language
+ specified by the -l/--language command line option.
+
+
Release 0.13.1 (2016-12-09)
===========================
Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py 2017-05-21 10:16:33 UTC (rev 8071)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py 2017-05-22 23:24:06 UTC (rev 8072)
@@ -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,11 @@
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),\n'
+ ' 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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|