org.clapper.markwrap.plaintext.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of markwrap_2.10 Show documentation
Show all versions of markwrap_2.10 Show documentation
A unified API for converting various lightweight markup languages to HTML
The newest version!
/*
---------------------------------------------------------------------------
This software is released under a BSD license, adapted from
http://opensource.org/licenses/bsd-license.php
Copyright (c) 2010-2018, Brian M. Clapper
All rights reserved.
See the accompanying license file for details.
---------------------------------------------------------------------------
*/
package org.clapper.markwrap
import scala.io.Source
/**
* The `PreWrapHandler` type handles a file that is presumed to be plain text.
* The text is wrapped in "pre" tags and emitted as-is.
*/
private[markwrap] class PreWrapHandler extends MarkWrapParser {
val markupType = MarkupType.PlainText
/**
* "Parse" a document that is assumed to be plain text.
*
* @param source The `Source` from which to read the lines of text
*
* @return the HTML
*/
def parseToHTML(source: Source): String =
"" + source.getLines().mkString("\n") + "
"
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy