spip.yaml 4.2 KB

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