@@ -21,38 +21,38 @@ local with_working_directory = system.with_working_directory
21
21
-- The PlantUML path. If set, uses the environment variable PLANTUML or the
22
22
-- value "plantuml.jar" (local PlantUML version). In order to define a
23
23
-- PlantUML version per pandoc document, use the meta data to define the key
24
- -- "plantumlPath ".
25
- local plantumlPath = os.getenv (" PLANTUML" ) or " plantuml.jar"
24
+ -- "plantuml_path ".
25
+ local plantuml_path = os.getenv (" PLANTUML" ) or " plantuml.jar"
26
26
27
27
-- The Inkscape path. In order to define an Inkscape version per pandoc
28
- -- document, use the meta data to define the key "inkscapePath ".
29
- local inkscapePath = os.getenv (" INKSCAPE" ) or " inkscape"
28
+ -- document, use the meta data to define the key "inkscape_path ".
29
+ local inkscape_path = os.getenv (" INKSCAPE" ) or " inkscape"
30
30
31
31
-- The Python path. In order to define a Python version per pandoc document,
32
- -- use the meta data to define the key "pythonPath ".
33
- local pythonPath = os.getenv (" PYTHON" )
32
+ -- use the meta data to define the key "python_path ".
33
+ local python_path = os.getenv (" PYTHON" )
34
34
35
35
-- The Python environment's activate script. Can be set on a per document
36
36
-- basis by using the meta data key "activatePythonPath".
37
- local pythonActivatePath = os.getenv (" PYTHON_ACTIVATE" )
37
+ local python_activate_path = os.getenv (" PYTHON_ACTIVATE" )
38
38
39
39
-- The Java path. In order to define a Java version per pandoc document,
40
- -- use the meta data to define the key "javaPath ".
41
- local javaPath = os.getenv (" JAVA_HOME" )
42
- if javaPath then
43
- javaPath = javaPath .. package.config :sub (1 ,1 ) .. " bin"
40
+ -- use the meta data to define the key "java_path ".
41
+ local java_path = os.getenv (" JAVA_HOME" )
42
+ if java_path then
43
+ java_path = java_path .. package.config :sub (1 ,1 ) .. " bin"
44
44
.. package.config :sub (1 ,1 ) .. " java"
45
45
else
46
- javaPath = " java"
46
+ java_path = " java"
47
47
end
48
48
49
49
-- The dot (Graphviz) path. In order to define a dot version per pandoc
50
- -- document, use the meta data to define the key "dotPath ".
51
- local dotPath = os.getenv (" DOT" ) or " dot"
50
+ -- document, use the meta data to define the key "dot_path ".
51
+ local dot_path = os.getenv (" DOT" ) or " dot"
52
52
53
53
-- The pdflatex path. In order to define a pdflatex version per pandoc
54
- -- document, use the meta data to define the key "pdflatexPath ".
55
- local pdflatexPath = os.getenv (" PDFLATEX" ) or " pdflatex"
54
+ -- document, use the meta data to define the key "pdflatex_path ".
55
+ local pdflatex_path = os.getenv (" PDFLATEX" ) or " pdflatex"
56
56
57
57
-- The default format is SVG i.e. vector graphics:
58
58
local filetype = " svg"
77
77
-- meta options was set, it gets used instead of the corresponding
78
78
-- environment variable:
79
79
function Meta (meta )
80
- plantumlPath = meta .plantumlPath or plantumlPath
81
- inkscapePath = meta .inkscapePath or inkscapePath
82
- pythonPath = meta .pythonPath or pythonPath
83
- pythonActivatePath = meta .activatePythonPath or pythonActivatePath
84
- javaPath = meta .javaPath or javaPath
85
- dotPath = meta .dotPath or dotPath
86
- pdflatexPath = meta .pdflatexPath or pdflatexPath
80
+ plantuml_path =
81
+ meta .plantuml_path or meta .plantumlPath or plantuml_path
82
+ inkscape_path =
83
+ meta .inkscape_path or meta .inkscapePath or inkscape_path
84
+ python_path =
85
+ meta .python_path or meta .pythonPath or python_path
86
+ python_activate_path =
87
+ meta .activate_python_path or meta .activatePythonPath or python_activate_path
88
+ java_path =
89
+ meta .java_path or meta .javaPath or java_path
90
+ dot_path =
91
+ meta .path_dot or meta .dotPath or dot_path
92
+ pdflatex_path =
93
+ meta .pdflatex_path or meta .pdflatexPath or pdflatex_path
87
94
end
88
95
89
96
-- Call plantuml.jar with some parameters (cf. PlantUML help):
90
97
local function plantuml (puml , filetype )
91
- local final = pandoc .pipe (javaPath , {" -jar" , plantumlPath , " -t" .. filetype , " -pipe" , " -charset" , " UTF8" }, puml )
92
- return final
98
+ return pandoc .pipe (
99
+ java_path ,
100
+ {" -jar" , plantuml_path , " -t" .. filetype , " -pipe" , " -charset" , " UTF8" },
101
+ puml
102
+ )
93
103
end
94
104
95
105
-- Call dot (GraphViz) in order to generate the image
96
106
-- (thanks @muxueqz for this code):
97
107
local function graphviz (code , filetype )
98
- local final = pandoc .pipe (dotPath , {" -T" .. filetype }, code )
99
- return final
108
+ return pandoc .pipe (dot_path , {" -T" .. filetype }, code )
100
109
end
101
110
102
111
--
@@ -134,7 +143,7 @@ local function convert_from_pdf(filetype)
134
143
return function (pdf_file , outfile )
135
144
local inkscape_command = string.format (
136
145
' "%s" --without-gui --file="%s" ' .. inkscape_output_args ,
137
- inkscapePath ,
146
+ inkscape_path ,
138
147
pdf_file ,
139
148
outfile
140
149
)
@@ -166,7 +175,7 @@ local function tikz2image(src, filetype, additional_packages)
166
175
f :close ()
167
176
168
177
-- Execute the LaTeX compiler:
169
- pandoc .pipe (pdflatexPath , {' -output-directory' , tmpdir , tikz_file }, ' ' )
178
+ pandoc .pipe (pdflatex_path , {' -output-directory' , tmpdir , tikz_file }, ' ' )
170
179
171
180
convert (pdf_file , outfile )
172
181
@@ -204,9 +213,9 @@ local function py2image(code, filetype)
204
213
f :close ()
205
214
206
215
-- Execute Python in the desired environment:
207
- local pycmd = pythonPath .. ' ' .. pyfile
208
- local command = pythonActivatePath
209
- and pythonActivatePath .. ' && ' .. pycmd
216
+ local pycmd = python_path .. ' ' .. pyfile
217
+ local command = python_activate_path
218
+ and python_activate_path .. ' && ' .. pycmd
210
219
or pycmd
211
220
os.execute (command )
212
221
0 commit comments