SectionEnumerator-class: Reference class for automatically enumerating section titles

Description Details Fields Methods

Description

The level of a Markdown section headers is indicated using hashes in front of the title. YAML frontmatter allows for to specify section header numbering, but it is not clear how to mix headers with and without numbers in the same document. The SectionEnumerator reference class allows us to specify section header numbers only for certain titles.

Details

The main method of a SectionEnumerator reference object is displayNumSection. This takes as input a string of an unnumbered section, parses that string and computes the section number based on the number of hashes. For some reason, the option number_sections = FALSE does not work for top level sections, but it only works for subsections. As a work-around, all sections are moved down one level to subsections by ignoring a given number of nNrExtraHash hash signs. Hence a subsection will be numbered as a section and a subsubsection will be numbered as a subsection etc.

Fields

sUnNumSection

original ununmbered section string

rcSectionCount

reference object representing section count

sHash

hashes of caption

sRemCaption

remaining caption after removing hashes

sNumCaptionResult

resulting caption string with number

sSectionSplit

split character between number and title

nNrExtraHash

number of extra hashes not used for section counts

Methods

displayNumSection(psUnNumSection = NULL, pnNrExtraHash = NULL)

Parsing of unnumbered section string and display the string including the section number

initialize()

Initalisation of object fields

parseUnNumSection()

Parse the unnumbered section string and assign the object fields

setUnNumSection(psUnNumSection)

Setter for unnumbered section string


pvrqualitasag/rqudocuhelper documentation built on May 26, 2019, 11:34 a.m.