You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by wa...@apache.org on 2021/06/06 19:25:43 UTC

[olingo-site] branch main updated: update asfgenid plugin

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/olingo-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 843baa8  update asfgenid plugin
843baa8 is described below

commit 843baa85995cd136a5476e4d152149d881146bea
Author: Dave Fisher <da...@davefisher.tech>
AuthorDate: Sun Jun 6 12:22:49 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 4a833dd..72a3398 100644
--- a/pelicanconf.py
+++ b/pelicanconf.py
@@ -122,6 +122,7 @@ PLUGINS = ['asfgenid', 'pelican-gfm']
 
 # Configure the asfgenid plugin
 ASF_GENID = {
+    'unsafe_tags': False,
     'metadata': False,
     'elements': False,
     'headings': True,
diff --git a/theme/plugins/asfgenid.py b/theme/plugins/asfgenid.py
index c00869a..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']: