Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lesson Template
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
prace-lessons
Lesson Template
Commits
e0771954
Commit
e0771954
authored
10 years ago
by
Greg Wilson
Browse files
Options
Downloads
Plain Diff
Merge pull request #123 from r-gaia-cs/fix-tools-for-add-classes
Change filters since classes must be explicit
parents
e2292e54
846339af
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/filters/blockquote2div.py
+1
-13
1 addition, 13 deletions
tools/filters/blockquote2div.py
with
1 addition
and
13 deletions
tools/filters/blockquote2div.py
+
1
−
13
View file @
e0771954
...
@@ -51,15 +51,6 @@ import pandocfilters as pf
...
@@ -51,15 +51,6 @@ import pandocfilters as pf
# trigger the blockquote to be converted to a div.
# trigger the blockquote to be converted to a div.
SPECIAL_CLASSES
=
[
'
callout
'
,
'
challenge
'
,
'
prereq
'
,
'
objectives
'
]
SPECIAL_CLASSES
=
[
'
callout
'
,
'
challenge
'
,
'
prereq
'
,
'
objectives
'
]
# These are titles of blockquotes that will cause the blockquote to
# be converted into a div. They are 'title': 'class' pairs, where the
# 'title' will create a blockquote with the corresponding 'class'.
SPECIAL_TITLES
=
{
'
prerequisites
'
:
'
prereq
'
,
'
learning objectives
'
:
'
objectives
'
,
'
objectives
'
:
'
objectives
'
,
'
challenge
'
:
'
challenge
'
,
'
callout
'
:
'
callout
'
}
def
find_header
(
blockquote
):
def
find_header
(
blockquote
):
"""
Find attributes in a blockquote if they are defined on a
"""
Find attributes in a blockquote if they are defined on a
...
@@ -105,11 +96,8 @@ def blockquote2div(key, value, format, meta):
...
@@ -105,11 +96,8 @@ def blockquote2div(key, value, format, meta):
id
,
classes
,
kvs
=
attr
id
,
classes
,
kvs
=
attr
ltitle
=
pf
.
stringify
(
inlines
).
lower
()
ltitle
=
pf
.
stringify
(
inlines
).
lower
()
if
ltitle
in
SPECIAL_TITLES
:
classes
.
append
(
SPECIAL_TITLES
[
ltitle
])
return
pf
.
Div
(
attr
,
blockquote
)
el
if
len
(
classes
)
==
1
and
classes
[
0
]
in
SPECIAL_CLASSES
:
if
len
(
classes
)
==
1
and
classes
[
0
]
in
SPECIAL_CLASSES
:
remove_attributes
(
blockquote
)
remove_attributes
(
blockquote
)
# a blockquote is just a list of blocks, so it can be
# a blockquote is just a list of blocks, so it can be
# passed directly to Div, which expects Div(attr, blocks)
# passed directly to Div, which expects Div(attr, blocks)
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment