Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | lithium-markdown: add a "spoiler" span element, marked by double '%' |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
00a97167e592ac0ea5806672b28ff7d7 |
User & Date: | nat 2019-03-03 19:37:00 |
Context
2019-03-04
| ||
19:59 | lithium-spoiler_filters: new filter to rot13-scramble spoiler spans check-in: 2f20876918 user: nat tags: trunk | |
2019-03-03
| ||
19:37 | lithium-markdown: add a "spoiler" span element, marked by double '%' check-in: 00a97167e5 user: nat tags: trunk | |
2017-07-02
| ||
20:05 | lithium-comment_cookie_smaz: improve dictionary check-in: 3a87f98cd6 user: nat tags: trunk | |
Changes
Changes to src/lithium-markdown.adb.
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | package Sx renames Natools.S_Expressions; type Buffer_Access is access Sx.Atom_Buffers.Atom_Buffer; type Buffer_Copy is new Markup.Element_Callback with record Source, Destination : not null Buffer_Access; end record; procedure Append (To : in out Buffer_Access; Text : in String); function Export (Buffer : Sx.Atom_Buffers.Atom_Buffer) return Sx.Atom_Refs.Immutable_Reference; overriding procedure Open (Element : in out Buffer_Copy); overriding procedure Append (Element : in out Buffer_Copy; Text : in String) is null; overriding procedure Close (Element : in out Buffer_Copy) is null; package Renderers is new Markup.Renderers.Html (Buffer_Access); ------------------------------ -- Local Helper Subprograms -- ------------------------------ procedure Append (To : in out Buffer_Access; Text : in String) is pragma Unmodified (To); begin To.Append (Sx.To_Atom (Text)); end Append; function Export (Buffer : Sx.Atom_Buffers.Atom_Buffer) return Sx.Atom_Refs.Immutable_Reference is use type Sx.Offset; Accessor : constant Sx.Atom_Refs.Accessor := Buffer.Raw_Query; | > > > > > > > > > > > > > > > > > > > > > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | package Sx renames Natools.S_Expressions; type Buffer_Access is access Sx.Atom_Buffers.Atom_Buffer; type Buffer_Copy is new Markup.Element_Callback with record Source, Destination : not null Buffer_Access; end record; type Spoiler_Span is new Markup.Element_Callback with record Buffer : Buffer_Access; end record; procedure Append (To : in out Buffer_Access; Text : in String); function Export (Buffer : Sx.Atom_Buffers.Atom_Buffer) return Sx.Atom_Refs.Immutable_Reference; overriding procedure Open (Element : in out Buffer_Copy); overriding procedure Append (Element : in out Buffer_Copy; Text : in String) is null; overriding procedure Close (Element : in out Buffer_Copy) is null; package Renderers is new Markup.Renderers.Html (Buffer_Access); overriding procedure Open (Element : in out Spoiler_Span); overriding procedure Append (Element : in out Spoiler_Span; Text : in String); overriding procedure Close (Element : in out Spoiler_Span); ------------------------------ -- Local Helper Subprograms -- ------------------------------ procedure Append (To : in out Buffer_Access; Text : in String) is pragma Unmodified (To); begin To.Append (Sx.To_Atom (Text)); end Append; overriding procedure Append (Element : in out Spoiler_Span; Text : in String) is begin Element.Buffer.Append (Sx.To_Atom (Text)); end Append; overriding procedure Close (Element : in out Spoiler_Span) is begin Element.Buffer.Append (Sx.To_Atom ("</span>")); end Close; function Export (Buffer : Sx.Atom_Buffers.Atom_Buffer) return Sx.Atom_Refs.Immutable_Reference is use type Sx.Offset; Accessor : constant Sx.Atom_Refs.Accessor := Buffer.Raw_Query; |
︙ | ︙ | |||
77 78 79 80 81 82 83 84 85 86 87 88 89 90 | overriding procedure Open (Element : in out Buffer_Copy) is begin Element.Destination.Soft_Reset; Element.Destination.Append (Element.Source.Data); end Open; ----------------- -- Worker Tasks -- ----------------- | > > > > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | overriding procedure Open (Element : in out Buffer_Copy) is begin Element.Destination.Soft_Reset; Element.Destination.Append (Element.Source.Data); end Open; overriding procedure Open (Element : in out Spoiler_Span) is begin Element.Buffer.Append (Sx.To_Atom ("<span class=""spoiler"">")); end Open; ----------------- -- Worker Tasks -- ----------------- |
︙ | ︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | Parser.Pseudoprotocol_Class (Renderer.Span); Parser.Pseudoprotocol_Id (Renderer.Anchor); Parser.Pseudoprotocol_Raw (Renderer.Raw_Html_Span); Parser.Emphasis (Renderer.Inserted, 2, "+"); Parser.Emphasis (Renderer.Deleted, 2, "-"); Parser.Emphasis (Renderer.Span, 1, "|"); loop Buffer.Soft_Reset; Parsed.Soft_Reset; Summary_Buf.Soft_Reset; Parser.Reset; | > | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | Parser.Pseudoprotocol_Class (Renderer.Span); Parser.Pseudoprotocol_Id (Renderer.Anchor); Parser.Pseudoprotocol_Raw (Renderer.Raw_Html_Span); Parser.Emphasis (Renderer.Inserted, 2, "+"); Parser.Emphasis (Renderer.Deleted, 2, "-"); Parser.Emphasis (Renderer.Span, 1, "|"); Parser.Emphasis (Spoiler_Span'(Buffer => Parsed), 2, "%"); loop Buffer.Soft_Reset; Parsed.Soft_Reset; Summary_Buf.Soft_Reset; Parser.Reset; |
︙ | ︙ | |||
260 261 262 263 264 265 266 267 268 269 270 271 272 273 | Renderer.Table_Data_Cell); Parser.Discount_Fenced_Code_Block (Renderer.Code_Block); Parser.Link (Renderer.Anchor); Parser.Emphasis (Renderer.Inserted, 2, "+"); Parser.Emphasis (Renderer.Deleted, 2, "-"); loop Buffer.Soft_Reset; Parsed.Soft_Reset; Parser.Reset; select | > | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | Renderer.Table_Data_Cell); Parser.Discount_Fenced_Code_Block (Renderer.Code_Block); Parser.Link (Renderer.Anchor); Parser.Emphasis (Renderer.Inserted, 2, "+"); Parser.Emphasis (Renderer.Deleted, 2, "-"); Parser.Emphasis (Spoiler_Span'(Buffer => Parsed), 2, "%"); loop Buffer.Soft_Reset; Parsed.Soft_Reset; Parser.Reset; select |
︙ | ︙ |