Changeset 40


Ignore:
Timestamp:
Jun 4, 2014, 1:53:22 PM (8 years ago)
Author:
vadim.godunko
Message:

Add support for six levels of headers.

Location:
trunk/forge/source/wiki
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/forge/source/wiki/forge-wiki-block_parsers-headers.adb

    r37 r40  
    4646   HTML5_URI : constant League.Strings.Universal_String
    4747     := League.Strings.To_Universal_String ("http://www.w3.org/1999/xhtml");
    48    H1_Tag    : constant League.Strings.Universal_String
    49      := League.Strings.To_Universal_String ("h1");
     48   H_Tag     : constant
     49     array (Positive range 1 .. 6) of League.Strings.Universal_String
     50       := (League.Strings.To_Universal_String ("h1"),
     51           League.Strings.To_Universal_String ("h2"),
     52           League.Strings.To_Universal_String ("h3"),
     53           League.Strings.To_Universal_String ("h4"),
     54           League.Strings.To_Universal_String ("h5"),
     55           League.Strings.To_Universal_String ("h6"));
    5056
    5157   ----------------------
     
    6773       return Header_Block_Parser is
    6874   begin
    69       return Header_Block_Parser'(Writer => Parameters.Writer);
     75      return
     76        Header_Block_Parser'
     77         (Writer => Parameters.Writer,
     78          Depth  => Integer'Min (Parameters.Markup.Length, 6));
    7079   end Create;
    7180
     
    7988   begin
    8089      Self.Writer.End_Element
    81        (Local_Name    => H1_Tag,
     90       (Local_Name    => H_Tag (Self.Depth),
    8291        Namespace_URI => HTML5_URI);
    8392
     
    115124       (League.Strings.To_Universal_String
    116125         ("^\p{White_Space}* (\=+) \p{White_Space}*"
    117             & " (\P{White_Space}+) \p{White_Space}* \=*$"),
     126            & " (\P{White_Space}.*?) \p{White_Space}* \=*$"),
    118127        2,
    119128        1,
     
    132141   begin
    133142      Self.Writer.Start_Element
    134        (Local_Name    => H1_Tag,
     143       (Local_Name    => H_Tag (Self.Depth),
    135144        Namespace_URI => HTML5_URI);
    136145
  • trunk/forge/source/wiki/forge-wiki-block_parsers-headers.ads

    r36 r40  
    4646
    4747   type Header_Block_Parser is
    48      new Forge.Wiki.Block_Parsers.Abstract_Block_Parser with null record;
     48     new Forge.Wiki.Block_Parsers.Abstract_Block_Parser with record
     49      Depth : Positive;
     50   end record;
    4951
    5052   overriding function Start_Block
Note: See TracChangeset for help on using the changeset viewer.