This is an automated email from the ASF dual-hosted git repository. wave pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/gora-site.git
The following commit(s) were added to refs/heads/main by this push: new 27c00a5 update asfgenid plugin 27c00a5 is described below commit 27c00a5f3581720c50e11480faac97ff1066676b Author: Dave Fisher <d...@davefisher.tech> AuthorDate: Sun Jun 6 12:24:05 2021 -0700 update asfgenid plugin --- pelicanconf.py | 1 + theme/plugins/asfgenid.py | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pelicanconf.py b/pelicanconf.py index c297cb0..df81e7b 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -122,6 +122,7 @@ PLUGINS = ['asfgenid', 'pelican-gfm'] # Configure the asfgenid plugin ASF_GENID = { + 'unsafe_tags': True, 'metadata': False, 'elements': False, 'headings': True, diff --git a/theme/plugins/asfgenid.py b/theme/plugins/asfgenid.py index f0ff875..eddcb19 100644 --- a/theme/plugins/asfgenid.py +++ b/theme/plugins/asfgenid.py @@ -26,6 +26,7 @@ Which is BSD licensed, but is very much rewritten. ''' 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']: