Skip to content
Permalink
Browse files
update asfgenid plugin
  • Loading branch information
dave2wave committed Jun 6, 2021
1 parent 0142271 commit c5c9f8fdb3a00890cc81726965f4c05db236da5b
Showing 2 changed files with 15 additions and 10 deletions.
@@ -125,6 +125,7 @@

# Configure the asfgenid plugin
ASF_GENID = {
'unsafe_tags': True,
'metadata': False,
'elements': False,
'headings': True,
@@ -26,6 +26,7 @@
'''

ASF_GENID = {
'unsafe_tags': 'True', # fix script, style, and iframe html that gfm filters as unsafe
'metadata': True, # {{ metadata }} inclusion of data in the html.
'elements': True, # {#id} and {.class} annotations.
'headings': True, # add slugified id to headings missing id. Can be overridden by page metadata.
@@ -287,13 +288,25 @@ def generate_id(content):
if isinstance(content, pelican.contents.Static):
return

# get plugin settings
asf_genid = content.settings['ASF_GENID']
# asf_headings setting may be overridden
asf_headings = content.metadata.get('asf_headings', str(asf_genid['headings']))

# show active plugins
if asf_genid['debug']:
print('asfgenid:\nshow plugins in case one is processing before this one')
for name in content.settings['PLUGINS']:
print(f'plugin: {name}')

# track the id tags
ids = set()
# track permalinks
permalinks = set()

# step 1 - fixup html that cmark marks unsafe - move to later?
fixup_content(content)
if asf_genid['unsafe_tags']:
fixup_content(content)

# step 2 - prepare for genid processes
# parse html content into BeautifulSoup4
@@ -306,15 +319,6 @@ def generate_id(content):
print(f'{content.relative_source_path} - {title}')
# enhance metadata if done by asfreader
add_data(content)
# get plugin settings
asf_genid = content.settings['ASF_GENID']
# asf_headings setting may be overridden
asf_headings = content.metadata.get('asf_headings', str(asf_genid['headings']))
# show active plugins
if asf_genid['debug']:
print('asfgenid:\nshow plugins in case one is processing before this one')
for name in content.settings['PLUGINS']:
print(f'plugin: {name}')

# step 3 - metadata expansion
if asf_genid['metadata']:

0 comments on commit c5c9f8f

Please sign in to comment.