ListResume

Summary: Resume numbered lists interrupted by other markup
Version: 20180312
Prerequisites: JavaScript
Status: Experimental
Maintainer: Petko
Categories: Layout Markup PHP72
Users: +1 (view / edit)
Discussion: ListResume-Talk

Description

Resume ordered/numbered lists interrupted by other markup.

See the Usage examples below and test the recipe on the talk page.

Installation

  • Place list-resume.js into your pmwiki/pub directory.
  • Add to config.php this line:
    $HTMLFooterFmt['list-resume'] = '<script type="text/javascript"
      src="$FarmPubDirUrl/list-resume.js"></script>';

Configuration

No configuration is required.

Usage

In a wiki page, use the wikistyle %list resume% on the first item, on all lists that are connected (including the first list). For example:

# %list resume% item one
# item two

Here some other markup, then the numbering needs to continue.
# %list resume% item three
# item four
# item five
  1. item one
  2. item two

Here some other markup, then the numbering needs to continue.

  1. item three
  2. item four
  3. item five

If you have different lists that each needs to be resumed, place wikistyles with additional keywords like %list resume-name% (case sensitive):

# %list resume-dairy% milk
# yogurt

Note, different list follows.
# %list resume-fruit% apple
# pear
# apricot

Some markup, then the first list resumes.
# %list resume-dairy% cheese
# cream
# cheesecake

Other markup, then the second list resumes.
# %list resume-fruit% ananas
# banana
  1. milk
  2. yogurt

Note, different list follows.

  1. apple
  2. pear
  3. apricot

Some markup, then the first list resumes.

  1. cheese
  2. cream
  3. cheesecake

Other markup, then the second list resumes.

  1. ananas
  2. banana

As you can see, the resumed lists do not need to immediately follow one another. Some of the lists can even be nested in different levels: as long as they have the wikistyle on their first item, their numbering will continue.

Notes

  • The recipe uses JavaScript, the browser of the visitor actually keeps track and calculates the numbers.
  • The wikistyle %list resume% is placed on the first item on all lists that are connected including the first list.
  • The recipe is not compatible with the wikistyle %item value=X%. Connected/resumed lists should not use that wikistyle, the numbering is automatic.

Change log / Release notes

  • 20180312: First public release, ready to be tested.

See also

PITS /
01105  Add %item value=resume% to list processing (Closed, added as Cookbook:ListResume)
PmWiki /
ListStyles  Styles for use in wiki lists
ListStyles-Talk  Discussion of ListStyles

Contributors

Written and maintained by Petko.

Comments

See discussion at ListResume-Talk

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.