All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kefirsf.bb.textile.xml Maven / Gradle / Ivy

Go to download

KefirBB is a Java-library for text processing. Initially it was developed for BB2HTML translation. But flexible configuration allows to use it in different cases. For example for parsing Markdown, Textile, and for HTML filtration.

The newest version!
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns="http://kefirsf.org/kefirbb/schema"
               xsi:schemaLocation="http://kefirsf.org/kefirbb/schema http://kefirsf.org/kefirbb/schema/kefirbb-1.2.xsd">
    <!-- XML escape symbols -->
    <scope name="safeXml">
        <code priority="-2">
            <pattern>&apos;</pattern>
            <template>&amp;apos;</template>
        </code>
        <code priority="-2">
            <pattern>&lt;</pattern>
            <template>&amp;lt;</template>
        </code>
        <code priority="-2">
            <pattern>&gt;</pattern>
            <template>&amp;gt;</template>
        </code>
        <code priority="-2">
            <pattern>&quot;</pattern>
            <template>&amp;quot;</template>
        </code>
    </scope>

    <!-- Scope for escaping some symbols -->
    <scope name="escapeHtml" parent="safeXml">
        <!-- Ignore unknown tags -->
        <code priority="-1">
            <pattern>&lt;<junk/>&gt;</pattern>
            <template/>
        </code>

        <!-- Comment -->
        <code name="comment">
            <pattern>&lt;!--<junk/>&gt;</pattern>
            <template/>
        </code>
    </scope>


    <!-- Escape basic HTML char sequences -->
    <scope name="basic" parent="escapeHtml">
        <!-- line feed characters -->
        <code name="br">
            <pattern><eol/></pattern>
            <template>&lt;br/&gt;</template>
        </code>
    </scope>

    <scope name="format" parent="basic">
        <!-- Headers -->
        <coderef name="h1"/>
        <coderef name="h2"/>
        <coderef name="h3"/>
        <coderef name="h4"/>
        <coderef name="h5"/>
        <coderef name="h6"/>

        <!-- Formatting -->
        <coderef name="bold"/>
        <coderef name="u"/>
        <coderef name="s"/>
        <coderef name="i"/>
    </scope>

    <!-- Root scope. This scope uses when processor started work and by default, if not set other scope -->
    <scope name="html" parent="format">
        <!-- Paragraph -->
        <coderef name="p"/>
        <coderef name="hr"/>
        <coderef name="span"/>
        <coderef name="div"/>

        <!-- Quotes -->
        <coderef name="pre"/>
        <coderef name="code"/>
        <coderef name="quote"/>

        <!-- Images -->
        <coderef name="img"/>

        <!-- links -->
        <coderef name="url1"/>

        <!-- Lists -->
        <coderef name="ul"/>
        <coderef name="ol"/>
        <coderef name="dl"/>

        <!-- Table -->
        <coderef name="table"/>
    </scope>

    <scope name="textile" parent="html">
        <code>
            <pattern>&quot;<var inherit="true"/>&quot;</pattern>
            <template>&amp;ldquo;<var/>&amp;rdquo;</template>
        </code>
        <code priority="2">
            <pattern>--</pattern>
            <template>&amp;mdash;</template>
        </code>
        <code>
            <pattern>-</pattern>
            <template>&amp;ndash;</template>
        </code>
        <code>
            <pattern>...</pattern>
            <template>&amp;hellip;</template>
        </code>
        <code>
            <pattern> x </pattern>
            <template> &amp;times; </template>
        </code>
        <code>
            <pattern ignoreCase="true">(c)</pattern>
            <template>&amp;copy;</template>
        </code>
        <code>
            <pattern ignoreCase="true">(r)</pattern>
            <template>&amp;reg;</template>
        </code>
        <code>
            <pattern ignoreCase="true">(tm)</pattern>
            <template>&amp;trade;</template>
        </code>
        <code>
            <pattern>_<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>_</pattern>
            <template>&lt;em<var name="attrs"/>&gt;<var/>&lt;/em&gt;</template>
        </code>
        <code priority="1">
            <pattern>__<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>__</pattern>
            <template>&lt;i<var name="attrs"/>&gt;<var/>&lt;/i&gt;</template>
        </code>
        <code>
            <pattern>*<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>*</pattern>
            <template>&lt;strong<var name="attrs"/>&gt;<var/>&lt;/strong&gt;</template>
        </code>
        <code priority="1">
            <pattern>**<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>**</pattern>
            <template>&lt;b<var name="attrs"/>&gt;<var/>&lt;/b&gt;</template>
        </code>
        <code>
            <pattern>??<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>??</pattern>
            <template>&lt;cite<var name="attrs"/>&gt;<var/>&lt;/cite&gt;</template>
        </code>
        <code>
            <pattern>@<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>@</pattern>
            <template>&lt;code<var name="attrs"/>&gt;<var/>&lt;/code&gt;</template>
        </code>
        <code>
            <pattern>+<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>+</pattern>
            <template>&lt;ins<var name="attrs"/>&gt;<var/>&lt;/ins&gt;</template>
        </code>
        <code priority="1">
            <pattern>-<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>-</pattern>
            <template>&lt;del<var name="attrs"/>&gt;<var/>&lt;/del&gt;</template>
        </code>
        <code>
            <pattern>^<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>^</pattern>
            <template>&lt;sup<var name="attrs"/>&gt;<var/>&lt;/sup&gt;</template>
        </code>
        <code>
            <pattern>~<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>~</pattern>
            <template>&lt;sub<var name="attrs"/>&gt;<var/>&lt;/sub&gt;</template>
        </code>
        <code>
            <pattern>[<var regex="\d+"/>]</pattern>
            <template>&lt;sup&gt;&lt;a href=&quot;#fn<var/>&quot;&gt;<var/>&lt;/a&gt;&lt;/sup&gt;</template>
        </code>
        <code>
            <pattern>==<var scope="safeXml"/>==</pattern>
            <template><var/></template>
        </code>
        <code>
            <pattern>%<var name="attrs" scope="inlineAttrs"/><var inherit="true"/>%</pattern>
            <template>&lt;span<var name="attrs"/>&gt;<var/>&lt;/span&gt;</template>
        </code>
        <code>
            <pattern><var regex="\p{javaUpperCase}+" name="acronym"/>(<var name="title" scope="escapeHtml"/>)</pattern>
            <template>&lt;abbr title=&quot;<var name="title"/>&quot;&gt;<var name="acronym"/>&lt;/abbr&gt;</template>
        </code>

        <!-- Links -->
        <code priority="2">
            <pattern>&quot;<var name="class" scope="classAttrs"/><var name="text" scope="safeXml"/>(<var name="title" scope="safeXml"/>)&quot;:<url local="true"/></pattern>
            <pattern>&quot;<var name="class" scope="classAttrs"/><var name="text" scope="safeXml"/>&quot;:<url local="true"/></pattern>
            <template>&lt;a href=&quot;<var name="url"/>&quot;<if name="title"> title=&quot;<var name="title"/>&quot;</if><var name="class"/>&gt;<var name="text"/>&lt;/a&gt;</template>
        </code>
        <code priority="4">
            <pattern>&quot;<var name="class" scope="classAttrs"/>$(<var name="title" scope="safeXml"/>)&quot;:<url local="true"/></pattern>
            <pattern>&quot;<var name="class" scope="classAttrs"/>$&quot;:<url local="true"/></pattern>
            <template>&lt;a href=&quot;<var name="url"/>&quot;<if name="title">  title=&quot;<var name="title"/>&quot;</if><var name="class"/>&gt;<var name="url"/>&lt;/a&gt;</template>
        </code>

        <!-- Images -->
        <code priority="2">
            <pattern>!<var name="align" scope="imgAlign"/><var name="attrs" scope="inlineAttrs"/><url local="true"/>(<var name="alt" scope="safeXml"/>)!</pattern>
            <pattern>!<var name="align" scope="imgAlign"/><var name="attrs" scope="inlineAttrs"/><url local="true"/>!</pattern>
            <template>&lt;img<if name="alt"> alt=&quot;<var name="alt"/>&quot; title=&quot;<var name="alt"/>&quot;</if> src=&quot;<var name="url"/>&quot;<var name="align"/><var name="attrs"/>/&gt;</template>
        </code>
        <code priority="4">
            <pattern>!<var name="align" scope="imgAlign"/><var name="attrs" scope="inlineAttrs"/><url local="true"/>(<var name="alt" scope="safeXml"/>)!:<url name="link" local="true"/></pattern>
            <pattern>!<var name="align" scope="imgAlign"/><var name="attrs" scope="inlineAttrs"/><url local="true"/>!:<url name="link" local="true"/></pattern>
            <template>&lt;a href=&quot;<var name="link"/>&quot;&gt;&lt;img<if name="alt"> alt=&quot;<var name="alt"/>&quot; title=&quot;<var name="alt"/>&quot;</if> src=&quot;<var name="url"/>&quot;<var name="align"/><var name="attrs"/>/&gt;&lt;/a&gt;</template>
        </code>
    </scope>

    <scope name="imgAlign" strong="true" max="1">
        <code>
            <pattern>&lt;</pattern>
            <template> align=&quot;left&quot;</template>
        </code>
        <code>
            <pattern>&gt;</pattern>
            <template> align=&quot;right&quot;</template>
        </code>
        <code>
            <pattern>=</pattern>
            <template> align=&quot;center&quot;</template>
        </code>
    </scope>

    <!-- TODO -->
    <scope name="classAttrs" max="1" strong="true">
        <code name="cssClassId" priority="3">
            <pattern>(#<var name="id" regex="[\w\d\-]+"/>)</pattern>
            <pattern>(<var name="class" regex="[\s\w\d\-\.]+"/>#<var name="id" regex="[\w\d\-]+"/>)</pattern>
            <pattern>(<var name="class" regex="[\s\w\d\-\.]+"/>)</pattern>
            <template><if name="id"> id=&quot;<var name="id"/>&quot;</if><if name="class"> class=&quot;<var name="class"/>&quot;</if></template>
        </code>
    </scope>

    <!-- Inline attributes -->
    <scope name="inlineAttrs" strong="true" parent="classAttrs">
        <code>
            <pattern><var scope="styleAttrs"/></pattern>
            <template> style=&quot;<var/>&quot;</template>
        </code>
    </scope>

    <!-- Style attributes -->
    <scope name="styleAttrs" strong="true" min="1" max="1">
        <!-- suppress z-index and javascript min styles -->
        <code priority="1">
            <pattern>{<var regex=".*(z-index)|(javascript)|(http).*"/>}</pattern>
            <template/>
        </code>
        <code>
            <pattern>{<var regex="([\w-]*:[\s\w\d]*;)*([\w-]*:[\s\w\d]*)?"/>}</pattern>
            <template><var/></template>
        </code>
    </scope>

    <!-- Block's attributes -->
    <scope name="blockAttrs" strong="true" parent="classAttrs">
        <code>
            <pattern>[<var regex="\w{2}"/>]</pattern>
            <template> lang=&quot;<var/>&quot;</template>
        </code>
        <code>
            <pattern><var name="attrs" scope="parAttrs"/></pattern>
            <template> style=&quot;<var name="attrs"/>&quot;</template>
        </code>
    </scope>

    <!-- Paragraph's styles -->
    <scope name="parAttrs" ignoreText="true" strong="true" parent="styleAttrs" min="1">
        <code>
            <pattern>&lt;</pattern>
            <template>text-align:left;</template>
        </code>
        <code>
            <pattern>&gt;</pattern>
            <template>text-align:right;</template>
        </code>
        <code>
            <pattern>=</pattern>
            <template>text-align:center;</template>
        </code>
        <code priority="1">
            <pattern>&lt;&gt;</pattern>
            <template>text-align:justify;</template>
        </code>
        <code>
            <pattern><var parse="false" regex="\(+"/></pattern>
            <template>padding-left:<var function="length"/>em;</template>
        </code>
        <code>
            <pattern><var parse="false" regex="\)+"/></pattern>
            <template>padding-right:<var function="length"/>em;</template>
        </code>
    </scope>

    <scope name="ROOT" ignoreText="true">
        <!-- Paragraphs -->
        <code priority="0">
            <pattern><bol/><var scope="textile"/><blankline/></pattern>
            <template>&lt;p&gt;<var/>&lt;/p&gt;</template>
        </code>
        <code priority="2">
            <pattern ignoreCase="true"><bol/>p<var name="attrs" scope="blockAttrs"/>. <var scope="textile"/><blankline/></pattern>
            <template>&lt;p<var name="attrs"/>&gt;<var/>&lt;/p&gt;</template>
        </code>

        <!-- Free string -->
        <code priority="2">
            <pattern><bol/> <var scope="textile"/><eol/></pattern>
            <template><var/></template>
        </code>

        <!-- Headers -->
        <code priority="2">
            <pattern ignoreCase="true"><bol/>h<var name="size" parse="false" regex="[1-6]"/><var name="attrs" scope="blockAttrs"/>. <var scope="textile"/><blankline/></pattern>
            <template>&lt;h<var name="size"/><var name="attrs"/>&gt;<var/>&lt;/h<var name="size"/>&gt;</template>
        </code>

        <!-- Block code. The multiline block code. -->
        <code priority="3">
            <pattern ignoreCase="true"><bol/>bc<var name="attrs" scope="blockAttrs"/>.. <var scope="safeXml"/><var name="terminator" regex="\Z|((\n|\r){2}((p|(h\d)|bc|pre|bq|notextile|(fn\d+)|###|table)[^\n\r]*\.)|(\|[^\n\r]*\|))" ghost="true"/></pattern>
            <pattern ignoreCase="true"><bol/>bc<var name="attrs" scope="blockAttrs"/>. <var scope="safeXml"/><blankline/></pattern>
            <template>&lt;pre<var name="attrs"/>&gt;&lt;code&gt;<var/>&lt;/code&gt;&lt;/pre&gt;</template>
        </code>

        <!-- Preformatted -->
        <code priority="3">
            <pattern ignoreCase="true"><bol/>pre<var name="attrs" scope="blockAttrs"/>.. <var scope="safeXml"/><var name="terminator" regex="\Z|((\n|\r){2}((p|(h\d)|bc|pre|bq|notextile|(fn\d+)|###|table)[^\n\r]*\.)|(\|[^\n\r]*\|))" ghost="true"/></pattern>
            <pattern ignoreCase="true"><bol/>pre<var name="attrs" scope="blockAttrs"/>. <var scope="safeXml"/><blankline/></pattern>
            <template>&lt;pre<var name="attrs"/>&gt;<var/>&lt;/pre&gt;</template>
        </code>

        <!-- Block quote -->
        <code priority="2">
            <pattern ignoreCase="true"><bol/>bq<var name="attrs" scope="blockAttrs"/>.. <var scope="bqScope"/><var name="terminator" regex="\Z|((\n|\r){2}((p|(h\d)|bc|pre|bq|notextile|(fn\d+)|###|table)[^\n\r]*\.)|(\|[^\n\r]*\|))" ghost="true"/></pattern>
            <pattern ignoreCase="true"><bol/>bq<var name="attrs" scope="blockAttrs"/>.:<url local="true"/> <var scope="textile"/><blankline/></pattern>
            <pattern ignoreCase="true"><bol/>bq<var name="attrs" scope="blockAttrs"/>. <var scope="textile"/><blankline/></pattern>
            <template>&lt;blockquote<var name="attrs"/><if name="url"> cite=&quot;<var name="url"/>&quot;</if>&gt;&lt;p<if name="attrs"><var name="attrs"/></if>&gt;<var/>&lt;/p&gt;&lt;/blockquote&gt;</template>
        </code>

        <!-- No formatting -->
        <code priority="2">
            <pattern ignoreCase="true"><bol/>notextile. <var scope="safeXml"/><blankline/></pattern>
            <template><var/></template>
        </code>

        <code priority="2">
            <pattern ignoreCase="true"><bol/>fn<var name="number" regex="\d+"/>. <var name="content" scope="textile"/><blankline/></pattern>
            <template>&lt;p id="fn<var name="number"/>"&gt;&lt;sup&gt;<var name="number"/>&lt;/sup&gt; <var name="content"/>&lt;/p&gt;</template>
        </code>

        <!-- Comments -->
        <code priority="4">
            <pattern><bol/>###.. <junk/><var name="terminator" regex="\Z|((\n|\r){2}((p|(h\d)|bc|pre|bq|notextile|(fn\d+)|###|table)[^\n\r]*\.)|(\|[^\n\r]*\|))" ghost="true"/></pattern>
            <pattern><bol/>###. <junk/><blankline/></pattern>
            <template/>
        </code>

        <!-- Lists -->
        <code priority="2" transparent="false">
            <pattern><bol/><var name="check" regex="\*(\*|#)*\s" ghost="true"/><var name="list" regex="\*" ghost="true"/><var scope="listScope"/></pattern>
            <template>&lt;ul&gt;<var/>&lt;/ul&gt;</template>
        </code>
        <code priority="2" transparent="false">
            <pattern><bol/><var name="check" regex="#(\*|#)*\s" ghost="true"/><var name="list" regex="#" ghost="true"/><var scope="listScope"/></pattern>
            <template>&lt;ol&gt;<var/>&lt;/ol&gt;</template>
        </code>

        <!-- Tables -->
        <code priority="2">
            <pattern><bol/>table<var name="attr" scope="blockAttrs"/>.<eol/><var scope="textileTableScope"/></pattern>
            <pattern><bol/><var scope="textileTableScope"/></pattern>
            <template>&lt;table<if name="attr"><var name="attr"/></if>&gt;<var/>&lt;/table&gt;</template>
        </code>
    </scope>

    <scope name="textileTableScope" parent="textileBlockScope" min="1" strong="true">
        <code priority="1">
            <pattern>|^.<eol/><var scope="textileBlockScope"/></pattern>
            <template>&lt;thead&gt;<var/>&lt;/thead&gt;</template>
        </code>
        <code priority="1">
            <pattern>|~.<eol/><var scope="textileBlockScope"/></pattern>
            <template>&lt;tfoot&gt;<var/>&lt;/tfoot&gt;</template>
        </code>
        <code priority="1">
            <pattern>|-.<eol/><var scope="textileBlockScope"/></pattern>
            <template>&lt;tbody&gt;<var/>&lt;/tbody&gt;</template>
        </code>
        <code priority="1">
            <pattern>|:<var name="attr" scope="colAttrs"/>.<var name="width" scope="widthScope"/><constant value="|" ghost="true"/><var scope="colGroupScope"/>|<eol/></pattern>
            <template>&lt;colgroup<var name="attr"/><var name="width"/>&gt;<var/>&lt;/colgroup&gt;</template>
        </code>
    </scope>

    <scope name="colGroupScope" strong="true">
        <code priority="1">
            <pattern>|<var name="attr" scope="colAttrs"/>.<var scope="widthScope"/><constant value="|" ghost="true"/></pattern>
            <pattern>|<var scope="widthScope"/><constant value="|" ghost="true"/></pattern>
            <template>&lt;col<if name="attr"><var name="attr"/></if><var/>/&gt;</template>
        </code>
    </scope>
    <scope name="widthScope" strong="true">
        <code>
            <pattern><var regex="\d+(\*|%)?"/></pattern>
            <template> width=&quot;<var/>&quot;</template>
        </code>
        <code>
            <pattern> </pattern>
            <template/>
        </code>
    </scope>

    <scope name="textileBlockScope" min="1" strong="true">
        <code>
            <pattern>|<var name="not" regex="[^\^~\-:]|([\^~\-:][^\.])|([\^~\-:]\.[^\r\n])" ghost="true"/><var scope="textileRowScope"/><eol/></pattern>
            <pattern><bol/><var name="attr" scope="blockAttrs"/>. |<var scope="textileRowScope"/><eol/></pattern>
            <template>&lt;tr<if name="attr"><var name="attr"/></if>&gt;<var/>&lt;/tr&gt;</template>
        </code>
    </scope>

    <scope name="textileRowScope" min="1" ignoreText="true">
        <code>
            <pattern><var name="attr" scope="tdAttrs"/>.<var scope="textile"/>|</pattern>
            <pattern><var scope="textile"/>|</pattern>
            <template>&lt;td<if name="attr"><var name="attr"/></if>&gt;<var/>&lt;/td&gt;</template>
        </code>
        <code priority="2">
            <pattern>_<var name="attr" scope="tdAttrs"/>.<var scope="textile"/>|</pattern>
            <template>&lt;th<var name="attr"/>&gt;<var/>&lt;/th&gt;</template>
        </code>
    </scope>

    <scope name="tdStyle" strong="true" ignoreText="true" parent="styleAttrs" min="1">
        <code>
            <pattern>&lt;</pattern>
            <template>text-align:left;</template>
        </code>
        <code>
            <pattern>&gt;</pattern>
            <template>text-align:right;</template>
        </code>
        <code>
            <pattern>=</pattern>
            <template>text-align:center;</template>
        </code>
        <code>
            <pattern>^</pattern>
            <template>vertical-align:top;</template>
        </code>
        <code>
            <pattern>-</pattern>
            <template>vertical-align:middle;</template>
        </code>
        <code>
            <pattern>~</pattern>
            <template>vertical-align:bottom;</template>
        </code>
    </scope>

    <scope name="tdAttrs" strong="true" ignoreText="true" parent="classAttrs">
        <code>
            <pattern><var scope="tdStyle"/></pattern>
            <template> style=&quot;<var/>&quot;</template>
        </code>
        <code>
            <pattern>\<var regex="\d+"/></pattern>
            <template> colspan=&quot;<var/>&quot;</template>
        </code>
        <code>
            <pattern>/<var regex="\d+"/></pattern>
            <template> rowspan=&quot;<var/>&quot;</template>
        </code>
    </scope>

    <scope name="colAttrs" strong="true" ignoreText="true" parent="classAttrs">
        <code>
            <pattern><var scope="styleAttrs"/></pattern>
            <template> style=&quot;<var/>&quot;</template>
        </code>
        <code>
            <pattern>\<var regex="\d+"/></pattern>
            <template> span=&quot;<var/>&quot;</template>
        </code>
    </scope>

    <!-- A scope of a list. Contains list elements. -->
    <scope name="listScope" strong="true">
        <code>
            <pattern><bol/><var name="list" action="check"/> <var scope="textile"/><eol/></pattern>
            <template>&lt;li&gt;<var/>&lt;/li&gt;</template>
        </code>
        <code transparent="false">
            <pattern><bol/><var name="list" action="check"/><var name="list" action="append" regex="\*"/><var name="first" scope="firstListScope"/><var scope="listScope"/></pattern>
            <template>&lt;li&gt;&lt;ul&gt;<var name="first"/><var/>&lt;/ul&gt;&lt;/li&gt;</template>
        </code>
        <code transparent="false">
            <pattern><bol/><var name="list" action="check"/><var name="list" action="append" regex="#"/><var name="first" scope="firstListScope"/><var scope="listScope"/></pattern>
            <template>&lt;li&gt;&lt;ol&gt;<var name="first"/><var/>&lt;/ol&gt;&lt;/li&gt;</template>
        </code>
    </scope>

    <!-- Contains first list elements. -->
    <scope name="firstListScope" strong="true" max="1">
        <code>
            <pattern> <var scope="textile"/><eol/></pattern>
            <template>&lt;li&gt;<var/>&lt;/li&gt;</template>
        </code>
        <code transparent="false">
            <pattern><var name="list" action="append" regex="\*"/><var name="first" scope="firstListScope"/><var scope="listScope"/></pattern>
            <template>&lt;li&gt;&lt;ul&gt;<var name="first"/><var/>&lt;/ul&gt;&lt;/li&gt;</template>
        </code>
        <code transparent="false">
            <pattern><var name="list" action="append" regex="#"/><var name="first" scope="firstListScope"/><var scope="listScope"/></pattern>
            <template>&lt;li&gt;&lt;ol&gt;<var name="first"/><var/>&lt;/ol&gt;&lt;/li&gt;</template>
        </code>
    </scope>

    <!-- A scope for the multiline blockquote -->
    <scope name="bqScope" parent="textile">
        <code priority="1">
            <pattern><blankline/></pattern>
            <template>&lt;/p&gt;&lt;p&gt;</template>
        </code>
    </scope>

    <!-- Links. http, https, mailto protocols -->
    <scope name="url" parent="format">
        <!-- Paragraph -->
        <coderef name="span"/>

        <!-- Quotes -->
        <coderef name="code"/>

        <!-- Images -->
        <coderef name="img"/>
    </scope>

    <!-- Headers -->
    <code name="h1">
        <pattern ignoreCase="true">&lt;h1<junk/>&gt;<var scope="basic"/>&lt;/h1&gt;</pattern>
        <template>&lt;h1&gt;<var/>&lt;/h1&gt;</template>
    </code>
    <code name="h2">
        <pattern ignoreCase="true">&lt;h2<junk/>&gt;<var scope="basic"/>&lt;/h2&gt;</pattern>
        <template>&lt;h2&gt;<var/>&lt;/h2&gt;</template>
    </code>
    <code name="h3">
        <pattern ignoreCase="true">&lt;h3<junk/>&gt;<var scope="basic"/>&lt;/h3&gt;</pattern>
        <template>&lt;h3&gt;<var/>&lt;/h3&gt;</template>
    </code>
    <code name="h4">
        <pattern ignoreCase="true">&lt;h4<junk/>&gt;<var scope="basic"/>&lt;/h4&gt;</pattern>
        <template>&lt;h4&gt;<var/>&lt;/h4&gt;</template>
    </code>
    <code name="h5">
        <pattern ignoreCase="true">&lt;h5<junk/>&gt;<var scope="basic"/>&lt;/h5&gt;</pattern>
        <template>&lt;h5&gt;<var/>&lt;/h5&gt;</template>
    </code>
    <code name="h6">
        <pattern ignoreCase="true">&lt;h6<junk/>&gt;<var scope="basic"/>&lt;/h6&gt;</pattern>
        <template>&lt;h6&gt;<var/>&lt;/h6&gt;</template>
    </code>

    <!-- Paragraphs -->
    <code name="p">
        <pattern ignoreCase="true">&lt;p<junk/>&gt;<var name="content" inherit="true"/>&lt;/p&gt;</pattern>
        <template>&lt;p&gt;<var name="content"/>&lt;/p&gt;</template>
    </code>
    <code name="hr">
        <pattern ignoreCase="true">&lt;hr<junk/>/&gt;</pattern>
        <template>&lt;hr/&gt;</template>
    </code>
    <code name="div">
        <pattern ignoreCase="true">&lt;div<junk/>&gt;<var inherit="true"/>&lt;/div&gt;</pattern>
        <template>&lt;div&gt;<var/>&lt;/div&gt;</template>
    </code>
    <code name="span">
        <pattern ignoreCase="true">&lt;span<junk/>&gt;<var inherit="true"/>&lt;/span&gt;</pattern>
        <template>&lt;span&gt;<var/>&lt;/span&gt;</template>
    </code>

    <!-- Simple formatting -->
    <code name="bold">
        <pattern ignoreCase="true">&lt;b<junk/>&gt;<var name="content" inherit="true"/>&lt;/b&gt;</pattern>
        <template>&lt;b&gt;<var name="content"/>&lt;/b&gt;</template>
    </code>
    <code name="u">
        <pattern ignoreCase="true">&lt;u<junk/>&gt;<var name="content" inherit="true"/>&lt;/u&gt;</pattern>
        <template>&lt;u&gt;<var name="content"/>&lt;/u&gt;</template>
    </code>
    <code name="s">
        <pattern ignoreCase="true">&lt;s<junk/>&gt;<var name="content" inherit="true"/>&lt;/s&gt;</pattern>
        <template>&lt;s&gt;<var name="content"/>&lt;/s&gt;</template>
    </code>
    <code name="i">
        <pattern ignoreCase="true">&lt;i<junk/>&gt;<var name="content" inherit="true"/>&lt;/i&gt;</pattern>
        <template>&lt;i&gt;<var name="content"/>&lt;/i&gt;</template>
    </code>

    <!-- Insert image -->
    <code name="img">
        <pattern ignoreCase="true">&lt;img <junk/>src=&quot;<var name="protocol" regex="((ht|f)tps?:|\.{1,2})?"/>/<var name="addr" scope="safeXml"/>&quot;<junk/>&gt;</pattern>
        <template>&lt;img src=&quot;<var name="protocol"/>/<var name="addr"/>&quot;/&gt;</template>
    </code>

    <!-- HTTP, HTTPS, FTP, MAILTO -->
    <code name="url1">
        <pattern ignoreCase="true">&lt;a <junk/>href=&quot;<url local="true"/>&quot;<junk/>&gt;<var name="text" scope="url"/>&lt;/a&gt;</pattern>
        <template>&lt;a href=&quot;<var name="url"/>&quot;&gt;<var name="text"/>&lt;/a&gt;</template>
    </code>

    <!-- Quote block -->
    <code name="quote" priority="1">
        <pattern ignoreCase="true">&lt;blockquote<junk/>&gt;<var name="content" inherit="true"/>&lt;/blockquote&gt;</pattern>
        <template>&lt;blockquote&gt;<var name="content"/>&lt;/blockquote&gt;</template>
    </code>

    <!-- Quote code block -->
    <code name="pre">
        <pattern ignoreCase="true">&lt;pre<junk/>&gt;<var name="content" inherit="true"/>&lt;/pre&gt;</pattern>
        <template>&lt;pre&gt;<var name="content"/>&lt;/pre&gt;</template>
    </code>
    <code name="code">
        <pattern ignoreCase="true">&lt;code<junk/>&gt;<var name="content" inherit="true"/>&lt;/code&gt;</pattern>
        <template>&lt;code&gt;<var name="content"/>&lt;/code&gt;</template>
    </code>

    <!-- Lists -->
    <code name="ol">
        <pattern ignoreCase="true">&lt;ol<junk/>&gt;<var scope="list"/>&lt;/ol&gt;</pattern>
        <template>&lt;ol&gt;<var/>&lt;/ol&gt;</template>
    </code>
    <code name="ul" priority="1">
        <pattern ignoreCase="true">&lt;ul<junk/>&gt;<var scope="list"/>&lt;/ul&gt;</pattern>
        <template>&lt;ul&gt;<var/>&lt;/ul&gt;</template>
    </code>

    <scope name="list" ignoreText="true">
        <code name="li">
            <pattern ignoreCase="true">&lt;li<junk/>&gt;<var scope="html"/>&lt;/li&gt;</pattern>
            <template>&lt;li&gt;<var/>&lt;/li&gt;</template>
        </code>
    </scope>

    <code name="dl">
        <pattern ignoreCase="true">&lt;dl<junk/>&gt;<var scope="dlist"/>&lt;/dl&gt;</pattern>
        <template>&lt;dl&gt;<var/>&lt;/dl&gt;</template>
    </code>
    <scope name="dlist">
        <code name="dt">
            <pattern ignoreCase="true">&lt;dt<junk/>&gt;<var scope="html"/>&lt;/dt&gt;</pattern>
            <template>&lt;dt&gt;<var/>&lt;/dt&gt;</template>
        </code>
        <code name="dd">
            <pattern ignoreCase="true">&lt;dd<junk/>&gt;<var scope="html"/>&lt;/dd&gt;</pattern>
            <template>&lt;dd&gt;<var/>&lt;/dd&gt;</template>
        </code>
    </scope>

    <!-- Table -->
    <code name="table">
        <pattern ignoreCase="true">&lt;table<junk/>&gt;<var scope="tableScope"/>&lt;/table&gt;</pattern>
        <template>&lt;table&gt;<var/>&lt;/table&gt;</template>
    </code>

    <scope name="tableScope" parent="tableBlock" ignoreText="true">
        <code name="caption">
            <pattern ignoreCase="true">&lt;caption<junk/>&gt;<var scope="safeXml"/>&lt;/caption&gt;</pattern>
            <template>&lt;caption&gt;<var/>&lt;/caption&gt;</template>
        </code>
        <code name="thead">
            <pattern ignoreCase="true">&lt;thead<junk/>&gt;<var scope="tableBlock"/>&lt;/thead&gt;</pattern>
            <template>&lt;thead&gt;<var/>&lt;/thead&gt;</template>
        </code>
        <code name="tbody">
            <pattern ignoreCase="true">&lt;tbody<junk/>&gt;<var scope="tableBlock"/>&lt;/tbody&gt;</pattern>
            <template>&lt;tbody&gt;<var/>&lt;/tbody&gt;</template>
        </code>
        <code name="tfoot">
            <pattern ignoreCase="true">&lt;tfoot<junk/>&gt;<var scope="tableBlock"/>&lt;/tfoot&gt;</pattern>
            <template>&lt;tfoot&gt;<var/>&lt;/tfoot&gt;</template>
        </code>
    </scope>

    <scope name="tableBlock" ignoreText="true">
        <code name="tr">
            <pattern ignoreCase="true">&lt;tr<junk/>&gt;<var scope="tableRow"/>&lt;/tr&gt;</pattern>
            <template>&lt;tr&gt;<var/>&lt;/tr&gt;</template>
        </code>
    </scope>

    <scope name="tableRow" ignoreText="true">
        <code name="th">
            <pattern ignoreCase="true">&lt;th<junk/>&gt;<var scope="html"/>&lt;/th&gt;</pattern>
            <template>&lt;th&gt;<var/>&lt;/th&gt;</template>
        </code>
        <code name="td">
            <pattern ignoreCase="true">&lt;td<junk/>&gt;<var scope="html"/>&lt;/td&gt;</pattern>
            <template>&lt;td&gt;<var/>&lt;/td&gt;</template>
        </code>
    </scope>
</configuration>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy