!! hooks
pages
!! endhooks

!!article
MediaWiki:Proofreadpage pagenum template
!!text
[[{{{page}}}|{{{num}}}]]
!!endarticle

!!article
MediaWiki:Proofreadpage header template
!!text
{{{title}}} -- {{{author}}}
{{{from}}} -- {{{to}}}
{{{prev}}} -- {{{next}}}
!!endarticle

!!article
Index:Test
!!text
{{
|Title=Title
|Pages=[[Page:Test 1.jpg|TOC]] [[Page:Test 2.tiff|1]] [[Page:Test 3.png|2]]
|Author=[[Author:Me]]
|TOC=* [[Test/Chapter 1]]
* [[Test/Chapter 2|Chapter 2]]
* [[Test/Chapter 3|Chapter 3]]
}}
!!endarticle

!!article
Index:LoremIpsum.djvu
!!text
{{
|Title=Lorem Ipsum
|Pages=<pagelist 1to1=roman 2to2=highroman to=2/> <pagelist from=3 3=1 5=empty />
|Author=[[Author:Me]]
|TOC=* [[Test/Chapter 1]]
* [[Test/Chapter 2|Chapter 2]]
* [[Test/Chapter 3|Chapter 3]]
}}
!!endarticle

!!article
Page:Test 1.jpg
!!text
Test 1
!!endarticle

!!article
Page:Test 2.tiff
!!text
Test 2
!!endarticle

!!article
Page:Test 3.png
!!text
<nowiki />

Test 3
!!endarticle

!!article
Page:LoremIpsum.djvu/1
!!text
Page 1
!!endarticle

!!article
Page:LoremIpsum.djvu/2
!!text
<nowiki />

Page 2
!!endarticle

!!article
Page:LoremIpsum.djvu/3
!!text
Page 3
!!endarticle

!!article
Page:LoremIpsum.djvu/4
!!text
Page 4
!!endarticle

!!article
Author:Me
!!text
!!endarticle

!!article
Test/Chapter 1
!!text
!!endarticle

!!article
Test/Chapter 2
!!text
!!endarticle

!!article
Test/Chapter 3
!!text
!!endarticle

!! test
pages: without index
!! wikitext
<pages />
!! html
<p><strong class="error">Error: Index expected</strong>
</p>
!! end

!! test
pages: with non existing index
!! wikitext
<pages index="RootOf42" />
!! html
<p><strong class="error">Error: No such index</strong>
</p>
!! end

!! test
pages: without file: Simple transclusion
!! wikitext
<pages index="Test" from="Test 1.jpg" to="Test 3.png" />
!! html
<div>
<p><span><a href="/wiki/Page:Test_1.jpg" title="Page:Test 1.jpg">TOC</a></span>Test 1&#32;<span><a href="/wiki/Page:Test_2.tiff" title="Page:Test 2.tiff">1</a></span>Test 2&#32;<span><a href="/wiki/Page:Test_3.png" title="Page:Test 3.png">2</a></span>
</p><p>Test 3&#32;
</p>
</div>

!! end

!! test
pages: without file: Simple transclusion without from
!! wikitext
<pages index="Test" to="Test 2.tiff" />
!! html
<div>
<p><span><a href="/wiki/Page:Test_1.jpg" title="Page:Test 1.jpg">TOC</a></span>Test 1&#32;<span><a href="/wiki/Page:Test_2.tiff" title="Page:Test 2.tiff">1</a></span>Test 2&#32;
</p>
</div>

!! end

!! test
pages: without file: Simple transclusion without to
!! wikitext
<pages index="Test" from="Test 2.tiff" />
!! html
<div>
<p><span><a href="/wiki/Page:Test_2.tiff" title="Page:Test 2.tiff">1</a></span>Test 2&#32;<span><a href="/wiki/Page:Test_3.png" title="Page:Test 3.png">2</a></span>
</p><p>Test 3&#32;
</p>
</div>

!! end

!! test
pages: without file: Header
!! options
title="Test/Chapter 2"
!! wikitext
<pages index="Test" from="Test 1.jpg" to="Test 2.tiff" header=1 />
!! html
<div>
<p>Title -- <a href="/wiki/Author:Me" title="Author:Me">Author:Me</a>
TOC -- 1
<a href="/wiki/Test/Chapter_1" title="Test/Chapter 1">Test/Chapter 1</a> -- <a href="/wiki/Test/Chapter_3" title="Test/Chapter 3">Chapter 3</a><span><a href="/wiki/Page:Test_1.jpg" title="Page:Test 1.jpg">TOC</a></span>Test 1&#32;<span><a href="/wiki/Page:Test_2.tiff" title="Page:Test 2.tiff">1</a></span>Test 2&#32;
</p>
</div>

!! end

!! test
pages: without file: TOC
!! options
title=Test
!! wikitext
<pages index="Test" />
!! html
<div>
<p>Title -- <a href="/wiki/Author:Me" title="Author:Me">Author:Me</a>
{{{from}}} -- {{{to}}}
<a href="/wiki/Test/Chapter_3" title="Test/Chapter 3">Chapter 3</a> -- {{{next}}}
</p>
</div>

!! end

!! test
pages: recursion
!! wikitext
<pages index="Test"><pages index="Test" /></pages>
!! html
<div>
<p>Title -- <a href="/wiki/Author:Me" title="Author:Me">Author:Me</a>
{{{from}}} -- {{{to}}}
<a href="/wiki/Test/Chapter_3" title="Test/Chapter 3">Chapter 3</a> -- {{{next}}}
</p>
</div>

!! end

!! test
pages: with file: Simple transclusion
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" from="4" to="5" />
!! html
<div>
<p><span><a href="/wiki/Page:LoremIpsum.djvu/4" title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;<span><a href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">Page:LoremIpsum.djvu/5</a>&#32;
</p>
</div>

!! end

!! test
pages: with file: Simple transclusion without from
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" to="2" />
!! html
<div>
<p><span><a href="/wiki/Page:LoremIpsum.djvu/1" title="Page:LoremIpsum.djvu/1">i</a></span>Page 1&#32;<span><a href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
</p><p>Page 2&#32;
</p>
</div>

!! end

!! test
pages: with file: Invalid from
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" from="-1" />
!! html
<p><strong class="error">Error: Invalid interval</strong>
</p>
!! end

!! test
pages: with file: Invalid to
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" to="42" />
!! html
<p><strong class="error">Error: Invalid interval</strong>
</p>
!! end

!! test
pages: with file: Simple transclusion without to
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" from="4" />
!! html
<div>
<p><span><a href="/wiki/Page:LoremIpsum.djvu/4" title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;<span><a href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">Page:LoremIpsum.djvu/5</a>&#32;
</p>
</div>

!! end

!! test
pages: with file: step
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" from="3" step=2 />
!! html
<div>
<p><span><a href="/wiki/Page:LoremIpsum.djvu/3" title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;<span><a href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">Page:LoremIpsum.djvu/5</a>&#32;
</p>
</div>

!! end

!! test
pages: with file: Invalid step
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" from="4" step="-1" />
!! html
<p><strong class="error">Error: Numeric value expected</strong>
</p>
!! end

!! test
pages: with file: exclude
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" from="3" exclude=4 />
!! html
<div>
<p><span><a href="/wiki/Page:LoremIpsum.djvu/3" title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;<span><a href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">3</a></span><a href="/index.php?title=Page:LoremIpsum.djvu/5&amp;action=edit&amp;redlink=1" class="new" title="Page:LoremIpsum.djvu/5 (page does not exist)">Page:LoremIpsum.djvu/5</a>&#32;
</p>
</div>

!! end

!! test
pages: with file: include
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" include="1-2,4" />
!! html
<div>
<p><span><a href="/wiki/Page:LoremIpsum.djvu/1" title="Page:LoremIpsum.djvu/1">i</a></span>Page 1&#32;<span><a href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
</p><p>Page 2&#32;<span><a href="/wiki/Page:LoremIpsum.djvu/4" title="Page:LoremIpsum.djvu/4">2</a></span>Page 4&#32;
</p>
</div>

!! end

!! test
pages: with file: invalid include (1)
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" include="2-1,4" />
!! html
<p><strong class="error">Error: Invalid interval</strong>
</p>
!! end

!! test
pages: with file: invalid include (2)
!! options
djvu
!! wikitext
<pages index="LoremIpsum.djvu" include="." />
!! html
<p><strong class="error">Error: Invalid interval</strong>
</p>
!! end

!! test
pages: with file: Header
!! options
djvu
title="Test/Chapter 2"
!! wikitext
<pages index="LoremIpsum.djvu" from="2" to="3" header=1 />
!! html
<div>
<p>Lorem Ipsum -- <a href="/wiki/Author:Me" title="Author:Me">Author:Me</a>
II -- 1
<a href="/wiki/Test/Chapter_1" title="Test/Chapter 1">Test/Chapter 1</a> -- <a href="/wiki/Test/Chapter_3" title="Test/Chapter 3">Chapter 3</a><span><a href="/wiki/Page:LoremIpsum.djvu/2" title="Page:LoremIpsum.djvu/2">II</a></span>
</p><p>Page 2&#32;<span><a href="/wiki/Page:LoremIpsum.djvu/3" title="Page:LoremIpsum.djvu/3">1</a></span>Page 3&#32;
</p>
</div>

!! end

!! test
pages: with file: TOC
!! options
djvu
title=Test
!! wikitext
<pages index="LoremIpsum.djvu" />
!! html
<div>
<p>Lorem Ipsum -- <a href="/wiki/Author:Me" title="Author:Me">Author:Me</a>
{{{from}}} -- {{{to}}}
<a href="/wiki/Test/Chapter_3" title="Test/Chapter 3">Chapter 3</a> -- {{{next}}}
</p>
</div>

!! end



!! hooks
pages
section
!! endhooks

!!article
Index:TestSection
!!text
{{
|Pages=[[Page:TestSection 1|TOC]] [[Page:TestSection 2|1]] [[Page:TestSection 3|2]]
}}
!!endarticle

!!article
Page:TestSection 1
!!text
Test 10
<section begin="Foo"/>
Test 11
<section end="Foo"/>
Test 12
!!endarticle

!!article
Page:TestSection 2
!!text
Test 20
<section begin="Foo"/>
Test 21
<section end="Foo"/>
Test 22
!!endarticle

!!article
Page:TestSection 3
!!text
Test 30
<section begin="Bar"/>
Test 31
<section end="Bar"/>
Test 32
!!endarticle

!! test
pages: fromsection
!! wikitext
<pages index="TestSection" from="TestSection 1" fromsection="Foo" to="TestSection 3" />
!! html
<div>
<p><span><a href="/wiki/Page:TestSection_1" title="Page:TestSection 1">TOC</a></span>
Test 11
</p><p>Test 12&#32;<span><a href="/wiki/Page:TestSection_2" title="Page:TestSection 2">1</a></span>Test 20
</p><p>Test 21
</p><p>Test 22&#32;<span><a href="/wiki/Page:TestSection_3" title="Page:TestSection 3">2</a></span>Test 30
</p><p>Test 31
</p><p>Test 32&#32;
</p>
</div>

!! end

!! test
pages: tosection
!! wikitext
<pages index="TestSection" from="TestSection 2" to="TestSection 3" tosection="Bar" />
!! html
<div>
<p><span><a href="/wiki/Page:TestSection_2" title="Page:TestSection 2">1</a></span>Test 20
</p><p>Test 21
</p><p>Test 22&#32;<span><a href="/wiki/Page:TestSection_3" title="Page:TestSection 3">2</a></span>Test 30
</p><p>Test 31
&#32;
</p>
</div>

!! end

!! test
pages: onlysection
!! wikitext
<pages index="TestSection" from="TestSection 1" to="TestSection 3" onlysection="Foo" />
!! html
<div>
<p><span><a href="/wiki/Page:TestSection_1" title="Page:TestSection 1">TOC</a></span>
Test 11
&#32;<span><a href="/wiki/Page:TestSection_2" title="Page:TestSection 2">1</a></span>
Test 21
&#32;<span><a href="/wiki/Page:TestSection_3" title="Page:TestSection 3">2</a></span>&#32;
</p>
</div>

!! end
