Skip to content

Commit 1a1a453

Browse files
committed
pelican-import: Support the SyntaxHighlighter plugin.
This was the default for about 10 years.
1 parent 3c69dc6 commit 1a1a453

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

pelican/tools/pelican_import.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,12 @@ def fields2pelican(
10841084
content = content.replace("\\\n ", " \n")
10851085
content = content.replace("\\\n", " \n")
10861086

1087-
if wp_attach and links:
1088-
content = update_links_to_attached_files(content, links)
1087+
# Convert SyntaxHighlighter format code blocks
1088+
brush_pattern = re.compile(r'^`{3}\s*brush:\s*([a-zA-Z0-9_+\-#]+)', re.MULTILINE)
1089+
content = brush_pattern.sub(r'```\1', content)
1090+
1091+
if wp_attach and links:
1092+
content = update_links_to_attached_files(content, links)
10891093

10901094
with open(out_filename, "w", encoding="utf-8") as fs:
10911095
fs.write(header + content)
@@ -1265,5 +1269,8 @@ def main():
12651269
filter_author=args.author,
12661270
wp_custpost=args.wp_custpost or False,
12671271
wp_attach=args.wp_attach or False,
1268-
attachments=attachments or None,
1272+
attachments=attachments or None
12691273
)
1274+
1275+
if __name__ == "__main__":
1276+
main()

0 commit comments

Comments
 (0)