Skip to content

Commit

Permalink
Code in here is pretty mang :/
Browse files Browse the repository at this point in the history
  • Loading branch information
stuaxo committed May 2, 2016
1 parent 86bb66d commit 057e2f9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions doc/sphinxcontrib-shoebot/sphinxcontrib/shoebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}

BOT_HEADER = """
size(100, 100)
size{size}
background(1)
fill(.95,.75,0)
"""
Expand Down Expand Up @@ -107,18 +107,18 @@ def run(self):
parsed = highlight(text, PythonLexer(), HtmlFormatter())

result = [nodes.raw('', parsed, format='html')]

if True:
# If we want a snapshot - this should check the 'snapshot argument'#
# If we want a snapshot - this should check the 'snapshot argument'#
fn = '{}.png'.format(sha(text).hexdigest())
print("fn: %s" % fn)

env = self.state.document.settings.env
rel_filename, filename = env.relfn2path(fn)

outfn = os.path.join(env.app.builder.outdir, '_static', rel_filename)
ensuredir(os.path.dirname(outfn))
script_to_render = BOT_HEADER + text
script_to_render = BOT_HEADER.format(size=(100, 100)) + text
try:
cmd = ['sbot', '-o', '%s' % outfn, script_to_render]
print("run: %s" % " ".join(cmd))
Expand All @@ -128,7 +128,6 @@ def run(self):
print("oops %e" % e)
raise ShoebotError(str(e))


# TODO - Support other output formats
image_node = nodes.raw('', html_img_tag(rel_filename), format='html')
result.insert(0,image_node)
Expand Down

0 comments on commit 057e2f9

Please sign in to comment.