Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doc-utils
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Ferrari
doc-utils
Commits
5b783b7d
Commit
5b783b7d
authored
May 03, 2019
by
Tobias ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ae483706
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
docutils_extended/directives/__init__.py
docutils_extended/directives/__init__.py
+2
-1
docutils_extended/directives/rst_checkboxes_directive.py
docutils_extended/directives/rst_checkboxes_directive.py
+6
-5
docutils_extended/writers/rst2latex_extended.py
docutils_extended/writers/rst2latex_extended.py
+3
-1
No files found.
docutils_extended/directives/__init__.py
View file @
5b783b7d
...
@@ -4,7 +4,8 @@ from .jupyter_outbox_directive import JupyterOutbox
...
@@ -4,7 +4,8 @@ from .jupyter_outbox_directive import JupyterOutbox
from
.tikz_directive
import
Tikz
,
TikzFigure
from
.tikz_directive
import
Tikz
,
TikzFigure
from
.output_mode
import
get_output_mode
,
set_output_mode
from
.output_mode
import
get_output_mode
,
set_output_mode
from
.rst_checkboxes_directive
import
RSTCheckBox
from
.rst_checkboxes_directive
import
RSTCheckBox
from
.rst_tags_directive
import
RSTTag
__all__
=
(
"CodeBlock"
,
"EmbeddedImage"
,
"EmbeddedFigure"
,
"JupyterOutbox"
,
"Tikz"
,
"TikzFigure"
,
"get_output_mode"
,
__all__
=
(
"CodeBlock"
,
"EmbeddedImage"
,
"EmbeddedFigure"
,
"JupyterOutbox"
,
"Tikz"
,
"TikzFigure"
,
"get_output_mode"
,
"set_output_mode"
,
"RSTCheckBox"
)
"set_output_mode"
,
"RSTCheckBox"
,
"RSTTag"
)
docutils_extended/directives/rst_checkboxes_directive.py
View file @
5b783b7d
from
__future__
import
unicode_literals
from
docutils
import
nodes
from
docutils
import
nodes
from
docutils.parsers.rst
import
Directive
from
docutils.parsers.rst
import
Directive
from
.output_mode
import
get_output_mode
from
.output_mode
import
get_output_mode
class
RSTCheckBox
(
Directive
):
class
RSTCheckBox
(
Directive
):
required_arguments
=
0
required_arguments
=
0
optional_arguments
=
0
optional_arguments
=
0
final_argument_whitespace
=
False
final_argument_whitespace
=
False
option_spec
=
{}
option_spec
=
{}
has_content
=
True
has_content
=
True
def
run
(
self
):
def
run
(
self
):
content
=
u
"
\n
"
.
join
(
self
.
content
)
content
=
u
"
\n
"
.
join
(
self
.
content
)
lines
=
content
.
split
(
"
\n
"
)
lines
=
content
.
split
(
"
\n
"
)
...
@@ -32,11 +33,11 @@ class RSTCheckBox(Directive):
...
@@ -32,11 +33,11 @@ class RSTCheckBox(Directive):
html
+=
"</ul>"
html
+=
"</ul>"
return
[
nodes
.
raw
(
""
,
html
,
format
=
"html"
)]
return
[
nodes
.
raw
(
""
,
html
,
format
=
"html"
)]
else
:
else
:
latex
=
"
\\
begin{
todolist
}"
latex
=
"
\\
begin{
itemize
}"
for
line
in
lines
:
for
line
in
lines
:
if
"- [ ]"
in
line
:
if
"- [ ]"
in
line
:
latex
+=
"
\\
item"
+
line
[
6
:]
+
"
\n
"
latex
+=
"
\\
item
[
\u2610
]
"
+
line
[
6
:]
+
"
\n
"
elif
"- [x]"
in
line
:
elif
"- [x]"
in
line
:
latex
+=
"
\\
item[
\
\
checked
]"
+
line
[
6
:]
+
"
\n
"
latex
+=
"
\\
item[
\
u2611
]"
+
line
[
6
:]
+
"
\n
"
latex
+=
"
\\
end{
todolist
}"
latex
+=
"
\\
end{
itemize
}"
return
[
nodes
.
raw
(
""
,
latex
,
format
=
"latex"
)]
return
[
nodes
.
raw
(
""
,
latex
,
format
=
"latex"
)]
docutils_extended/writers/rst2latex_extended.py
View file @
5b783b7d
...
@@ -19,7 +19,7 @@ except:
...
@@ -19,7 +19,7 @@ except:
from
docutils.core
import
publish_cmdline
from
docutils.core
import
publish_cmdline
from
docutils.parsers.rst
import
directives
from
docutils.parsers.rst
import
directives
from
..directives
import
CodeBlock
,
EmbeddedImage
,
EmbeddedFigure
,
JupyterOutbox
,
Tikz
,
TikzFigure
,
set_output_mode
from
..directives
import
CodeBlock
,
EmbeddedImage
,
EmbeddedFigure
,
JupyterOutbox
,
Tikz
,
TikzFigure
,
set_output_mode
,
RSTCheckBox
,
RSTTag
description
=
(
description
=
(
...
@@ -41,6 +41,8 @@ def main():
...
@@ -41,6 +41,8 @@ def main():
directives
.
register_directive
(
"jupyter-outbox"
,
JupyterOutbox
)
directives
.
register_directive
(
"jupyter-outbox"
,
JupyterOutbox
)
directives
.
register_directive
(
"tikz"
,
Tikz
)
directives
.
register_directive
(
"tikz"
,
Tikz
)
directives
.
register_directive
(
"tikz-figure"
,
TikzFigure
)
directives
.
register_directive
(
"tikz-figure"
,
TikzFigure
)
directives
.
register_directive
(
"checkboxes"
,
RSTCheckBox
)
directives
.
register_directive
(
"rsttag"
,
RSTTag
)
publish_cmdline
(
writer_name
=
"latex"
,
description
=
description
)
publish_cmdline
(
writer_name
=
"latex"
,
description
=
description
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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