Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
'c': 'class2',
't': 'Str'
}
],
't': 'MetaInlines'
}
],
't': 'MetaList'
}
},
't': 'MetaMap'
}
}
src = json.loads(json.dumps(Div(
[
'',
[
'class1',
'class2'
],
[
['title', 'theTitle']
]
],
[
{
'c': [
{
'c': 'content',
't': 'Str'
if len(classes) == 1 and classes[0] in SPECIAL_CLASSES:
panel_kind, glyphicon_kind = SPECIAL_CLASSES[classes[0]]
h_level, h_attr, h_inlines = blockquote[0]['c']
# insert an icon as the first sub-item of the header
span = pf.Span(["", ["glyphicon", glyphicon_kind], []], [])
h_inlines.insert(0, span)
# only the header goes into panel-heading
# WARNING: pandoc doesn't preserve header attributes when the
# header is nested under blockquote. This makes it
# impossible to alter header's "class" attribute, for
# example.
header = pf.Header(h_level, h_attr, h_inlines)
panel_header = pf.Div(("", ["panel-heading"], []), [header])
# the rest of the blockquote goes into panel-body
panel_body = pf.Div(("", ["panel-body"], []), blockquote[1:])
# apply Bootstrap panel classes to the div
classes.append("panel")
classes.append(panel_kind)
# a blockquote is just a list of blocks, so it can be
# passed directly to Div, which expects Div(attr, blocks)
return pf.Div((id, classes, kvs), [panel_header, panel_body])
# Chop up the doc
meta = doc['meta'] if PANDOCVERSION >= '1.18' else doc[0]['unMeta']
blocks = doc['blocks'] if PANDOCVERSION >= '1.18' else doc[1:]
# Process the metadata variables
process(meta)
# First pass
replace = PANDOCVERSION >= '1.16'
attach_attrs_image = attach_attrs_factory(Image,
extract_attrs=_extract_attrs,
replace=replace)
detach_attrs_image = detach_attrs_factory(Image)
insert_secnos_img = insert_secnos_factory(Image)
delete_secnos_img = delete_secnos_factory(Image)
insert_secnos_div = insert_secnos_factory(Div)
delete_secnos_div = delete_secnos_factory(Div)
altered = functools.reduce(lambda x, action: walk(x, action, fmt, meta),
[attach_attrs_image,
insert_secnos_img, insert_secnos_div,
process_figures,
delete_secnos_img, delete_secnos_div,
detach_attrs_image], blocks)
# Second pass
process_refs = process_refs_factory(LABEL_PATTERN, targets.keys())
replace_refs = replace_refs_factory(targets, cleveref, False,
plusname if not capitalise \
or plusname_changed else
[name.title() for name in plusname],
starname)
attach_attrs_span = attach_attrs_factory(Span, replace=True)
def codeblocks(key, value, format, meta):
if key == 'CodeBlock':
[[id, classes, kvs], contents] = value
newcontents = [html('<pre>\n' + contents + '</pre>')]
if len(classes) == 0:
if contents.startswith("$"):
classes.append("shell")
else:
classes.append("code")
return Div([id, classes, kvs], newcontents)
if key == 'Header':
if value[0] == 1:
the_title = stringify(value)
value[1][0] = ""
h_level, h_attr, h_inlines = blockquote[0]['c']
# insert an icon as the first sub-item of the header
span = pf.Span(["", ["glyphicon", glyphicon_kind], []], [])
h_inlines.insert(0, span)
# only the header goes into panel-heading
# WARNING: pandoc doesn't preserve header attributes when the
# header is nested under blockquote. This makes it
# impossible to alter header's "class" attribute, for
# example.
header = pf.Header(h_level, h_attr, h_inlines)
panel_header = pf.Div(("", ["panel-heading"], []), [header])
# the rest of the blockquote goes into panel-body
panel_body = pf.Div(("", ["panel-body"], []), blockquote[1:])
# apply Bootstrap panel classes to the div
classes.append("panel")
classes.append(panel_kind)
# a blockquote is just a list of blocks, so it can be
# passed directly to Div, which expects Div(attr, blocks)
return pf.Div((id, classes, kvs), [panel_header, panel_body])
if format in self.formats:
figure = self.figure_styles[format].format(attr=attr,
filename=filename,
alt=fcaption,
fcaption=fcaption,
caption=caption,
star=star).encode('utf-8')
return RawBlock(format, figure)
else:
alt = [pf.Str(fcaption)]
target = (filename, '')
image = pf.Image(alt, target)
figure = pf.Para([image])
return pf.Div(attr.to_pandoc(), [figure])
if len(classes) == 1 and classes[0] in SPECIAL_CLASSES:
panel_kind, glyphicon_kind = SPECIAL_CLASSES[classes[0]]
h_level, h_attr, h_inlines = blockquote[0]['c']
# insert an icon as the first sub-item of the header
span = pf.Span(["", ["glyphicon", glyphicon_kind], []], [])
h_inlines.insert(0, span)
# only the header goes into panel-heading
# WARNING: pandoc doesn't preserve header attributes when the
# header is nested under blockquote. This makes it
# impossible to alter header's "class" attribute, for
# example.
header = pf.Header(h_level, h_attr, h_inlines)
panel_header = pf.Div(("", ["panel-heading"], []), [header])
# the rest of the blockquote goes into panel-body
panel_body = pf.Div(("", ["panel-body"], []), blockquote[1:])
# apply Bootstrap panel classes to the div
classes.append("panel")
classes.append(panel_kind)
# a blockquote is just a list of blocks, so it can be
# passed directly to Div, which expects Div(attr, blocks)
return pf.Div((id, classes, kvs), [panel_header, panel_body])