48 lines
1.2 KiB
Sed
48 lines
1.2 KiB
Sed
|
# 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/n°/\\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/
|