eu.henkelmann.actuarius.Decorator.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of actuarius_2.10 Show documentation
Show all versions of actuarius_2.10 Show documentation
Actuarius is a Markdown Processor written in Scala using parser combinators.
The newest version!
package eu.henkelmann.actuarius
/**
* This trait influences the behavior of the Markdown output of inline and block parsers
* and the complete transformer.
* Mix in this trait and override methods to change the behavior and override the "deco()" method
* in the respective parser/transformer to return
* your modified instances to change the output they create.
*
* Inline element decoration methods always get passed the spanned text, so you have to
* prepend and append the opening/closing tags. For block elements there is always a method
* for the opening and closing tags. This is to make block
* processing more efficient to prevent unnecessary String building of whole blocks just to
* add tags. (The block building uses a StringBuilder internally and just appends the returned tags)
*
* If you want line breaks after opening/closing block level tags, you have to add the newline yourself.
*/
trait Decorator {
/**
* The string used to ident one level. Defaults to the empty string
*/
def indentation() = ""
/**
* If true, inline xml tags and verbatim xml blocks are allowed,
* otherwise they are escaped and included as plain text
*/
def allowVerbatimXml():Boolean = true
/** used to print out manual line breaks (default:
)
*/
def decorateBreak():String = "
"
/** used to print out inline code (default: ...
)
*/
def decorateCode(code:String):String = "" + code + "
"
/** used to print out emphasized text (default ...)
*/
def decorateEmphasis(text:String):String = "" + text + ""
/** Used to print out strong text (default: ...
*/
def decorateStrong(text:String):String = "" + text + ""
/** Used to print link elements (default: "" + text + ""
case Some(t) => "" + text + ""
}
/** Used to print image elements (default: ""
case Some(t) => ""
}
/**used to print a horizontal ruler defaults to "
\n" */
def decorateRuler():String = "
\n"
/** used to print the beginning of a header, defaults to "" */
def decorateHeaderOpen(headerNo:Int):String = ""
/** used to print the end of a header, defaults to " " */
def decorateHeaderClose(headerNo:Int):String = " \n"
/** used to print the beginning of a code block, defaults to ""*/
def decorateCodeBlockOpen():String = ""
/** used to print the end of a code block, defaults to "
\n" */
def decorateCodeBlockClose():String = "
\n"
/** used to print the beginning of a paragraph, defaults to "" */
def decorateParagraphOpen():String = "
"
/** used to print the end of a paragraph, defaults to "
\n" */
def decorateParagraphClose():String = "\n"
/** used to print the beginning of a blockquote, defaults to "" */
def decorateBlockQuoteOpen():String = ""
/** used to print the end of a blockquote, defaults to "
\n" */
def decorateBlockQuoteClose():String = "
\n"
/** used to print the beginning of a list item, defaults to "" */
def decorateItemOpen():String = " "
/** used to print the end of a list item, defaults to " " */
def decorateItemClose():String = "\n"
/** used to print the beginning of an unordered list, defaults to "\n" */
def decorateUListOpen():String = "\n"
/** used to print the end of an unordered list, defaults to "
\n" */
def decorateUListClose():String = "
\n"
/** used to print the beginning of an ordered list, defaults to \n */
def decorateOListOpen():String = "\n"
/** used to print the end of an ordered list, defaults to
\n */
def decorateOListClose():String = "
\n"
}
/**
* Default instance of Decorator with the standard Markdown behavior
*/
object Decorator extends Decorator {
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy