by -DePiep (talk) 18:15, 3 April 2020 (UTC) Input string has nested span tags. Current Module:Plain text does not handle these as expected. See Template:Plain text/testcases: output is blank.

In Module:Plain text/sandbox I have simply repeated the stripping line :gsub('<span.->(.-)</span>', '%1'). That works as expected & intended.


Case background: {{Val}} formats compound numbers, and also adds tags like:

{{Val|123.45|7}}123.45±7
<span class="nowrap"><span data-sort-value="7002123450000000000♠"></span>123.45<span style="margin-left:0.3em;margin-right:0.15em;">±</span>7</span>

Nesting the module or template call in-page does not solve it.

I propose to consider implementation of this sandbox trial.

PRoBLEM with sandbox: triple nestings go wrong

Basic test
{{Plain text|1=<span style="background:pink">123.56</span>}}

{{Plain text}}

123.56

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

nested spans
{{Plain text|1=<span class="nowrap"><span style="background:pink">123.56</span></span>}}

{{Plain text}}


{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

Test use Val
{{Plain text|1=<span class="nowrap"><span data-sort-value="7002123560000000000♠"></span>123.56</span>}}

{{Plain text}}


{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

Test compound val
{{Plain text|1=<span class="nowrap"><span data-sort-value="7002123450000000000♠"></span>123.45<span style="margin-left:0.3em;margin-right:0.15em;">±</span>7</span>}}

{{Plain text}}


{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

Triple nested span
{{Plain text|1=<span class="nowrap"><span style="background:pink"><span data-sort-value="7002123450000000000♠"></span>123.45<span style="margin-left:0.3em;margin-right:0.15em;">±</span>7</span></span>}}

{{Plain text}}

123.45±7

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

Triple nested span2
{{Plain text|1=<span class="nowrap"><span style="background:pink"><span data-sort-value="7002123450000000000"></span>123.45<span style="margin-left:0.3em;margin-right:0.15em;">±</span>7</span></span>}}

{{Plain text}}

123.45±7

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

nowiki removal
{{Plain text|Hi I am nowiki text}}

{{Plain text}}


{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

Test having div tag
{{Plain text|1=<div><span class="nowrap"><span data-sort-value="7002123560000000000♠"></span>123.56</span></div>}}

{{Plain text}}

123.56

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

anther single span
{{Plain text|1=<span class="nowrap">123.56</span>}}

{{Plain text}}

123.56

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.


piped link
{{Plain text|[[Main Page|Wikipedia's Main Page]]}}

{{Plain text}}

Wikipedia's Main Page

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

external link
{{Plain text|[https://en.wikipedia.org External link to wikipedia]}}

{{Plain text}}

https://en.wikipedia.org External link to wikipedia

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

wikilinks and external links
{{Plain text|[[Main page]] | [[Main Page|Wikipedia's Main Page]] | [https://en.wikipedia.org] | [https://en.wikipedia.org External link to wikipedia]}}

{{Plain text}}

Main page | Wikipedia's Main Page | https://en.wikipedia.org | https://en.wikipedia.org External link to wikipedia

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

encode
{{Plain text|'1"2"3'|encode=true}}

{{Plain text}}

'1"2"3'

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.


underlines
{{Plain text|<u>foo bar</u>}}

{{Plain text}}


{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

subscript
{{Plain text|H<sub>2</sub>O}}

{{Plain text}}

HO

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

superscript
{{Plain text|<sup>3</sup>H}}

{{Plain text}}

H

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.

ref tags
{{Plain text|H[1]}}

{{Plain text}}

H

{{Plain text/sandbox}}

අක්ෂර දෝෂය: සැබෑ මොඩියුලක් නොමැත.


  1. ^ Reference text
"https://si.wikipedia.org/w/index.php?title=සැකිල්ල:Plain_text/testcases&oldid=678570" වෙතින් සම්ප්‍රවේශනය කෙරිණි