Newscoop 4 Cookbook

List subtitles (pagination of long articles)

List of Subtitles

Purpose:

Create a list of subtitles for the content of the article currently defined in the template environment. The article, if not specified somewhere else, is treated as group of paragraphs. The markup for a new paragraph is the subtitle. The code between the "{{ list_subtitles }}" statement and "{{ /list_subtitles }}" is repeated for every subtitle in the list.

Syntax:

{{ list_subtitles [length="<integer_value>"]                   [columns="<integer_value>"] }}    <list_of_instructions> {{ /list_subtitles }} 

Filters:

  • length="<integer_value>": <integer_value> specifies list_length and forces the list to have at most list_length items. If the list contains more items than list_length items the interval of elements to be displayed can be switched using has_previous_elements and has_next_elements from the current_list object
  • columns="<integer_value>": <integer_value> specifies columns_number and sets an environment variable. This is incremented as if the items were placed in a table cell. The counting starts from one and the variable is incremented for every new element. When it reaches the maximum value it is reset to one. This is very useful in building tables of data. For details see current_list

<list_of_instructions> may contain any statement except: "set_language", "set_publication", "list_issues", "set_issue", "list_sections", "set_section", "list_articles", or "set_article".

Inside the list, the data context is defined by the constraints applied to the current article for every processed line. The data context is restored after the list processing.

Constraints:

Inside list_articles the following statements are forbidden:

  • set_language
  • set_default_language
  • unset_language
  • set_publication
  • set_default_publication
  • unset_publication
  • list_issues
  • set_issue
  • set_default_issue
  • set_current_issue
  • unset_issue
  • list_sections
  • set_section
  • set_default_section
  • unset_section
  • list_articles
  • set_article
  • set_default_article
  • unset_article