comparison libervia/backend/plugins/plugin_syntax_wiki_dotclear.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents 4b842c1fb686
children
comparison
equal deleted inserted replaced
4269:64a85ce8be70 4270:0d7bb4df2343
43 NOTE_TPL = "[{}]" # Note template 43 NOTE_TPL = "[{}]" # Note template
44 NOTE_A_REV_TPL = "rev_note_{}" 44 NOTE_A_REV_TPL = "rev_note_{}"
45 NOTE_A_TPL = "note_{}" 45 NOTE_A_TPL = "note_{}"
46 ESCAPE_CHARS_BASE = r"(?P<escape_char>[][{}%|\\/*#@{{}}~$-])" 46 ESCAPE_CHARS_BASE = r"(?P<escape_char>[][{}%|\\/*#@{{}}~$-])"
47 ESCAPE_CHARS_EXTRA = ( 47 ESCAPE_CHARS_EXTRA = (
48 r"!?_+'()" 48 r"!?_+'()" # These chars are not escaped in XHTML => dc_wiki conversion,
49 ) # These chars are not escaped in XHTML => dc_wiki conversion, 49 )
50 # but are used in the other direction 50 # but are used in the other direction
51 ESCAPE_CHARS = ESCAPE_CHARS_BASE.format("") 51 ESCAPE_CHARS = ESCAPE_CHARS_BASE.format("")
52 FLAG_UL = "ul" # must be the name of the element 52 FLAG_UL = "ul" # must be the name of the element
53 FLAG_OL = "ol" 53 FLAG_OL = "ol"
54 ELT_WITH_STYLE = ("img", "div") # elements where a style attribute is expected 54 ELT_WITH_STYLE = ("img", "div") # elements where a style attribute is expected
225 if data in ("l", "g"): 225 if data in ("l", "g"):
226 img_elt["style"] = "display:block; float:left; margin:0 1em 1em 0" 226 img_elt["style"] = "display:block; float:left; margin:0 1em 1em 0"
227 elif data in ("r", "d"): 227 elif data in ("r", "d"):
228 img_elt["style"] = "display:block; float:right; margin:0 0 1em 1em" 228 img_elt["style"] = "display:block; float:right; margin:0 0 1em 1em"
229 elif data == "c": 229 elif data == "c":
230 img_elt[ 230 img_elt["style"] = (
231 "style" 231 "display:block; margin-left:auto; margin-right:auto"
232 ] = "display:block; margin-left:auto; margin-right:auto" 232 )
233 else: 233 else:
234 log.warning("bad position argument for image, ignoring it") 234 log.warning("bad position argument for image, ignoring it")
235 235
236 def parser_anchor(self, string, parent): 236 def parser_anchor(self, string, parent):
237 a_elt = parent.addElement("a") 237 a_elt = parent.addElement("a")