summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2014-09-03 02:43:49 -0600
committerDan Allen <dan.j.allen@gmail.com>2014-09-04 02:08:31 -0600
commit61ee8fb3eb9baf70eefbcd8f40a596b203c2c77b (patch)
tree24f713d826918ffedcb8bd3bab13356b751edffa /data
parent1fe0fbf82e89058582746f7e3c33cb01f5b455a9 (diff)
resolves #29 rewrite as a proper Asciidoctor converter
- rewrite as a proper Asciidoctor converter - move main code under the Asciidoctor::Pdf module - set version to 1.5.0.dev to track core - update asciidoctor gem to ~> 1.5.0 - migrate to prawn 1.2.1 - add required prawn-table dependency - make asciidoctor-pdf cli a wrapper around asciidoctor cli - move inline node handlers to converter - remove line metrics hacks * replace with padding top/bottom adjustment around prose - evaluate array elements in theme - update themes - update examples - update README - add Asciidoctor PDF version to PDF header - take out prose around image logic (moved to editions) - fix loads of rendering bugs :)
Diffstat (limited to 'data')
-rw-r--r--data/templates/inline_anchor.html.slim16
-rw-r--r--data/templates/inline_button.html.slim1
-rw-r--r--data/templates/inline_footnote.html.slim5
-rw-r--r--data/templates/inline_kbd.html.slim7
-rw-r--r--data/templates/inline_menu.html.slim15
-rw-r--r--data/templates/inline_quoted.html.slim22
-rw-r--r--data/themes/asciidoctor-theme.yml90
-rw-r--r--data/themes/default-theme.yml119
8 files changed, 145 insertions, 130 deletions
diff --git a/data/templates/inline_anchor.html.slim b/data/templates/inline_anchor.html.slim
deleted file mode 100644
index 0cbb908a..00000000
--- a/data/templates/inline_anchor.html.slim
+++ /dev/null
@@ -1,16 +0,0 @@
-- case @type
-- when :xref
- - refid = (attr :refid) || @target
- - if (reftext = @text || (@document.references[:ids][refid]))
- link anchor=refid =(reftext).tr_s "\n", ' '
- - else
- / hack for bibliography reference
- / should be able to reenable once we parse inline destinations
- |(see [#{refid}])
-- when :ref
- /a id=@target
-- when :bibref
- /a id=@target
- |[#{@target}]
-- else
- link href=@target class=role target=(attr :window) =@text
diff --git a/data/templates/inline_button.html.slim b/data/templates/inline_button.html.slim
deleted file mode 100644
index 23a11323..00000000
--- a/data/templates/inline_button.html.slim
+++ /dev/null
@@ -1 +0,0 @@
-b=%([ #{@text} ])
diff --git a/data/templates/inline_footnote.html.slim b/data/templates/inline_footnote.html.slim
deleted file mode 100644
index f0d95b45..00000000
--- a/data/templates/inline_footnote.html.slim
+++ /dev/null
@@ -1,5 +0,0 @@
-- if @type == :xref
- span.footnoteref
- | [<a class="footnote" href="#_footnote_#{attr :index}" title="View footnote.">#{attr :index}</a>]
-- else
- | [#{@document.footnotes.find {|fn| fn.index == (attr :index) }.text}]
diff --git a/data/templates/inline_kbd.html.slim b/data/templates/inline_kbd.html.slim
deleted file mode 100644
index 5879dcf7..00000000
--- a/data/templates/inline_kbd.html.slim
+++ /dev/null
@@ -1,7 +0,0 @@
-- if (keys = attr 'keys').size == 1
- code=keys.first
-- else
- - keys.each_with_index do |key, idx|
- - unless idx.zero?
- =<> '+'
- code=key
diff --git a/data/templates/inline_menu.html.slim b/data/templates/inline_menu.html.slim
deleted file mode 100644
index 38e2e217..00000000
--- a/data/templates/inline_menu.html.slim
+++ /dev/null
@@ -1,15 +0,0 @@
-- menu = attr 'menu'
-- menuitem = attr 'menuitem'
-- if !(submenus = attr 'submenus').empty?
- strong
- =menu
- =<> '|'
- => submenus.map {|submenu| %(#{submenu} | ) }.join.chop
- =menuitem
-- elsif !menuitem.nil?
- strong
- =menu
- =<> '|'
- =menuitem
-- else
- strong=menu
diff --git a/data/templates/inline_quoted.html.slim b/data/templates/inline_quoted.html.slim
deleted file mode 100644
index b6ff5390..00000000
--- a/data/templates/inline_quoted.html.slim
+++ /dev/null
@@ -1,22 +0,0 @@
-- unless @id.nil?
- a id=@id
-- case @type
-- when :emphasis
- em class=role =@text
-- when :strong
- strong class=role =@text
-- when :monospaced
- code class=role =@text
-- when :superscript
- sup class=role =@text
-- when :subscript
- sub class=role =@text
-- when :double
- =role? ? %(<span class="#{role}">“#{@text}”</span>) : %(“#{@text}”)
-- when :single
- =role? ? %(<span class="#{role}">‘#{@text}’</span>) : %(‘#{@text}’)
-- when :asciimath, :latexmath
- - open, close = ::Asciidoctor::INLINE_MATH_DELIMITERS[@type]
- |#{open}#{@text}#{close}
-- else
- =role? ? %(<span class="#{role}">#{@text}</span>) : @text
diff --git a/data/themes/asciidoctor-theme.yml b/data/themes/asciidoctor-theme.yml
index 10910f17..e79e902c 100644
--- a/data/themes/asciidoctor-theme.yml
+++ b/data/themes/asciidoctor-theme.yml
@@ -5,27 +5,31 @@ font:
bold: notoserif-bold-latin.ttf
italic: notoserif-italic-latin.ttf
bold_italic: notoserif-bolditalic-latin.ttf
+ # NOTE currently, callout numbers don't work with LiberationMono
LiberationMono:
normal: liberationmono-regular-latin.ttf
bold: liberationmono-bold-latin.ttf
italic: liberationmono-italic-latin.ttf
bold_italic: liberationmono-bolditalic-latin.ttf
+ Mplus1mn:
+ normal: mplus1mn-regular-ascii-conums.ttf
+ bold: mplus1mn-bold-ascii.ttf
+ italic: mplus1mn-italic-ascii.ttf
+ bold_italic: mplus1mn-bolditalic-ascii.ttf
#Mplus1pMultilingual:
# normal: mplus1p-regular-multilingual.ttf
#FontAwesome:
# normal: fontawesome-regular.ttf
- # FIXME using fallbacks breaks use of custom font styles
+ # FIXME using fallbacks breaks use of custom font styles (fixed in Prawn 1.2.1!)
#fallbacks:
# - Mplus1pMultilingual
brand:
primary_color: 005498
page:
- #background: path/to/background/image.png
background_color: FFFFFF
layout: portrait
# multiply inches by 72 to get pt values
- # 0.5", 0.67", 0.67", 0.67"
- margin: [36, 48.24, 48.24]
+ margin: [0.5 * 72, 0.67 * 72, 0.67 * 72, 0.67 * 72]
size: Letter
base:
font_color: 222222
@@ -38,7 +42,9 @@ base:
#font_size: 11.2
#line_height_length: 16
font_size: 10.5
- line_height_length: 15
+ #line_height_length: 15
+ # correct line height for NotoSerif metrics
+ line_height_length: 12
#font_size: 11.25
#line_height_length: 18
line_height: $base_line_height_length / $base_font_size
@@ -49,7 +55,10 @@ base:
border_radius: 4
border_width: 0.5
border_color: DDDDDD
-vertical_rhythm: $base_line_height_length * 2 / 3
+# FIXME vertical_rhythm is weird; we should think in terms of ems
+#vertical_rhythm: $base_line_height_length * 2 / 3
+# correct line height for NotoSerif metrics
+vertical_rhythm: $base_line_height_length
horizontal_rhythm: $base_line_height_length
link_font_color: $brand_primary_color
heading:
@@ -62,26 +71,41 @@ heading:
font_size_h5: $base_font_size
font_size_h6: $base_font_size_small
font_style: bold
- line_height: 1.4
- margin_top: $vertical_rhythm / 2
- margin_bottom: $vertical_rhythm
+ #line_height: 1.4
+ # correct line height for NotoSerif metrics
+ line_height: 1.2
+ margin_top: $vertical_rhythm * 0.2
+ margin_bottom: $vertical_rhythm * 0.8
+#prose:
+# margin_top: 0
+# margin_bottom: $vertical_rhythm
+block:
+ #margin_top: 0
+ #margin_bottom: $vertical_rhythm
+ padding: [$vertical_rhythm, $vertical_rhythm * 1.25, $vertical_rhythm, $vertical_rhythm * 1.25]
+# code is used for source blocks (perhaps change to source or listing?)
code:
font_color: $base_font_color
- font_family: LiberationMono
- font_size: floor($base_font_size * 0.9)
- background_color: FFFFFF
- #border_color: BFBFBF
+ #font_family: LiberationMono
+ #font_size: floor($base_font_size * 0.9)
+ font_family: Mplus1mn
+ font_size: ceil($base_font_size)
+ #padding: [$base_font_size, $code_font_size, $base_font_size, $code_font_size]
+ padding: $code_font_size
+ line_height: 1.25
+ background_color: F7F7F8
border_color: FFFFFF
- border_radius: 0
- border_width: 0.75
- padding: 12
+ border_radius: $base_border_radius
+ border_width: 0
+# literal is currently used for inline monospaced in prose and table cells
literal:
- font_family: $code_font_family
+ #font_family: $code_font_family
+ font_family: LiberationMono
font_color: 6D180B
blockquote:
font_color: 6F6F6F
- font_size: $base_font_size
- border_width: 1
+ font_size: $base_font_size_large
+ border_width: 3
border_color: $base_border_color
cite_font_size: $base_font_size_small
cite_font_color: 555555
@@ -107,31 +131,43 @@ caption:
font_color: 7A2518
font_style: bold
align: left
- margin_inside: $vertical_rhythm / 2
+ margin_inside: $vertical_rhythm * 0.25
margin_outside: 0
+conum:
+ font_family: Mplus1mn
+ font_color: $literal_font_color
+ font_size: $code_font_size
image:
align_default: left
scaled_width_default: 0.5
lead:
- font_size: floor($base_line_height_length * 0.8)
+ # QUESTION what about $base_font_size_large?
+ #font_size: floor($base_line_height_length * 0.8)
+ font_size: $base_font_size_large
line_height: 1.4
abstract:
font_size: $lead_font_size
font_color: 999999
+ #line_height: $lead_line_height
+ # HACK set line_height to 1 to workaround spacing problem after first line
+ line_height: 1
font_style: italic
- indent: 0
-horizontal_rule_color: $base_border_color
-definition_list:
+thematic_break:
+ border_color: $base_border_color
+ margin_top: $vertical_rhythm * 0.5
+ margin_bottom: $vertical_rhythm * 1.5
+description_list:
term_font_style: bold
- definition_indent: $horizontal_rhythm
+ description_indent: $horizontal_rhythm * 1.25
outline_list:
- indent: $horizontal_rhythm
+ indent: $horizontal_rhythm * 1.25
table:
background_color: transparent
background_color_alt: F9F9F9
border_color: DDDDDD
border_width: $base_border_width
- cell_padding: floor($base_line_height_length * 0.35)
+ # HACK accounting for line-height
+ cell_padding: [3, 3, 6, 3]
footer:
font_size: $base_font_size_small
font_color: $base_font_color
diff --git a/data/themes/default-theme.yml b/data/themes/default-theme.yml
index 5f9fa115..7111f881 100644
--- a/data/themes/default-theme.yml
+++ b/data/themes/default-theme.yml
@@ -5,27 +5,31 @@ font:
bold: notoserif-bold-latin.ttf
italic: notoserif-italic-latin.ttf
bold_italic: notoserif-bolditalic-latin.ttf
- LiberationMono:
- normal: liberationmono-regular-latin.ttf
- bold: liberationmono-bold-latin.ttf
- italic: liberationmono-italic-latin.ttf
- bold_italic: liberationmono-bolditalic-latin.ttf
+ # NOTE currently, callout numbers don't work with LiberationMono
+ #LiberationMono:
+ # normal: liberationmono-regular-latin.ttf
+ # bold: liberationmono-bold-latin.ttf
+ # italic: liberationmono-italic-latin.ttf
+ # bold_italic: liberationmono-bolditalic-latin.ttf
+ Mplus1mn:
+ normal: mplus1mn-regular-ascii-conums.ttf
+ bold: mplus1mn-bold-ascii.ttf
+ italic: mplus1mn-italic-ascii.ttf
+ bold_italic: mplus1mn-bolditalic-ascii.ttf
#Mplus1pMultilingual:
# normal: mplus1p-regular-multilingual.ttf
#FontAwesome:
# normal: fontawesome-regular.ttf
- # FIXME using fallbacks breaks use of custom font styles
+ # FIXME using fallbacks breaks use of custom font styles (fixed in Prawn 1.2.1!)
#fallbacks:
# - Mplus1pMultilingual
brand:
- primary_color: 428BCA
+ primary_color: 428bca
page:
- #background: path/to/background/image.png
- background_color: FFFFFF
+ background_color: ffffff
layout: portrait
# multiply inches by 72 to get pt values
- # 0.5", 0.67", 0.67", 0.67"
- margin: [36, 48.24, 48.24]
+ margin: [0.5 * 72, 0.67 * 72, 0.67 * 72, 0.67 * 72]
size: Letter
base:
font_color: 333333
@@ -38,7 +42,9 @@ base:
#font_size: 11.2
#line_height_length: 16
font_size: 10.5
- line_height_length: 15
+ #line_height_length: 15
+ # correct line height for NotoSerif metrics
+ line_height_length: 12
#font_size: 11.25
#line_height_length: 18
line_height: $base_line_height_length / $base_font_size
@@ -48,36 +54,61 @@ base:
align: justify
border_radius: 4
border_width: 0.5
- border_color: EEEEEE
-vertical_rhythm: $base_line_height_length * 2 / 3
+ border_color: eeeeee
+# FIXME vertical_rhythm is weird; we should think in terms of ems
+#vertical_rhythm: $base_line_height_length * 2 / 3
+# correct line height for NotoSerif metrics
+vertical_rhythm: $base_line_height_length
horizontal_rhythm: $base_line_height_length
link_font_color: $brand_primary_color
heading:
font_color: $base_font_color
font_family: $base_font_family
+ # h1 is used for document title
font_size_h1: floor($base_font_size * 2.6)
+ # h2 is used for chapter title
font_size_h2: floor($base_font_size * 2.15)
font_size_h3: round($base_font_size * 1.7)
font_size_h4: $base_font_size_large
font_size_h5: $base_font_size
font_size_h6: $base_font_size_small
font_style: bold
- line_height: 1.4
- margin_top: $vertical_rhythm / 2
- margin_bottom: $vertical_rhythm
+ #line_height: 1.4
+ # correct line height for NotoSerif metrics
+ line_height: 1.2
+ margin_top: $vertical_rhythm * 0.2
+ margin_bottom: $vertical_rhythm * 0.8
+#prose:
+# margin_top: 0
+# margin_bottom: $vertical_rhythm
+block:
+ #margin_top: 0
+ #margin_bottom: $vertical_rhythm
+ padding: [$vertical_rhythm, $vertical_rhythm * 1.25, $vertical_rhythm, $vertical_rhythm * 1.25]
+# code is used for source blocks (perhaps change to source or listing?)
code:
font_color: $base_font_color
- font_family: LiberationMono
- font_size: floor($base_font_size * 0.9)
- padding: [9.5, 9.5, 9.5, 9.5]
- background_color: F5F5F5
- border_color: CCCCCC
+ #font_family: LiberationMono
+ #font_size: floor($base_font_size * 0.9)
+ #font_size: 10
+ #padding: [9.5, 9.5, 9.5, 9.5]
+ # LiberationMono carries extra gap below line
+ #padding: [10, 10, 7.5, 10]
+ #line_height: 1.45
+ font_family: Mplus1mn
+ font_size: ceil($base_font_size)
+ #padding: [$base_font_size, $code_font_size, $base_font_size, $code_font_size]
+ padding: $code_font_size
+ line_height: 1.25
+ background_color: f5f5f5
+ border_color: cccccc
border_radius: $base_border_radius
border_width: 0.75
+# literal is currently used for inline monospaced in prose and table cells
literal:
+ #font_color: c7254e
+ font_color: b12146
font_family: $code_font_family
- #font_color: C7254E
- font_color: B12146
blockquote:
font_color: $base_font_color
font_size: $base_font_size_large
@@ -86,10 +117,10 @@ blockquote:
cite_font_size: $base_font_size_small
cite_font_color: 999999
sidebar:
- border_color: FFFFFF
+ border_color: ffffff
border_radius: $base_border_radius
border_width: $base_border_width
- background_color: EEEEEE
+ background_color: eeeeee
title_font_color: $heading_font_color
title_font_family: $heading_font_family
title_font_size: $heading_font_size_h4
@@ -106,32 +137,46 @@ admonition:
caption:
font_style: italic
align: left
- margin_inside: $vertical_rhythm / 2
+ # FIXME perhaps set line_height instead of / in addition to margins?
+ margin_inside: $vertical_rhythm * 0.25
margin_outside: 0
+conum:
+ font_family: Mplus1mn
+ font_color: $literal_font_color
+ font_size: $code_font_size
image:
align_default: left
scaled_width_default: 0.5
lead:
- font_size: floor($base_line_height_length * 0.8)
+ # QUESTION what about $base_font_size_large?
+ #font_size: floor($base_line_height_length * 0.8)
+ #font_size: floor($base_font_size * 1.15)
+ #line_height: 1.3
+ font_size: $base_font_size_large
line_height: 1.4
abstract:
+ #font_color: 404040
+ font_color: 5c6266
font_size: $lead_font_size
- font_color: 999999
+ line_height: $lead_line_height
font_style: italic
- indent: 0
-horizontal_rule_color: $base_border_color
-definition_list:
+thematic_break:
+ border_color: $base_border_color
+ margin_top: $vertical_rhythm * 0.5
+ margin_bottom: $vertical_rhythm * 1.5
+description_list:
term_font_style: italic
- definition_indent: $horizontal_rhythm * 1.25
+ description_indent: $horizontal_rhythm * 1.25
outline_list:
indent: $horizontal_rhythm * 1.25
table:
background_color: transparent
- background_color_alt: F9F9F9
- border_color: DDDDDD
+ background_color_alt: f9f9f9
+ border_color: dddddd
border_width: $base_border_width
- cell_padding: floor($base_line_height_length * 0.35)
+ # HACK accounting for line-height
+ cell_padding: [3, 3, 6, 3]
footer:
font_size: $base_font_size_small
font_color: $base_font_color
- border_color: DDDDDD
+ border_color: dddddd