@@ -100,3 +100,40 @@ case object Csv extends TargetLanguage {
100100 def tableEnd : String = " "
101101 def csvEncode (s : String ): String = org.apache.commons.lang3.StringEscapeUtils .escapeCsv(s)
102102}
103+
104+ case object ConfluenceWikiMarkup extends TargetLanguage {
105+ val ext = " confluence.mu"
106+ def documentStart (title : String , reportStyleRules : Option [String ]): String = " "
107+ def documentEnd (): String = " "
108+ def createHyperLink (link : String , content : String ): String = s " [ ${trim(content)}| ${trim(link)}] "
109+ def blankLine (): String = " \n "
110+ def header1 (msg : String ): String = s " h1. $msg\n "
111+ def tableHeader (firstColumn : String , secondColumn : String , thirdColumn : String , fourthColumn : String ): String = {
112+ s " || $firstColumn || $secondColumn || $thirdColumn || $fourthColumn || \n "
113+ }
114+
115+ def tableRow (
116+ firstColumn : String ,
117+ secondColumn : String ,
118+ thirdColumn : String ,
119+ fourthColumn : String
120+ ): String = s " | $firstColumn | $secondColumn | $thirdColumn | $fourthColumn | \n "
121+ def tableEnd : String = " \n "
122+
123+ def markdownEncode (s : String ): String = s.flatMap {
124+ case c if (List ('*' , '`' , '[' , ']' , '#' , '|' ).contains(c)) => " \\ " + c
125+ case x => x.toString
126+ }
127+
128+ def escapeHtml (s : String ): String = Html .htmlEncode(s).flatMap {
129+ case '|' => " |" // it would destroy tables!
130+ case c => c.toString
131+ }
132+
133+ /** Null handling trim utility function. */
134+ private [this ] def trim (in : String ): String = {
135+ Option (in).fold(" " ) { string =>
136+ string.trim
137+ }
138+ }
139+ }
0 commit comments