diff --git a/tiptapy/__init__.py b/tiptapy/__init__.py index 20fffd9..79d2c2d 100644 --- a/tiptapy/__init__.py +++ b/tiptapy/__init__.py @@ -12,7 +12,7 @@ get_audio_player_block, get_doc_block, make_img_src, - extract_parent_tag_attrs, + extract_tag_attrs, ) __version__ = "0.19.0" @@ -27,7 +27,7 @@ def init_env(path, config): ) # https://stackoverflow.com/a/6038550 env.globals["url2mime"] = url2mime - env.globals["extract_parent_tag_attrs"] = extract_parent_tag_attrs + env.globals["extract_tag_attrs"] = extract_tag_attrs env.globals["make_img_src"] = make_img_src env.globals["handle_links"] = build_link_handler(config) env.globals["get_audio_player_block"] = get_audio_player_block diff --git a/tiptapy/macros.py b/tiptapy/macros.py index 713d78b..0a513b0 100644 --- a/tiptapy/macros.py +++ b/tiptapy/macros.py @@ -3,7 +3,7 @@ from urllib.parse import urlparse -def extract_parent_tag_attrs(node): +def extract_tag_attrs(node): allowed_attributes = ("id",) attrs = node.get("attrs") return ( diff --git a/tiptapy/templates/codeBlock.html b/tiptapy/templates/codeBlock.html index cab56e3..8313a53 100644 --- a/tiptapy/templates/codeBlock.html +++ b/tiptapy/templates/codeBlock.html @@ -2,7 +2,7 @@ {%- if node.content -%} {%- set text = node.content[0].text -%} {%- if text -%} -
+    
       {%- if language -%}
         {{text}}
       {%- else -%}
diff --git a/tiptapy/templates/code_block.html b/tiptapy/templates/code_block.html
index cab56e3..8313a53 100644
--- a/tiptapy/templates/code_block.html
+++ b/tiptapy/templates/code_block.html
@@ -2,7 +2,7 @@
 {%- if node.content -%}
   {%- set text = node.content[0].text -%}
   {%- if text -%}
-    
+    
       {%- if language -%}
         {{text}}
       {%- else -%}
diff --git a/tiptapy/templates/embed.html b/tiptapy/templates/embed.html
index ee4437a..fe0d6f4 100644
--- a/tiptapy/templates/embed.html
+++ b/tiptapy/templates/embed.html
@@ -1,7 +1,7 @@
 {%- set html = node.attrs.html -%}
 
 {%- set provider_name = node.attrs.provider|default('link')|lower -%}
-
+
{%- for item in node.content -%} {%- with template=item.type + '.html', node=item -%} {%- include template -%} diff --git a/tiptapy/templates/extras/audio.html b/tiptapy/templates/extras/audio.html index e5ccbf2..433f9c6 100644 --- a/tiptapy/templates/extras/audio.html +++ b/tiptapy/templates/extras/audio.html @@ -3,7 +3,7 @@ {%- set audio_player_block = get_audio_player_block() -%} {%- set src = node.attrs.src|trim -%} -
+
{%- if caption -%}
{{audio_player_block}}
{{caption}}
{%- else -%} diff --git a/tiptapy/templates/extras/document.html b/tiptapy/templates/extras/document.html index 495f440..ef2344e 100644 --- a/tiptapy/templates/extras/document.html +++ b/tiptapy/templates/extras/document.html @@ -5,7 +5,7 @@ {%- set ext = node.attrs.format|trim -%} {%- if src and size and fname and ext -%} {%- set doc_block = get_doc_block(ext, fname, size, src) -%} -
+
{%- if caption -%} {{doc_block}}
{{caption}}
{%- else -%} diff --git a/tiptapy/templates/heading.html b/tiptapy/templates/heading.html index e07223b..d700839 100644 --- a/tiptapy/templates/heading.html +++ b/tiptapy/templates/heading.html @@ -1,4 +1,4 @@ - + {%- for item in node.content -%} {%- with template=item.type + '.html', node=item -%} {%- include template -%} diff --git a/tiptapy/templates/horizontalRule.html b/tiptapy/templates/horizontalRule.html index cd2fffa..e9e397a 100644 --- a/tiptapy/templates/horizontalRule.html +++ b/tiptapy/templates/horizontalRule.html @@ -1 +1 @@ - + diff --git a/tiptapy/templates/horizontal_rule.html b/tiptapy/templates/horizontal_rule.html index cd2fffa..e9e397a 100644 --- a/tiptapy/templates/horizontal_rule.html +++ b/tiptapy/templates/horizontal_rule.html @@ -1 +1 @@ - + diff --git a/tiptapy/templates/image.html b/tiptapy/templates/image.html index b8c2793..1e210b0 100644 --- a/tiptapy/templates/image.html +++ b/tiptapy/templates/image.html @@ -9,7 +9,7 @@ {%- set fallback_type = url2mime(fallback_url) -%} {%- if image_url or fallback_url -%} - <{{ make_img_src(node.attrs) }}/> + <{{ make_img_src(node.attrs) }}/> {%- if caption -%}
{{ caption }}
{%- endif -%} diff --git a/tiptapy/templates/paragraph.html b/tiptapy/templates/paragraph.html index d07a5e8..f3e31da 100644 --- a/tiptapy/templates/paragraph.html +++ b/tiptapy/templates/paragraph.html @@ -1,5 +1,5 @@ {%- if node.content -%} - + {%- for item in node.content -%} {%- with template=item.type + '.html', node=item -%} {%- include template -%}