Actions

Template

Difference between revisions of "Striphtml"

From NEC Retro

(Created page with "<includeonly>{{#vardefine:txtout|{{{1|}}}}}{{#ifeq: {{{removediv|}}} | yes | {{#while: |{{#pos:{{#var:txtout}}|<div}} |{{#vardefine:txtout| {{#explode:{{#var:txtout}}|<div|0}}...")
 
m (Text replacement - "Category:NEC Retro templates" to "Category:Templates")
 
Line 21: Line 21:
 
{{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.}}
 
{{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.}}
  
[[Category:NEC Retro templates]]
+
[[Category:Templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 14:20, 1 January 2022

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.