module Webgen::ContentProcessor::Fragments
Uses the HTML headers h1, h2, …, h6 (only those with valid IDs) to generate nested fragment nodes.
Constants
- HTML_ATTR_REGEXP
- HTML_HEADER_REGEXP
Public Class Methods
call(context)
Create the nested fragment nodes from the content under the content node but only if there is no associated block or the block is named content
.
create_fragment_nodes(context, sections, parent, si = 1000)
Create nested fragment nodes under parent
from sections
(which can be created using parse_html_headers).
The meta info sort_info
is calculated from the base si
value.
parse_html_headers(content)
Parse the string content
for headers h1
, …, h6
and return the found, nested sections.
Only those headers are used which have an id
attribute set. The method returns a list of arrays with entries 'level, id, title, sub sections' where 'sub sections' is such a list again.