Skip to content

Commit a40be5f

Browse files
committed
Move PegdownMarkdownFormatter to docs class
Signed-off-by: Jason T. Brown <jason@astraea.earth>
1 parent e62f5fe commit a40be5f

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

pyrasterframes/src/main/python/docs/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import os
2222
from pyspark.sql import DataFrame
2323
from pyrasterframes import RFContext
24+
from pweave import PwebPandocFormatter
25+
2426

2527
def docs_dir():
2628
return os.path.dirname(os.path.realpath(__file__))
@@ -38,3 +40,12 @@ def resource_dir():
3840

3941
def resource_dir_uri():
4042
return 'file://' + resource_dir()
43+
44+
45+
class PegdownMarkdownFormatter(PwebPandocFormatter):
46+
def __init__(self, *args, **kwargs):
47+
super().__init__(*args, **kwargs)
48+
49+
# Pegdown doesn't support the width and label options.
50+
def make_figure_string(self, figname, width, label, caption=""):
51+
return "![%s](%s)" % (caption, figname)

pyrasterframes/src/main/python/setup.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ class PweaveDocs(distutils.cmd.Command):
5757
('quick=', 'q', 'Check to see if the source file is newer than existing output before building. Defaults to `False`.')
5858
]
5959

60-
from pweave import PwebPandocFormatter
61-
62-
class PegdownMarkdownFormatter(PwebPandocFormatter):
63-
def __init__(self, *args, **kwargs):
64-
super().__init__(*args, **kwargs)
65-
66-
# Pegdown doesn't support the width and label options.
67-
def make_figure_string(self, figname, width, label, caption=""):
68-
return "![%s](%s)" % (caption, figname)
6960

7061
def initialize_options(self):
7162
"""Set default values for options."""
@@ -96,6 +87,8 @@ def run(self):
9687
"""Run pweave."""
9788
import traceback
9889
import pweave
90+
from docs import PegdownMarkdownFormatter
91+
9992
bad_words = ["Error"]
10093
pweave.rcParams["chunk"]["defaultoptions"].update({'wrap': False, 'dpi': 100})
10194
if self.format == 'markdown':

0 commit comments

Comments
 (0)