Skip to content

Commit bac4f07

Browse files
committed
Tweaked pweave markdown generator.
1 parent f72701d commit bac4f07

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pyrasterframes/src/main/python/setup.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ def _divided(msg):
4747
return divider + '\n' + msg + '\n' + divider
4848

4949

50+
from pweave import PwebPandocFormatter
51+
52+
class PegdownMarkdownFormatter(PwebPandocFormatter):
53+
def __init__(self, *args, **kwargs):
54+
super().__init__(*args, **kwargs)
55+
56+
# Pegdown doesn't support the width and label options.
57+
def make_figure_string(self, figname, width, label, caption=""):
58+
return "![%s](%s)" % (caption, figname)
59+
5060
class PweaveDocs(distutils.cmd.Command):
5161
"""A custom command to run documentation scripts through pweave."""
5262
description = 'Pweave PyRasterFrames documentation scripts'
@@ -88,6 +98,11 @@ def run(self):
8898
import pweave
8999
bad_words = ["Error"]
90100
pweave.rcParams["chunk"]["defaultoptions"].update({'wrap': False, 'dpi': 100})
101+
if self.format == 'markdown':
102+
pweave.PwebFormats.formats['markdown'] = {
103+
'class': PegdownMarkdownFormatter,
104+
'description': 'Pegdown compatible markdown'
105+
}
91106

92107
for file in self.files:
93108
name = path.splitext(path.basename(file))[0]

0 commit comments

Comments
 (0)