MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / strip_shortcodes

Function strip_shortcodes

scripts/website/blog_text.py:66–73  ·  view source on GitHub ↗

Strip Hugo shortcodes so surrounding prose stays intact. Code-bearing paired shortcodes (mermaid/highlight/…) are removed body and all; every other shortcode tag is replaced with a space.

(text)

Source from the content-addressed store, hash-verified

64
65
66def strip_shortcodes(text):
67 """Strip Hugo shortcodes so surrounding prose stays intact.
68
69 Code-bearing paired shortcodes (mermaid/highlight/…) are removed body and
70 all; every other shortcode tag is replaced with a space.
71 """
72 text = _PAIRED_CODE_RE.sub("\n\n", text)
73 return _SHORTCODE_RE.sub(" ", text)
74
75
76def read_post(path):

Callers 2

iter_paragraphsFunction · 0.90
body_to_htmlFunction · 0.85

Calls 1

subMethod · 0.45

Tested by

no test coverage detected