Content Numbering

Last modified by Vincent Massol on 2024/02/26 17:57

 XWiki
 Design
 Completed
 

https://design.xwiki.org/xwiki/bin/view/Proposal/ParagraphNumbering

Description

This design page generalize over Paragraph Numbering to also include heading and figure numbering, while preserving a common technical framework.

Numbered Content

Common Requirements

This section lists the requirements that are applicable on all the numbered contents.

  • The numbers must be visible in View, Edit, Print and PDF Export.

Common Architecture

Numbered Headings

= Heading 1 =

Paragraph 1.

= Heading 2 =

== Heading 2.1 ==

Paragraph 2.

(% start="10" %)
= Heading 10 =

== Heading 10.1 ==

Paragraph 10, headings 3 to 9 are skipped.

Requirements

  • All headings in a document to be numbered when the functionality is activated in a given document
  • Numbering level based on heading level, each new level starting at 1. E.g 1.1 or 1.1.1
  • Automatic sequential numbering
  • There is no need to be able to override the automatic numbering sequence, although it would be nice to have.
  • Numbers should be visible in View, WYSIWYG Edit, PDF Export and print.

Limitations

  • The headings must be located at the root of the document, and shouldn't be located at lower levels, otherwise the numbering might be wrong on edit mode

Architecture

Activation

Numbered headings is activated when the closed instance of NumberedHeadings.Code.NumberedHeadingsClass found in the Page hierarchy has an activation property set to true.

NumberedHeadings.Code.NumberedHeadingsClass

Properties:

  • activation: boolean
User Interface

A section is proposed in the Information tab of the documents, with a checkbox "Activate Numbered Paragraphs".
When checked, a NumberedHeadings.Code.NumberedHeadingsClass XObject is created in the current document.
When unchecked, the NumberedHeadings.Code.NumberedHeadingsClass XObject is removed from the document.

  • How to make it exclusive with Activate Paragraph Numbering? Keep using a macro wrapper for Paragraph Numbering?
  • Do we need warn the user that this will also impact the children of the current page?
CKEditor plugins
Heading level change on tab

Pressing tab/shift+tab when the cursor is on a header changes the heading level. Pressing tab increases the heading level (until the heading level is 6), Pressing shift+tab decreases the heading level. When the heading is level 1, the content is transform to a "normal" content. Pressing tab on a "normal" content does nothing and changing the format back to heading must be done using the format menu at the top left of the editor bar.

Right-click to change the start value

By default, the numbers start at 1 and are incremented on each new header of the same level. Pressing right click on a header propose a modal with a field to set a new start value for the paragraph.

Numbered Paragraphs

= Paragraph 1 =

More content on Paragraph 1.

= Paragraph 2 =

(% start="10" %)
= Paragraph 10 =

== Paragraph 10.1, paragraphs 3 to 9 are skipped. ==

Requirements

  • Provide a template to create a Page with paragraph numbering (document with the wrapping macro already inserted and = = as its content)

Numbered Figures

Requirements

Content Reference

Requirements

Table of Content

Requirements

The table of content must gather the heading of the page and list (the level in the list correspond to the heading level).

  • The headings are expected to be numbered when rendered
  • A filter must allow to:
    • Standardize the case
    • Remove trailing special characters (i.e., ':')

 

Tags:
    

Get Connected