proper replace images

This commit is contained in:
Guilhem Fauré 2023-05-23 10:33:04 +02:00
parent 0835bec611
commit 94b593da93

View File

@ -44,10 +44,6 @@ spip_to_markdown = (
compile(r"\[ *(.*?) *-> *(.*?) *\]", S | I), compile(r"\[ *(.*?) *-> *(.*?) *\]", S | I),
r"[\1](\2)", r"[\1](\2)",
), ),
( # image
compile(r"<(?:img|image)(.*?)(\|.*?)*>", S | I),
r"![image](\1)",
),
( # document anchor ( # document anchor
compile(r"<(?:doc|emb)(.*?)(\|.*?)*>", S | I), compile(r"<(?:doc|emb)(.*?)(\|.*?)*>", S | I),
r"[document](\1)", r"[document](\1)",
@ -114,6 +110,9 @@ spip_to_markdown = (
), ),
) )
## Match SPIP images
spip_image = compile(r"<(?:img|image)(.*?)(\|.*?)*>", S | I)
spip_to_text = ( spip_to_text = (
( # strong ( # strong
compile(r"\{\{ *(.*?) *\}\}", S | I), compile(r"\{\{ *(.*?) *\}\}", S | I),
@ -159,8 +158,8 @@ spip_to_text = (
), ),
) )
# Broken ISO encoding to proper UTF-8
iso_to_utf = ( iso_to_utf = (
# Broken encoding
( # Fix UTF-8 appostrophe that was interpreted as ISO 8859-1 ( # Fix UTF-8 appostrophe that was interpreted as ISO 8859-1
"’", "’",
r"", r"",
@ -272,7 +271,7 @@ iso_to_utf = (
), ),
) )
## WARNING unknown broken encoding # WARNING unknown broken encoding
unknown_iso = ( unknown_iso = (
r"
", # unknown 
 r"
", # unknown 

r"∆", # unknown â^† r"∆", # unknown â^†