Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
Zope
Commits
466c94d5
Commit
466c94d5
authored
22 years ago
by
Andreas Jung
Browse files
Options
Download
Email Patches
Plain Diff
- removed debug print
- added env. variables for input/output encodings
parent
f2b0ecee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
lib/python/reStructuredText/__init__.py
lib/python/reStructuredText/__init__.py
+8
-9
No files found.
lib/python/reStructuredText/__init__.py
View file @
466c94d5
...
...
@@ -17,9 +17,14 @@ __all__ = ["HTML" ]
import
docutils.core
from
docutils.io
import
StringOutput
,
StringInput
import
sys
import
sys
,
os
default_input_encoding
=
os
.
environ
.
get
(
"REST_INPUT_ENCODING"
,
sys
.
getdefaultencoding
())
default_output_encoding
=
os
.
environ
.
get
(
"REST_OUTPUT_ENCODING"
,
sys
.
getdefaultencoding
())
class
Warnings
:
def
__init__
(
self
):
self
.
messages
=
[]
...
...
@@ -28,7 +33,8 @@ class Warnings:
def
HTML
(
src
,
writer
=
'html4zope'
,
report_level
=
1
,
stylesheet
=
'default.css'
,
input_encoding
=
None
,
output_encoding
=
None
):
input_encoding
=
default_input_encoding
,
output_encoding
=
default_output_encoding
):
""" render HTML from a reStructuredText string
- 'src' -- string containing a valid reST document
...
...
@@ -44,12 +50,6 @@ def HTML(src, writer='html4zope', report_level=1, stylesheet='default.css',
pub
.
set_reader
(
'standalone'
,
None
,
'restructuredtext'
)
pub
.
set_writer
(
writer
)
if
input_encoding
is
None
:
input_encoding
=
sys
.
getdefaultencoding
()
if
output_encoding
is
None
:
output_encoding
=
sys
.
getdefaultencoding
()
# go with the defaults
pub
.
get_settings
()
...
...
@@ -78,6 +78,5 @@ def HTML(src, writer='html4zope', report_level=1, stylesheet='default.css',
warnings
=
''
.
join
(
pub
.
settings
.
warning_stream
.
messages
)
# do the format
print
pub
.
writer
.
write
(
document
,
pub
.
destination
)
return
pub
.
writer
.
write
(
document
,
pub
.
destination
)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment