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