1
14
15 package com.liferay.portlet.wiki.translators;
16
17
22 public class ClassicToCreoleTranslator extends BaseTranslator {
23
24 public ClassicToCreoleTranslator() {
25 initRegexps();
26 }
27
28 protected void initRegexps() {
29
30
32 regexps.put(
33 "'''''((?s:.)*?)('''''|(\n\n|\r\r|\r\n\r\n))", "**//$1//**$3");
34
35
37 regexps.put("'''((?s:.)*?)('''|(\n\n|\r\r|\r\n\r\n))", "**$1**$3");
38
39
41 regexps.put("''((?s:.)*?)(''|(\n\n|\r\r|\r\n\r\n))", "//$1//$3");
42
43
45 regexps.put("\\[([^ ]*)\\]", "[[$1]]");
46
47
49 regexps.put("\\[([^ ]+) (.*)\\]", "[[$1|$2]]");
50
51
53 regexps.put("(^ (.+))(\\n (.+))*", "{{{\n$0\n}}}");
54
55
57 regexps.put("^\\t[\\*] (.*)", "* $1");
58
59
61 regexps.put("^\\t\\t[\\*] (.*)", "** $1");
62
63
65 regexps.put("^\\t\\t\\t[\\*] (.*)", "*** $1");
66
67
69 regexps.put("^\\t\\t\\t\\t[\\*] (.*)", "**** $1");
70
71
73 regexps.put("^\\t1 (.*)", "# $1");
74
75
77 regexps.put("^\\t\\t1 (.*)", "## $1");
78
79
81 regexps.put("^\\t\\t\\t1 (.*)", "### $1");
82
83
85 regexps.put("^\\t\\t\\t\\t1 (.*)", "#### $1");
86
87
89 regexps.put("^\\t([\\w]+):\\t(.*)", "**$1**:\n$2");
90
91
93 regexps.put("^\\t:\\t(.*)", "$1");
94
95
97 regexps.put(
98 "(^|\\p{Punct}|\\p{Space})((\\p{Lu}\\p{Ll}+){2,})" +
99 "(\\z|\\n|\\p{Punct}|\\p{Space})", " [[$2]] ");
100 }
101
102 }