rehamaltamimi / gwtwiki

Automatically exported from code.google.com/p/gwtwiki
0 stars 0 forks source link

incorrect parsing of Noinclude, includeonly, and onlyinclude #86

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
===== TestInclude =====
{{TestInclude}}
========================

===== Template:TestInclude =====
<includeonly>{| class="wikitable float-right" style="width:30%; 
min-width:250px; max-width:400px; font-size:90%; margin-top:0px;"
|--
! colspan="2" style="background-color:Khaki; font-size:110%;" | 
[[Asteroid]]<br/>{{{Name}}}
|--
|}</includeonly>
========================

===== TestInclude2 =====
{{TestInclude2}}
========================

===== Template:TestInclude2 =====
<onlyinclude><includeonly>{| class="wikitable float-right" style="width:30%; 
min-width:250px; max-width:400px; font-size:90%; margin-top:0px;"
|--
! colspan="2" style="background-color:Khaki; font-size:110%;" | 
[[Asteroid]]<br/>{{{Name}}}
|--
|}</includeonly></onlyinclude>
========================

What is the expected output? What do you see instead?
TestInclude shows the table, TestInclude2 does not, instead it shows the wiki 
text included in <includeonly></includeonly>

What version of the product are you using? On what operating system?
3.0.18 SNAPSHOT

Please provide any additional information below.
https://meta.wikimedia.org/wiki/Help:Template#Noinclude.2C_includeonly.2C_and_on
lyinclude

Original issue reported on code.google.com by nico.kru...@googlemail.com on 24 Apr 2012 at 8:24

GoogleCodeExporter commented 8 years ago
additionally, content included in <noinclude> tags should always be removed, 
even inside includeonly/onlyinclude, see the following example:

===== TestInclude3 =====
{{TestInclude3}}
========================

===== Template:TestInclude3 =====
<includeonly><noinclude>invisible</noinclude>text</includeonly>
========================

this currently renders to "<noinclude>invisible</noinclude>text"

Original comment by nico.kru...@googlemail.com on 24 Apr 2012 at 8:27

GoogleCodeExporter commented 8 years ago
for some (possibly all?) tags, e.g. noinclude, an implicit closing tag is 
assumed at the end of the template. In the following example, "invisible" 
should not appear on the transcluding page, i.e. TestInclude4:

===== TestInclude4 =====
{{TestInclude4}}
========================

===== Template:TestInclude4 =====
Text <noinclude>invisible
========================

Original comment by nico.kru...@googlemail.com on 24 Apr 2012 at 8:39

GoogleCodeExporter commented 8 years ago

Original comment by axelclk@gmail.com on 24 Apr 2012 at 8:23

GoogleCodeExporter commented 8 years ago
TestInclude4 changed with r4727. This changes the bahaviour of a loto of more 
tags.

Original comment by axelclk@gmail.com on 24 Apr 2012 at 8:48

GoogleCodeExporter commented 8 years ago
Tests should work with r4729.

Original comment by axelclk@gmail.com on 27 Apr 2012 at 9:31

GoogleCodeExporter commented 8 years ago

Original comment by axelclk@gmail.com on 27 Apr 2012 at 9:47

GoogleCodeExporter commented 8 years ago
the tests work, thank you
unfortunately I might have expressed myself wrong regarding the removal of 
noinclude contents - to quote from the wiki help:

"Anything between <noinclude> and </noinclude> will be processed and displayed 
only when the page is being viewed directly; it will not be included or 
substituted."

"Text between <includeonly> and </includeonly> will be processed and displayed 
only when the page is being included."

Currently, noinclude contents are removed everywhere but should be retained if 
getRecursionLevel() == 0, e.g. if the template (or transcluded page) is 
rendered directly.

===== TestIncludeMain5 =====
{{TestInclude5}}

--------------

{{:TestInclude5}}
========================
===== Template:TestInclude5 =====
test1<noinclude> noincludetext</noinclude>

<includeonly>includeonlytext<noinclude> noincludetext</noinclude></includeonly>
========================
===== TestInclude5 =====
test1<noinclude> noincludetext</noinclude>

<includeonly>includeonlytext<noinclude> noincludetext</noinclude></includeonly>
========================

Rendering TestIncludeMain5 correctly shows
========================
<p>test1
</p>
<p>includeonlytext
</p>
<hr>
<p>test1
</p>
<p>includeonlytext</p>
========================

but rendering either Template:TestInclude5 or TestInclude5 should show

========================
<p>test1 noincludetext</p>
========================

instead of

========================
<p>test1
</p>
<p>includeonlytext</p>
========================

Original comment by nico.kru...@googlemail.com on 30 Apr 2012 at 9:35

GoogleCodeExporter commented 8 years ago
the whole thing gets more complex with <onlyinclude>:

"With <onlyinclude>wikitext</onlyinclude> on a page, the display of the 
wikitext so surrounded and the rest of the page (except includeonly parts) is 
rendered on the page itself normally.[...]
However, in transclusion, the page gives only the parts within onlyinclude 
blocks."

The onlyinclude demo page will probably be a good test:
https://meta.wikimedia.org/wiki/Help:Template/onlyinclude_demo

Original comment by nico.kru...@googlemail.com on 30 Apr 2012 at 9:38

GoogleCodeExporter commented 8 years ago
Improved with r4867

Original comment by axelclk@gmail.com on 30 Apr 2012 at 1:53

GoogleCodeExporter commented 8 years ago
Added r4868.
Extended the IWikiModel#render() method with a boolean parameter which 
indicates, if the text should be rendered directly in template topic mode.

Original comment by axelclk@gmail.com on 1 May 2012 at 8:26

GoogleCodeExporter commented 8 years ago
FYI,

in AbstractWikiModel this causes infinite loop/stack overflow

public String render(ITextConverter converter, String rawWikiText) {
        return render(converter, rawWikiText);
    }

I think this should be 

public String render(ITextConverter converter, String rawWikiText) {
        return render(converter, rawWikiText, false);
    }

Original comment by dfi...@itmatter.com on 2 May 2012 at 1:25

GoogleCodeExporter commented 8 years ago
Yes you right, i changed with r4933.

Original comment by axelclk@gmail.com on 2 May 2012 at 6:31

GoogleCodeExporter commented 8 years ago
Commited r4998.
Fixed a bug in info.bliki.wiki.filter.Util#indexOfNestedIgnoreCase()

Original comment by axelclk@gmail.com on 9 May 2012 at 8:17

GoogleCodeExporter commented 8 years ago

Original comment by axelclk@gmail.com on 3 Jun 2012 at 10:54

GoogleCodeExporter commented 8 years ago

Original comment by axelclk@gmail.com on 3 Jul 2012 at 5:43