61a0abc2a6f88da3162796e026d2f68ce2b7f1d7
[lhc/web/www.git] / www / plugins-dist / textwheel / wheels / spip / spip.yaml
1 --- # Syntaxe des raccourcis SPIP, version 0.0.1
2 #
3 # Si on nomme une regle, elle devient surchargeable
4
5 math:
6 if_str: "<math>"
7 type: all
8 is_callback: y
9 replace: "replace_math"
10 priority: -50 # en tout premier : le contenu des formules math ne doit pas etre modifie
11
12 traiter_retours_chariots_1:
13 # Harmonise les retours chariots et mange les paragraphes html
14 if_chars: "\r"
15 match: ",\r\n?,S"
16 replace: "\n"
17 priority: -40 # avant tout
18
19 init-trim:
20 # trim
21 type: all
22 is_callback: y
23 replace: trim
24 priority: -40 # avant tout
25
26 init-saut:
27 type: all
28 replace: "\n$0"
29 priority: -40
30
31 lignes-vides:
32 match: ",^[ \t]+$,m"
33 replace: ""
34 priority: -35 # avant les tableaux
35
36 tableaux:
37 type: all
38 # included subwheel with relative filepath
39 replace: spip/spip-tableaux.yaml
40 is_wheel: Y
41 if_str: "\n|"
42 priority: -30 # avant les raccourcis
43
44 listes:
45 if_str: "\n-"
46 is_wheel: Y
47 type: all
48 replace: spip/spip-listes.yaml
49 priority: -20 # avant !paragraphes
50
51 echappe-tags:
52 # voir restaure-tags plus bas
53 match: ",</?[a-z!][^<>]*?[{}_-][^<>]*>,imsS"
54 if_chars: "{}_-"
55 priority: -20 # avant !paragraphes
56 is_wheel: Y
57 replace:
58 echappe-tags-sub:
59 if_match: "/[{}]|\n[_-]|--/"
60 match: ['{', '}', '_', '-']
61 replace: ["\x1\x1", "\x1\x2", "\x1\x3", "\x1\x4"]
62 type: str
63
64 echappe-raccourcis:
65 if_str: '\'
66 priority: -20 # avant !paragraphes
67 match: ['\{', '\}', '\_', '\-', '\[', '\]', '\|', '\<', '\>', '\\', '\*', '\#', '\+', '\~']
68 replace: ["\x1\x1", "\x1\x2", "\x1\x3", "\x1\x4", "\x1\x5", "\x1\x6", "\x1\x7", "\x1\x8", "\x1\x9", "\x1\x10", "\x1\x11", "\x1\x12", "\x1\x13", "\x1\x14"]
69 type: str
70
71 ligne-horizontale:
72 match: "/\n(----+|____+)/S"
73 replace: "\n\n\n<hr class=\"spip\" />\n\n\n"
74 if_chars: "\n"
75 priority: -20 # avant !paragraphes
76
77 alinea:
78 match: "/\n-- */"
79 replace: "\n<br />&mdash;&nbsp;"
80 if_str: "\n--"
81 priority: -20 # avant !paragraphes
82
83 puce:
84 match: "/\n- */S"
85 replace: replace_puce
86 if_str: "\n-"
87 is_callback: Y
88 priority: -20 # avant !paragraphes
89
90 br-inutile:
91 match: "/(^|^\n|\n\n)_ +/S"
92 replace: "$1"
93 if_str: "_ "
94 priority: -20 # avant !paragraphes
95
96 br:
97 match: "/\n_ +/S"
98 replace: "<br class='manualbr' />"
99 if_str: "\n_"
100 priority: -20 # avant !paragraphes
101
102 abbr:
103 # raccourcis en [ABBR|abbreviation]
104 if_chars: "["
105 if_chars: "|"
106 match: "/\[([^\|\[\]>]+)\|([^\|\]\{>]+)(?:\{([a-z]+)\})?\]/S"
107 is_callback: Y
108 replace: inserer_abbr
109
110 intertitres-compliques:
111 # raccourcis imbriques en {{{{..}}}}
112 # intertitres
113 match: ['/(^|[^{])[{][{][{]/S', '/[}][}][}]($|[^}])/S']
114 replace: ["$1\n\n\n<h3 class=\"spip\">", "</h3>\n\n\n$1"]
115 if_str: '}}}}'
116
117 intertitres:
118 # raccourcis en {{{..}}}
119 # intertitres
120 match: ['{{{', '}}}']
121 replace: ["\n\n\n<h3 class=\"spip\">", "</h3>\n\n\n"]
122 if_str: '{{{'
123 type: str
124
125 gras-vide:
126 # faux raccourcis vides en {{}}
127 # echappes
128 match: '{{}}'
129 replace: "\x1\x1\x1\x1\x1\x2\x1\x2"
130 type: str
131 if_str: '{{'
132
133 gras:
134 # raccourcis en {{..}}
135 # strong
136 match: ['{{', '}}']
137 replace: ['<strong>', '</strong>']
138 type: str
139 if_str: '{{'
140
141 italiques-vide:
142 # faux raccourcis vides en {}
143 # echappes
144 match: '{}'
145 replace: "\x1\x1\x1\x2"
146 type: str
147 if_str: '{'
148
149 italiques:
150 # raccourcis en {..}
151 # i
152 match: ['{', '}']
153 replace: ['<i>', '</i>']
154 type: str
155 if_str: '{'
156
157 paragraphes:
158 # paragraphes
159 # lignes vides consecutives, br imbriques dans des p
160 # mais attention pas les br trop riches (ex: br style=clear:both)
161 match: ["/ *\n(?: *\n)+(?:<br ?\/?>)*/S", '/(?:<br\b[^>]*>){2,}\s*/S', "/(<p\b[^>]*>)\n*(?:<br ?\/?>\n*)+/S"]
162 replace: ['<p>', '<p>', '$1']
163 priority: 0
164
165 quote:
166 # raccourci <quote>
167 match: ['<quote>', '</quote>']
168 replace: ['<blockquote class="spip"><p>', '</blockquote>']
169 if_str: '<quote>'
170 type: str
171
172 intro:
173 # suppr raccourci <intro>
174 # + suppression de <intro>
175 match: ['<intro>', '</intro>']
176 replace: ['', '']
177 if_str: '<intro>'
178 type: str
179
180 br-restant:
181 # eliminer les br restant en debut de texte
182 match: "@^\n<br />@S"
183 replace: ''
184 if_str: "\n<br"
185 priority: -20 # avant !paragraphes
186
187
188 poesie:
189 # poesie|poetry
190 # utilise une callback
191 match: ",<poe(sie|try)>(.*)</poe(sie|try)>,UimsS"
192 replace: spip/spip-poesie.yaml
193 pick_match: 2
194 is_wheel: Y
195 if_str: '<poe'
196 priority: -40
197
198 restaure-tags:
199 # voir echappe-tags ci-dessus
200 if_chars: "\x1"
201 match: ["\x1\x1", "\x1\x2", "\x1\x3", "\x1\x4", "\x1\x5", "\x1\x6", "\x1\x7", "\x1\x8", "\x1\x9", "\x1\x10", "\x1\x11", "\x1\x12", "\x1\x13", "\x1\x14"]
202 replace: ['{', '}', '_', '-', '[', ']', '|', '<', '>', '\', '*', '#', '+', '~']
203 type: str
204
205 echappe-chevron-solitaire:
206 # un < qui n'est pas suivi d'une lettre ou d'un / est toujours echappe
207 type: preg
208 match: "/<(?=[^a-z\/!])/Uims"
209 replace: "&lt;"
210
211 echappe-chevron-pas-ferme:
212 # un < suivi d'une lettre ou d'un / est echappe si il semble mal ferme
213 type: preg
214 match: "/<([^><\"'!]*)(?=<|$)/Uims"
215 replace: "&lt;$1"