[py-svn] r20736 - in py/dist/py: bin misc rest
cfbolz at codespeak.net
cfbolz at codespeak.net
Tue Dec 6 10:47:41 CET 2005
Author: cfbolz
Date: Tue Dec 6 10:47:39 2005
New Revision: 20736
Modified:
py/dist/py/bin/rst2pdf.py
py/dist/py/misc/rest.py
py/dist/py/rest/restgraphviz.py
Log:
remove one of the hacks of the graphviz directive. I take back some of my
curses against docutils (because getting at the path is actually possible) and
add a whole bunch of new ones (because doing so is extremely hard).
Modified: py/dist/py/bin/rst2pdf.py
==============================================================================
--- py/dist/py/bin/rst2pdf.py (original)
+++ py/dist/py/bin/rst2pdf.py Tue Dec 6 10:47:39 2005
@@ -31,13 +31,11 @@
(options, args) = parser.parse_args()
if options.configfile is not None:
configfile = py.path.local(options.configfile)
- graphvizdirective.path = configfile.dirpath()
process_configfile(options.configfile, options.debug)
elif len(args) != 1:
parser.error("please supply a file name")
else:
f = py.path.local(args[0])
- graphvizdirective.path = f.dirpath()
process_rest_file(args[0], options.stylesheet, options.debug)
Modified: py/dist/py/misc/rest.py
==============================================================================
--- py/dist/py/misc/rest.py (original)
+++ py/dist/py/misc/rest.py Tue Dec 6 10:47:39 2005
@@ -16,8 +16,7 @@
stylesheet path (to be used if any)
"""
from docutils.core import publish_string
- graphvizdirective = restgraphviz.GraphvizDirective(
- "html", source_path.dirpath())
+ graphvizdirective = restgraphviz.GraphvizDirective("html")
kwargs = {
'stylesheet' : stylesheet,
'stylesheet_path': None,
Modified: py/dist/py/rest/restgraphviz.py
==============================================================================
--- py/dist/py/rest/restgraphviz.py (original)
+++ py/dist/py/rest/restgraphviz.py Tue Dec 6 10:47:39 2005
@@ -15,20 +15,20 @@
#XXX it is only used to work around the inflexibility of docutils:
# a directive does not know the path of the file it looks at, nor the
# format
- def __init__(self, backend, path=py.path.local()):
+ def __init__(self, backend):
self.backend = backend
self.convert_to_format = backend_to_image_format[backend]
- self.path = path
directives.register_directive("graphviz", self.directive_function)
- def convert(self, fn):
- dot = self.path.join(fn)
+ def convert(self, fn, path):
+ path = py.path.local(path).dirpath()
+ dot = path.join(fn)
result = convert_dot(dot, self.convert_to_format)
- return result.relto(self.path)
+ return result.relto(path)
def directive_function(self, name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
- newname = self.convert(arguments[0])
+ newname = self.convert(arguments[0], state.document.settings._source)
text = block_text.replace("graphviz", "image", 1)
text = text.replace(arguments[0], newname, 1)
return images.image(u'image', [newname], options, content, lineno,
More information about the pytest-commit
mailing list