Skip to content

Remove HTML#


Description#

Remove HTML (based on Toolkit’s nohtml with some changes)

Snippet#

<mvt:assign name="l.stripped_descrip" value="l.settings:product:descrip" />

<mvt:if expr="('<' IN l.stripped_descrip) AND ('>' IN l.stripped_descrip)">
    <mvt:assign name="l.tag_out" value="''" />
    <mvt:assign name="l.pos" value="1" />
    <mvt:while expr="l.pos LE len(l.stripped_descrip)">
        <mvt:if expr="substring(l.stripped_descrip,l.pos,1) EQ '<'">
            <mvt:while expr="l.pos LE len(l.stripped_descrip)">
                <mvt:if expr="substring(l.stripped_descrip,l.pos,1) EQ '>'">
                    <mvt:whilestop />
                </mvt:if>
                <mvt:assign name="l.pos" value="l.pos + 1" />
            </mvt:while>
        <mvt:else>
            <mvt:assign name="l.tag_out" value="l.tag_out $ substring(l.stripped_descrip,l.pos,1)" />
        </mvt:if>
        <mvt:assign name="l.pos" value="l.pos + 1" />
    </mvt:while>
    <mvt:assign name="l.stripped_descrip" value="l.tag_out"/>
    <mvt:if expr="('<' IN l.stripped_descrip) OR ('>' IN l.stripped_descrip)">
        <mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip,'<','')" />
        <mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip,'>','')" />
    </mvt:if>
<mvt:else>
    <mvt:if expr="('<' IN l.stripped_descrip) OR ('>' IN l.stripped_descrip)">
        <mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip,'<','')" />
        <mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip,'>','')" />
    </mvt:if>
</mvt:if>
<mvt:assign name="l.stripped_descrip" value="ltrim(l.stripped_descrip )" />
<mvt:assign name="l.stripped_descrip" value="rtrim( l.stripped_descrip )" />
<mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip, asciichar(10), '')" />
<mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip, asciichar(13), '')" />
<mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip, asciichar(09), '')" />
<mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip, asciichar(32) $ asciichar(32) $ asciichar(32), ' ')" />
<mvt:assign name="l.stripped_descrip" value="glosub(l.stripped_descrip, asciichar(32) $ asciichar(32), ' ')" />
<mvt:assign name="l.settings:stripped_descrip" value="substring_var(l.stripped_descrip, 1, 160)" />
<meta name="description" content="&mvt:stripped_descrip;" />