Statistics
| Revision:

root / tmp / org.txm.setups / MD2Mail.groovy @ 1120

History | View | Annotate | Download (757 Bytes)

1 728 mdecorde
File mdFile = new File("annonces/mail.md/0.7.6_fr.md")
2 728 mdecorde
File mailFile = new File("annonces/mail.txt/0.7.6_fr.txt")
3 728 mdecorde
File readmeFile = new File("annonces/readme.md/0.7.6_fr.md")
4 728 mdecorde
5 728 mdecorde
String text = mdFile.getText("UTF-8")
6 728 mdecorde
mailFile.withWriter("UTF-8") { writer ->
7 728 mdecorde
        text = text.replaceAll("\t", '  ')
8 728 mdecorde
        text = text.replaceAll("\\* (.+\n)", ' - $1')
9 728 mdecorde
10 728 mdecorde
        text = text.replaceAll("\\[([^\\]]+)\\]\\([^\\)]+\\)", '$1')
11 728 mdecorde
        text = text.replaceAll("([^\n]+)\n===\n", 'Bonjour à tous,\n')
12 728 mdecorde
        text = text.replaceAll("([^\n]+)\n---\n", '*$1*\n')
13 728 mdecorde
        writer.print text
14 728 mdecorde
}
15 728 mdecorde
16 728 mdecorde
text = mdFile.getText("UTF-8")
17 728 mdecorde
readmeFile.withWriter("UTF-8") { writer ->
18 728 mdecorde
        text = text.replaceAll("\n===\n", '')
19 728 mdecorde
        text = text.replaceAll("Nous avons le plai.+\n",'')
20 728 mdecorde
        writer.print text
21 728 mdecorde
}
22 728 mdecorde
23 728 mdecorde
println 'fin'
24 728 mdecorde
System.exit()