Skip to content

Commit

Permalink
Create a new admonition for version
Browse files Browse the repository at this point in the history
- VERSION to indicate version info inside sections. When further
  descriptions are needed, authors can use this admonition.
- Create style directory and put config files in it.
- Adjust Makefile
  • Loading branch information
hirotnk authored and happi committed Apr 22, 2020
1 parent d37b96f commit 2eb843b
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 9 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ beam-book.pdf: xml/beam-book-from-ab.xml

### Experimental pdf command
beam-book2.pdf: chapters/opcodes_doc.asciidoc book.asciidoc chapters/*.asciidoc chapters/contributors.txt
asciidoctor-pdf -r ./custom-pdf-converter.rb -r asciidoctor-diagram -a config=ditaa.cfg --doctype book -a media=prepress -a pdf-style=pdf-theme.yml book.asciidoc -o $@
cp -r images/*.png site/images
asciidoctor-pdf -r ./style/custom-pdf-converter.rb -r asciidoctor-diagram -r ./style/custom-admonition-block.rb -a config=./style/ditaa.cfg --doctype book -a media=prepress -a pdf-style=./style/pdf-theme.yml book.asciidoc -o $@

index.html:
asciidoctor -r asciidoctor-diagram -a config=ditaa.cfg --backend=html5 --doctype=book -o site/index.html book.asciidoc
asciidoctor -r asciidoctor-diagram -r ./style/custom-admonition-block.rb -a config=style/ditaa.cfg --backend=html5 --doctype=book -o site/index.html book.asciidoc --trace
cp -r images/*.png site/images

code/book/ebin/generate_op_doc.beam: code/book/src/generate_op_doc.erl
Expand All @@ -33,3 +34,4 @@ genop.tab:

clean:
rm -f beam-book.pdf site/index.html site/*.png site/*.md5 xml/*.png xml/*.md5 xml/beam-book-from-ab.xml
rm -f beam-book2.pdf site/images/*.png
Binary file added beam-book2.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion book.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:sectlinks:
:!compat-mode:
:source-highlighter: rouge
:imagesdir: images
:imagesdir: site/images
:ditaa-shadows: false
:ditaa-transparent: true

Expand Down
2 changes: 1 addition & 1 deletion chapters/scheduling.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ there is no way to loop forever without doing a function call.
Each function call is counted as a `reduction`; when the reduction
limit for the process is reached it is suspended.

[NOTE]
[VERSION]
.Version Info
====
Prior to OTP-20.0, the value of `CONTEXT_REDS` was 2000.
Expand Down
30 changes: 30 additions & 0 deletions style/custom-admonition-block.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require 'asciidoctor/extensions'

class VersionBlock < Asciidoctor::Extensions::BlockProcessor
use_dsl
named :VERSION
on_context :example

def process parent, reader, attrs
attrs['name'] = 'version'
attrs['caption'] = 'version'
admon = create_block parent, :admonition, nil, attrs, content_model: :compound
parse_content admon, reader
admon
end
end

class VersionBlockCss < Asciidoctor::Extensions::DocinfoProcessor
use_dsl

def process doc
'<style>
.admonitionblock td.icon .icon-version:before{content:"\f02c";color:#900C3F}
</style>'
end
end

Asciidoctor::Extensions.register do
block VersionBlock
docinfo_processor VersionBlockCss
end
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions pdf-theme.yml → style/pdf-theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ admonition:
column_rule_color: $base_border_color
column_rule_width: $base_border_width
padding: [0, $horizontal_rhythm, 0, $horizontal_rhythm]
#icon:
# tip:
# name: far-lightbulb
# stroke_color: 111111
# size: 24
icon:
version:
name: fa-tags
stroke_color: A26D6D
size: 24
label:
text_transform: uppercase
font_style: bold
Expand Down

0 comments on commit 2eb843b

Please sign in to comment.