Skip to content

Commit

Permalink
columnbreak macro: metanorma/metanorma-bsi#448
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Oct 17, 2023
1 parent 49b8ca9 commit cfdcafd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/metanorma/standoc/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Converter
treeprocessor Metanorma::Standoc::ToDoInlineAdmonitionBlock
block Metanorma::Standoc::PlantUMLBlockMacro
block Metanorma::Standoc::PseudocodeBlockMacro
block_macro Metanorma::Standoc::ColumnBreakBlockMacro
end

include ::Asciidoctor::Converter
Expand Down
9 changes: 9 additions & 0 deletions lib/metanorma/standoc/macros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ def process(_document, reader)
end
end

class ColumnBreakBlockMacro < Asciidoctor::Extensions::BlockMacroProcessor
use_dsl
named :columnbreak

def process(parent, _reader, _attrs)
create_pass_block parent, "<columnbreak/>", {}, subs: nil
end
end

# refer https://github.com/asciidoctor/asciidoctor/blob/main/lib/asciidoctor/substitutors.rb
# Not using TreeProcessor because that is still too close to
# inline expressions being processed on access (e.g. titles)
Expand Down
3 changes: 3 additions & 0 deletions spec/metanorma/macros_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
date:[2012-03-04,%a-%b%s]
date:[2012-03-04]
columnbreak::[]
[bibliography]
== Bibliography
* [[[ref1,XYZ 123]]] _Title_
Expand Down Expand Up @@ -44,6 +46,7 @@
<span class='category'>text</span>
<date format="%a-%b%s" value="2012-03-04"/>
<date format="%F" value="2012-03-04"/>
<columnbreak/>
</foreword>
</preface>
<sections> </sections>
Expand Down

0 comments on commit cfdcafd

Please sign in to comment.