Differences between revisions 38 and 39
Revision 38 as of 2010-04-05 22:29:51
Size: 3010
Editor: RogerHaase
Comment: deleted navigation(siblings); added h1; changed bold text to h2s
Revision 39 as of 2017-10-06 17:51:15
Size: 2978
Editor: RogerHaase
Comment: remove incorrect example, empty 2nd parameter does not default to page name
Deletions are marked like this. Additions are marked like this.
Line 29: Line 29:
All parameters except pagename are optional, but you have to follow the given order! If you want to omit "`heading`", you have to leave the second parameter empty. All parameters except pagename are optional, but you have to follow the given order! Leave the second and third parameters empty if the heading is not wanted and keyword parameters are specified.
Line 41: Line 41:
}}}
 * Add a H2 of 'Foo Bar':
 {{{
<<Include(FooBar, , 2)>>

Include

This macro includes the formatted content of the given local wiki page(s), following recursive includes if encountered. If the recursion generates any cycles, this is detected and prevented!

Usage

  • <<Include(pagename, heading, level, from="regex", to="regex", sort=ascending|descending, items=n, skipitems=n, titlesonly, editlink)>>
  • pagename

    Name of the page to include, if it starts with a caret "^", a regex of pages to include.

    heading
    Text for the generated heading which will link to the included page (optional).
    level
    Level (1..5) of the generated heading (optional).
    from
    Partial include start marker (optional).
    to
    Partial include end marker (optional).
    sort
    Sorting order when pagename is a regex, i.e. starts with a caret (optional).
    items
    Maximum number of pages to include.
    skipitems
    Number of initial pages to skip over (optional).
    titlesonly
    Only include a link to the page, not page content (optional).
    editlink
    add a footer with links to the included page, both normal and edit (optional).

All parameters except pagename are optional, but you have to follow the given order! Leave the second and third parameters empty if the heading is not wanted and keyword parameters are specified.

from and to recognise the pattern in comments as well. So watch out for comments that stop the include unexpectedly.

Examples

  • Include the text of page FooBar in the current paragraph:

    <<Include(FooBar)>>
  • Add a linked H1 of 'Foo Bar' followed by the text:
    <<Include(FooBar,"Foo Bar" )>>
  • Add a H2 of 'All about Foo Bar':
    <<Include(FooBar, 'All about Foo Bar', 2)>>
  • Only include content after first horizontal rule:
    <<Include(FooBar, , from="^----$")>>
  • Only include content until first horizontal rule:
    <<Include(FooBar, , to="^----$")>>
  • Sort the page list in descending order:
    <<Include(^FooBar/.*, , sort=descending)>>
  • Include a maximum of three pages:
    <<Include(^FooBar/.*, , items=3)>>
  • Show at most a week of a blog:
    <<Include(^BlogBase/.*,, to="^----$", sort=descending, items=7)>>
  • Show the previous week with titles only:
    <<Include(^BlogBase/.*,, to="^----$", sort=descending, items=7, skipitems=7, titlesonly)>>
  • You can use these with ../MonthCalendar for blogging:

    • Show 3 items out of a month calendar:
      <<Include(^FirstnameLastname/20..-..-..,,to="^----",sort=descending,items=3)>>
    • Show next 4 items only with titles:
      <<Include(^FirstnameLastname/20..-..-..,,to="^----",sort=descending,items=4,skipitems=3,titlesonly)>>

MoinMaster: HelpOnMacros/Include (last edited 2017-10-06 17:51:15 by RogerHaase)