9 * @author Christian Weiske <cweiske@cweiske.de>
10 * @copyright 2014 Christian Weiske
11 * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
12 * @link http://cweiske.de/grauphel.htm
14 namespace OCA\Grauphel\Converter;
18 * Convert Tomboy note XML to HTML that can be used (nearly) standalone.
19 * This means it tries to use as many native tags as possible and
20 * does not rely on classes so much.
24 * @author Christian Weiske <cweiske@cweiske.de>
25 * @copyright 2014 Christian Weiske
26 * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
27 * @version Release: @package_version@
28 * @link http://cweiske.de/grauphel.htm
30 class CleanHtml extends Html
32 protected static $tagMap = array(
41 'strikethrough' => 'del',
45 protected static $styleClassMap = array(
46 'size:small' => 'small',
49 protected static $styleMap = array(
50 'monospace' => 'font-family:monospace; white-space: pre-wrap'
54 * Converts the tomboy note XML into HTML.
55 * Cleans HTML a bit up after it has been generated with the clean tags.
57 * @param string $xmlContent Tomboy note content
61 public function convert($xmlContent)
63 $html = parent::convert($xmlContent);
64 $html = str_replace('</h2><br />', '</h2>', $html);
65 $html = str_replace('</h3><br />', '</h3>', $html);
66 $html = str_replace("<br />\n</h2>", "</h2>\n", $html);
67 $html = str_replace("<br />\n</h3>", "</h3>\n", $html);
68 $html = str_replace("<br />\n</li>", "</li>\n", $html);
69 $html = str_replace("<br />\n<ul>", "<ul>\n", $html);