25 lines
800 B
Python
25 lines
800 B
Python
from django.conf import settings
|
|
from wagtail_wordpress_import.block_builder_defaults import (
|
|
document_linker,
|
|
image_linker,
|
|
import_string,
|
|
)
|
|
|
|
|
|
def build_richtext_block_content(html, blocks):
|
|
"""
|
|
image_linker is called to link up and retrive the remote image
|
|
document_linker is called to link up and retrive the remote documents
|
|
filters are called to replace inline shortcodes
|
|
"""
|
|
html = image_linker(html)
|
|
html = document_linker(html)
|
|
for inline_shortcode_handler in getattr(
|
|
settings, "WAGTAIL_WORDPRESS_IMPORTER_INLINE_SHORTCODE_HANDLERS", []
|
|
):
|
|
function = import_string(inline_shortcode_handler).construct_html_tag
|
|
html = function(html)
|
|
blocks.append({"type": "paragraph", "value": html})
|
|
html = ""
|
|
return html
|