Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Florian Rhiem
doc-utils
Commits
12662d50
Commit
12662d50
authored
Aug 28, 2018
by
Ingo Meyer
Browse files
Merge branch 'develop'
parents
617af609
0bbcc5e2
Changes
8
Hide whitespace changes
Inline
Side-by-side
docutils_extended/_version.py
View file @
12662d50
__version_info__
=
(
0
,
2
,
0
)
__version_info__
=
(
0
,
2
,
1
)
__version__
=
'.'
.
join
(
map
(
str
,
__version_info__
))
docutils_extended/directives/__init__.py
View file @
12662d50
from
.code_directive
import
CodeBlock
from
.embedded_image_directive
import
EmbeddedImage
from
.jupyter_outbox_directive
import
JupyterOutbox
from
.tikz_directive
import
Tikz
,
TikzFigure
from
.output_mode
import
get_output_mode
,
set_output_mode
__all__
=
(
"CodeBlock"
,
"EmbeddedImage"
,
"Tikz"
,
"TikzFigure"
,
"get_output_mode"
,
"set_output_mode"
)
__all__
=
(
"CodeBlock"
,
"EmbeddedImage"
,
"JupyterOutbox"
,
"Tikz"
,
"TikzFigure"
,
"get_output_mode"
,
"set_output_mode"
)
docutils_extended/directives/embedded_image_directive.py
View file @
12662d50
...
...
@@ -19,6 +19,7 @@ from .output_mode import get_output_mode
TMP_IMAGE_FILENAME
=
"_downloaded_image{i:04d}.{ext}"
TMP_QPDF_OUT_FILENAME
=
"_qpdf_out.pdf"
OUT_PDF_FILENAME
=
"_converted_image{i:04d}.pdf"
...
...
@@ -65,6 +66,14 @@ def load_and_convert_image(image_filepath_or_url, convert_to_base64=True, conver
stdout
=
devnull
,
stderr
=
devnull
,
)
try
:
subprocess
.
check_call
(
[
"qpdf"
,
out_pdf_filename
,
TMP_QPDF_OUT_FILENAME
],
stdout
=
devnull
,
stderr
=
devnull
)
os
.
remove
(
out_pdf_filename
)
shutil
.
move
(
TMP_QPDF_OUT_FILENAME
,
out_pdf_filename
)
except
subprocess
.
CalledProcessError
:
pass
image_filepath
=
out_pdf_filename
image_is_svg
=
False
image_is_pdf
=
True
...
...
docutils_extended/directives/jupyter_outbox_directive.py
0 → 100644
View file @
12662d50
from
docutils
import
nodes
from
docutils.parsers.rst
import
Directive
class
JupyterOutbox
(
Directive
):
required_arguments
=
0
optional_arguments
=
0
final_argument_whitespace
=
False
option_spec
=
{}
has_content
=
True
def
run
(
self
):
content
=
u
"
\n
"
.
join
(
self
.
content
)
latex
=
u
"
\\
begin{{minted}}[bgcolor=white,breakanywhere=true,breaklines=true,linenos=false]{{text}}
\n
{}
\n\\
end{{minted}}"
.
format
(
content
)
return
[
nodes
.
raw
(
""
,
latex
,
format
=
"latex"
)]
docutils_extended/writers/rst2html_extended.py
View file @
12662d50
...
...
@@ -18,6 +18,7 @@ except:
from
docutils.core
import
publish_cmdline
,
default_description
from
docutils.parsers.rst
import
directives
from
docutils.parsers.rst.directives.body
import
ParsedLiteral
from
..directives
import
EmbeddedImage
,
Tikz
,
TikzFigure
,
set_output_mode
...
...
@@ -27,6 +28,7 @@ description = "Generates (X)HTML documents from standalone reStructuredText " "s
def
main
():
set_output_mode
(
"html"
)
directives
.
register_directive
(
"embedded-image"
,
EmbeddedImage
)
directives
.
register_directive
(
"jupyter-outbox"
,
ParsedLiteral
)
directives
.
register_directive
(
"tikz"
,
Tikz
)
directives
.
register_directive
(
"tikz-figure"
,
TikzFigure
)
publish_cmdline
(
writer_name
=
"html"
,
description
=
description
)
...
...
docutils_extended/writers/rst2latex_extended.py
View file @
12662d50
...
...
@@ -19,7 +19,7 @@ except:
from
docutils.core
import
publish_cmdline
from
docutils.parsers.rst
import
directives
from
..directives
import
CodeBlock
,
EmbeddedImage
,
Tikz
,
TikzFigure
,
set_output_mode
from
..directives
import
CodeBlock
,
EmbeddedImage
,
JupyterOutbox
,
Tikz
,
TikzFigure
,
set_output_mode
description
=
(
...
...
@@ -37,6 +37,7 @@ def main():
for
directive_name
in
(
"code"
,
"code-block"
):
directives
.
register_directive
(
directive_name
,
CodeBlock
)
directives
.
register_directive
(
"embedded-image"
,
EmbeddedImage
)
directives
.
register_directive
(
"jupyter-outbox"
,
JupyterOutbox
)
directives
.
register_directive
(
"tikz"
,
Tikz
)
directives
.
register_directive
(
"tikz-figure"
,
TikzFigure
)
publish_cmdline
(
writer_name
=
"latex"
,
description
=
description
)
...
...
styles/rst2latex_fzj.sty
View file @
12662d50
...
...
@@ -78,3 +78,9 @@
\makeatother
\end{titlepage}
}
\IfFileExists
{
custom.sty
}{
%
\usepackage
{
custom
}
}
}{
%
}
styles/rst2xetex_fzj.sty
View file @
12662d50
...
...
@@ -97,3 +97,8 @@
\makeatother
\end{titlepage}
}
\IfFileExists
{
custom.sty
}{
%
\usepackage
{
custom
}
}{
%
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment