# Force the test runner to ensure the extension is loaded !! hooks section !! endhooks !! functionhooks lst lstx !!endfunctionhooks # This is the standard article assumed to exist. !! article Sections !! text 1
sec 1
2
sec 2
3
sec 3
a
sec a
...
!! endarticle #test to see what happens when we don't use LST. !!test LST: Normal rendering !!input begin
middle
end !!result

begin middle end

!!end !!test LST: Normal (non-labelled) transclusion !!input {{:sections}} !!result

1 sec 1

2 sec 2

3 sec 3

a sec a

...

!!end !!test LST: Transclude a section (#lst) !!input {{#lst:sections|1}} !!result

sec 1

!!end !!test LST: Transclude a section (#section) !!input {{#section:sections|1}} !!result

sec 1

!!end !!test LST: Substitute a section !!options pst !!input {{subst:#lst:sections|1}} !!result sec 1 !!end !!test LST: Substitute a section with quoted attributes !!input {{#lst:sections|2}} !!result

sec 2

!!end !!test LST: Substitute a section with an optional / !!input {{#lst:sections|3}} !!result

sec 3

!!end !!test LST: multiple sections with the same name !!input {{#lst:sections|a}} !!result

sec a...

!!end !!test LST: Transclude range of sections !!input {{#lst:sections|1|3}} !!result

sec 1

2 sec 2

3 sec 3

!!end !!test LST: Exclude a section !!input {{#lstx:sections|1}} !!result

1

2 sec 2

3 sec 3

a sec a

...

!!end !!test LST: Exclude a range !!input {{#lstx:sections|1||3}} !!result

1

a sec a

...

!!end !!test LST: Replace a section !!input {{#lstx:sections|1|one}} !!result

1 one

2 sec 2

3 sec 3

a sec a

...

!!end !!test LST: Replace multiple sections !!input {{#lstx:sections|a|A}} !!result

1 sec 1

2 sec 2

3 sec 3

a A

A

!!end !!test LST: Replace a range !!input {{#lstx:sections|1|test|3}} !!result

1 test

a sec a

...

!!end !!article template:sub !!text <section {{{1}}}=test/> !!endarticle !!test LST: Substitute a tag from a template !!options pst noxml !!input {{subst:sub|begin}} !!result
!!end !!article sub !!text begin {{subst:sub|begin}}middle{{subst:sub|end}} end !!endarticle !!test LST: Indirect substitution !!input {{#lst:sub|test}} !!result

middle

!!end !!article nest !!text
I am outer
inner
!!endarticle !!test LST: Nested sections - inner section marks removed by tag hook. !!input {{#lst:nest|outer}} !!result

I am outer

inner


!!end !!test LST: red link from nonexistent article !!input {{#lst:no such article|anything}} !!result

No such article

!!end # Note: MW <= 1.8 uses a different section header format. In these versions, the header out will look like this instead: #

section

!!article headings !!text
==section== blah
==section2== blah
!!endarticle !!test LST: Transcluded section headings create edit link to template !!input {{#lst:headings|head}} !!result

section[edit]

blah

!!end !!test LST: Transcluded section headings create edit link to right section (mw 1.9r18218) !!input {{#lst:headings|head2}} !!result

section2[edit]

blah

!!end !!article lst_head_bounds !!text === =2=
=3= hi =4=
=head4= !!endarticle !!test LST: more sensitive test for heading count boundaries. !!input {{#lst:lst_head_bounds|s}} !!result

3[edit]

hi

4[edit]

!!end !!test LST: Nick's bogus input !!input {{#lstx: {|}} !!result !!end !!article lst_javascript !!text
!!endarticle !!test LST: javascript !!input {{#lst:lst javascript|ownage}} !!result

<script>alert("Ownage!");</script>

!!end !!article slash !!text
slash
!!endarticle !!test LST: regexp special chars in section name !!input {{#lst:Slash|/}} !!result

slash

!!end # We can't use the simplest case where the article transcludes itself # from a regression test (bug 8158). This test will segv if the cycle # detection code in the extension fails. !!article cycle !!text
{{#lst:cycle|cycle}}
!!endarticle !!test LST: cycle detection !!options !!input {{#lst:cycle|cycle}} !!result

Template loop detected: Cycle

!!end #make sure we can still multiply-transclude (that is, path is cleared) !!test LST: multiple transclude !!input {{#lst:sections|1}} {{#lst:sections|1}} !!result

sec 1 sec 1

!!end !!test LST: transclude nonexistent section !!input {{#lst:sections|9999}} !!result !!end !!article LST-alt !!text
caps
junk
!!endarticle !!test LST: alternate caps !!input {{#section:LST-alt|1}} !!result

caps

!!end !!test LST: useless options !!input {{#section:LST-alt|2}} !!result

junk

!!end !!article fromsection !!text Before...
SectionA
SectionB
SectionC
...After !!endarticle !!test LST: inclusion starting at a specified section till the end of article !!options !!input {{#lst:fromsection|B|}} !!result

SectionB SectionC ...After

!!end !!article tosection !!text Before...
SectionA
SectionB
SectionC
...After !!endarticle !!test LST: inclusion from beginning of article to a specified section !!options !!input {{#lst:tosection||B}} !!result

Before... SectionA SectionB

!!end !! article status !! text
c
sec a
sec b
sec c
!! endarticle !!test LST: Allow subtransclusion in lst argument (bug 42481) !!input {{#lst:status|latest}}: {{#lst:status|{{#lst:status|latest}}}} !!result

c: sec c

!!end !!article selfinclusion1 !!text
Section A begin {{#lst:selfinclusion2|B}} Section A end
!!endarticle !!article selfinclusion2 !!text
Section B begin {{#lst:selfinclusion1|A}} Section B end
!!endarticle !!test LST: verify self-inclusion fails !!options !!input {{#lst:selfinclusion1|A}} !!result

Section A begin

Section B begin Template loop detected: Selfinclusion1 Section B end

Section A end

!!end !!article redirected !!text #REDIRECT[[Sections]] !!endarticle !!test LST: Transclude a section via a redirect !!input {{#lst:redirected|1}} !!result

sec 1

!!end !!article noinclude !!text before
sec a
after !!endarticle !!test LST: Noinclude tags should not be included - start at section !!input {{#lst:noinclude|a|}} !!result

sec a

!!end !!test LST: Noinclude tags should not be included - end at section !!input {{#lst:noinclude||a}} !!result

sec a

!!end !!article User:DifferentNamespace/subpage !!text
sec a
!!endarticle !!test LST: Transclusion from subpage in a non-standard namespace !!input {{#lst:User:DifferentNamespace/subpage|a}} !!result

sec a

!!end