Striphtml
From NEC Retro
Revision as of 15:21, 31 December 2021 by Ccawley2011 (talk | contribs) (Created page with "<includeonly>{{#vardefine:txtout|{{{1|}}}}}{{#ifeq: {{{removediv|}}} | yes | {{#while: |{{#pos:{{#var:txtout}}|<div}} |{{#vardefine:txtout| {{#explode:{{#var:txtout}}|<div|0}}...")
Revision as of 15:21, 31 December 2021 by Ccawley2011 (talk | contribs) (Created page with "<includeonly>{{#vardefine:txtout|{{{1|}}}}}{{#ifeq: {{{removediv|}}} | yes | {{#while: |{{#pos:{{#var:txtout}}|<div}} |{{#vardefine:txtout| {{#explode:{{#var:txtout}}|<div|0}}...")
Removes all HTML tags from a string, as well as the content between <div> tags if removediv=yes is set.
Example
{{striphtml|1=<i>Italics</i><div style="border:solid red 1px; background:green;">div content</div>This is <b>bold</b> text,<br>new line.|removediv=yes}}
returns:
Italics This is bold text, new line.
{{striphtml|1=<i>Italics</i><div style="border:solid red 1px; background:green;">div content</div>This is <b>bold</b> text,<br>new line.}}
returns:
Italics div content This is bold text, new line.