Skip to content

Commit c76118e

Browse files
committed
PDF transformation
1 parent c9855bd commit c76118e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bin/transform.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import re
1010
from util import CHARACTERS, usage, get_crossref, get_toc
1111

12+
PATH_TO_ROOT = '../../' # from TeX directory to root of project
13+
1214
#-------------------------------------------------------------------------------
1315

1416
class Base(object):
@@ -47,7 +49,8 @@ def _replace(self, lines, before, after):
4749

4850
class ExerciseAndSolution(Base):
4951
'''
50-
Turn <section>...<h3>exercise title</h3>...<aside>...</aside>...</section> into section and subsection markers.
52+
Turn <section>...<h3>exercise title</h3>...<aside>...</aside>...</section>
53+
into section and subsection markers.
5154
'''
5255

5356
def pre(self, lines):
@@ -302,7 +305,12 @@ class Figure(BaseRegexp):
302305
MATCH_HTML = r'<figure\s+id="(f:.+)">\s*<img\s+src="(.+)"\s*/>\s*<figcaption>(.+)</figcaption>\s*</figure>'
303306
WRITE_TEMP = r'==figure=={0}=={1}=={2}=='
304307
MATCH_TEMP = r'==figure==(.+)==(.+)==(.+)=='
305-
WRITE_LATEX = '\\begin{{figure}}\n\\centering\n\\includegraphics{{{1}}}\n\\caption{{{2}}}\n\\label{{{0}}}\n\\end{{figure}}'
308+
WRITE_LATEX = r'''\begin{{figure}}
309+
\centering
310+
\includegraphics{{PATH_TO_ROOT{1}}}
311+
\caption{{{2}}}
312+
\label{{{0}}}
313+
\end{{figure}}'''.replace('PATH_TO_ROOT', PATH_TO_ROOT)
306314

307315

308316
class FigureRef(BaseRegexp):

0 commit comments

Comments
 (0)