Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ots-doctools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
ots-doctools
Commits
171db0bb
Commit
171db0bb
authored
2 years ago
by
James Vasile
Browse files
Options
Downloads
Patches
Plain Diff
Teach jinja about urls
parent
b20ec96e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jinja/jinjify.py
+4
-0
4 additions, 0 deletions
jinja/jinjify.py
with
4 additions
and
0 deletions
jinja/jinjify.py
+
4
−
0
View file @
171db0bb
...
@@ -86,6 +86,9 @@ class TodoManager():
...
@@ -86,6 +86,9 @@ class TodoManager():
return
True
return
True
return
False
return
False
def
url
(
text
):
return
(
r
"
\otsurl{
"
+
text
.
replace
(
"
/
"
,
r
"
\/
"
)
+
"
}
"
)
def
run
(
text
,
meta
):
def
run
(
text
,
meta
):
"""
Apply jinja templates to TEXT, using metadata from dict META.
"""
Apply jinja templates to TEXT, using metadata from dict META.
Returns rendered text and unchanged META.
"""
Returns rendered text and unchanged META.
"""
...
@@ -120,6 +123,7 @@ def run(text, meta):
...
@@ -120,6 +123,7 @@ def run(text, meta):
tman
.
new_lines
.
append
(
text
.
replace
(
"
\n
"
,
"
"
))
tman
.
new_lines
.
append
(
text
.
replace
(
"
\n
"
,
"
"
))
return
f
'
\\
textbf{{TODO}}:
{
text
}
'
return
f
'
\\
textbf{{TODO}}:
{
text
}
'
template
.
globals
.
update
(
todo
=
todo
)
# register jinja hook for todo func
template
.
globals
.
update
(
todo
=
todo
)
# register jinja hook for todo func
template
.
globals
.
update
(
url
=
url
)
# register jinja hook for todo func
# Render repeatedly until we no longer need to rerender
# Render repeatedly until we no longer need to rerender
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment