guide-libreasso/tools/wiki2tex.sed
2020-05-16 14:53:30 +02:00

48 lines
1.2 KiB
Sed
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Passer du wiki à du TeX avec Sed
# Caractères spéciaux
s/ / /g
# s/\(\$\|~\|%\|\&\|{\|}\|_\|#\|\\\)/\\\1/g
#
# acceptons de mettre du code LaTeX dans la page wiki
s/\ /\\nbspace /g
s/\(\$\|~\|%\|\&\|_\|#\)/\\\1/g
s/« /«\~/g
s/ »/\~»/g
s//'/g
s//\\no /g
s/\\nbspace /~/g
s/\\colsep/\&\&/g
# À voir ultérieurement
s/\[\[[Cc]at[ée]gor[\(ie\)y].*\]\]//g
s/{{[ ]*[Tt]ravail [Ee]n [Cc]ours.*}}//g
s/<references *\/>//g
# Mise en forme
s/'''\([^\('''\)]*\)'''/\\strong{\1}/g
s/''\([^\(''\)]*\)''/\\emph{\1}/g
s/<em>\([^<]*\)<\/em>/\\emph{\1}/g
# buggy ...
s/<ref>\([^\(<\/ref>\)]*\)<\/ref>/\\emph{\1}/g
s/<ref>/\\footnote{/g
s/<\/ref>/}/g
# Liens
s/\[\[\([^|]*\)|\([^]]*\)\]\]/\\href{http:\/\/wiki.april.org\/\1}{\2}/g
s/\[\[\([^]]*\)\]\]/\\href{http:\/\/wiki.april.org\/\1}{\1}/g
s/\[\([^] ]*\) \([^]]*\)\]/\\href{\1}{\2}/g
s/ \(http[^ }<)]*\)/ \\url{\1}/g
# Structure
s/^\s*==\s\?Annexes\s\?==/\\appendix/
s/^\s*==\s\?Couverture\s\?==/\\makecouv/
s/^\s*======\s\?\(.*\)\s\?======/\\paragraph{\1}/
s/^\s*=====\s\?\(.*\)\s\?=====/\\subsubsection{\1}/
s/^\s*====\s\?\(.*\)\s\?====/\\subsection{\1}/
s/^\s*===\s\?\(.*\)\s\?===/\\section{\1}/
s/^\s*==\s\?\(.*\)\s\?==/\\chapter{\1}/
s/__TOC__/\\tableofcontents/