diff --git a/.github/workflows/scripts/python/changelog_markdown2lua.py b/.github/workflows/scripts/python/changelog_markdown2lua.py index cd0b2e5f1ca..7e41e5ffa45 100755 --- a/.github/workflows/scripts/python/changelog_markdown2lua.py +++ b/.github/workflows/scripts/python/changelog_markdown2lua.py @@ -6,6 +6,7 @@ """ import mdformat +import re import yaml from argparse import ArgumentParser @@ -71,6 +72,7 @@ def markdown2lua(version: str, content: str) -> str: "wrap": MAX_LINE_LENGTH, }, ) + formatted_md = remove_liquid_tags(formatted_md) escaped_md = escape_special_symbols(formatted_md) lua_description = ",\n".join( @@ -97,6 +99,12 @@ def extract_yaml_front_matter(content: str) -> Tuple[str, str]: return '', content +def remove_liquid_tags(text: str) -> str: + """Removes all Liquid block tags like {% ... %} from the given text.""" + pattern = r"{%.*?%}\s*\n" + return re.sub(pattern, "", text) + + def escape_special_symbols(text: str) -> str: """Escapes special symbols in text for Lua compatibility.""" return text.replace("\\", "\\\\").replace('"', '\\"') diff --git a/docs/_plugins/balance_change.rb b/docs/_plugins/balance_change.rb new file mode 100644 index 00000000000..d7bac3ab7ab --- /dev/null +++ b/docs/_plugins/balance_change.rb @@ -0,0 +1,24 @@ +Jekyll::Hooks.register [:pages, :documents], :post_render do |doc| + + apply = + # Everything in _posts + (doc.respond_to?(:collection) && doc.collection.label == "posts") || + # Generated changelogs + doc.respond_to?(:path) && File.basename(doc.path) == "fafbeta.md" || + doc.respond_to?(:path) && File.basename(doc.path) == "fafdevelop.md" + + next unless apply + + # Use https://regex101.com/ to debug regex. + doc.output.gsub!( + /
  • ([^<]+?)