├── .editorconfig ├── .gitattributes ├── .gitignore ├── Gemfile ├── LICENSE.adoc ├── README.adoc ├── Rakefile ├── erb ├── docbook45 │ └── document.xml.erb ├── html5 │ ├── block_admonition.html.erb │ ├── block_audio.html.erb │ ├── block_colist.html.erb │ ├── block_dlist.html.erb │ ├── block_example.html.erb │ ├── block_floating_title.html.erb │ ├── block_image.html.erb │ ├── block_listing.html.erb │ ├── block_literal.html.erb │ ├── block_olist.html.erb │ ├── block_open.html.erb │ ├── block_page_break.html.erb │ ├── block_paragraph.html.erb │ ├── block_pass.html.erb │ ├── block_preamble.html.erb │ ├── block_quote.html.erb │ ├── block_ruler.html.erb │ ├── block_sidebar.html.erb │ ├── block_stem.html.erb │ ├── block_table.html.erb │ ├── block_toc.html.erb │ ├── block_ulist.html.erb │ ├── block_verse.html.erb │ ├── block_video.html.erb │ ├── document.html.erb │ ├── embedded.html.erb │ ├── inline_anchor.html.erb │ ├── inline_break.html.erb │ ├── inline_button.html.erb │ ├── inline_callout.html.erb │ ├── inline_footnote.html.erb │ ├── inline_image.html.erb │ ├── inline_indexterm.html.erb │ ├── inline_kbd.html.erb │ ├── inline_menu.html.erb │ ├── inline_quoted.html.erb │ └── section.html.erb └── manpage │ ├── README.adoc │ ├── block_admonition.erb │ ├── block_dlist.erb │ ├── block_listing.erb │ ├── block_literal.erb │ ├── block_olist.erb │ ├── block_paragraph.erb │ ├── block_ulist.erb │ ├── block_verse.erb │ ├── document.erb │ ├── helpers.rb │ ├── inline_anchor.erb │ ├── inline_quoted.erb │ └── section.erb ├── haml ├── deckjs │ └── README.adoc ├── docbook45 │ ├── block_admonition.xml.haml │ ├── block_colist.xml.haml │ ├── block_dlist.xml.haml │ ├── block_example.xml.haml │ ├── block_floating_title.xml.haml │ ├── block_image.xml.haml │ ├── block_listing.xml.haml │ ├── block_literal.xml.haml │ ├── block_olist.xml.haml │ ├── block_open.xml.haml │ ├── block_page_break.xml.haml │ ├── block_paragraph.xml.haml │ ├── block_pass.xml.haml │ ├── block_preamble.xml.haml │ ├── block_quote.xml.haml │ ├── block_sidebar.xml.haml │ ├── block_table.xml.haml │ ├── block_thematic_break.xml.haml │ ├── block_ulist.xml.haml │ ├── block_verse.xml.haml │ ├── document.xml.haml │ ├── embedded.xml.haml │ ├── helpers.rb │ ├── inline_anchor.xml.haml │ ├── inline_break.xml.haml │ ├── inline_callout.xml.haml │ ├── inline_footnote.xml.haml │ ├── inline_image.xml.haml │ ├── inline_indexterm.xml.haml │ ├── inline_quoted.xml.haml │ └── section.xml.haml └── html5 │ ├── block_admonition.html.haml │ ├── block_audio.html.haml │ ├── block_colist.html.haml │ ├── block_dlist.html.haml │ ├── block_example.haml.haml │ ├── block_floating_title.html.haml │ ├── block_image.html.haml │ ├── block_listing.html.haml │ ├── block_literal.html.haml │ ├── block_olist.html.haml │ ├── block_open.html.haml │ ├── block_outline.html.haml │ ├── block_page_break.html.haml │ ├── block_paragraph.html.haml │ ├── block_pass.html.haml │ ├── block_preamble.html.haml │ ├── block_quote.html.haml │ ├── block_sidebar.html.haml │ ├── block_stem.html.haml │ ├── block_table.html.haml │ ├── block_thematic_break.html.haml │ ├── block_toc.html.haml │ ├── block_ulist.html.haml │ ├── block_verse.html.haml │ ├── block_video.html.haml │ ├── document.html.haml │ ├── embedded.html.haml │ ├── helpers.rb │ ├── inline_anchor.html.haml │ ├── inline_break.html.haml │ ├── inline_button.html.haml │ ├── inline_callout.html.haml │ ├── inline_footnote.html.haml │ ├── inline_image.html.haml │ ├── inline_indexterm.html.haml │ ├── inline_kbd.html.haml │ ├── inline_menu.html.haml │ ├── inline_quoted.html.haml │ └── section.html.haml ├── slim ├── bespokejs │ ├── document.html.slim │ ├── listing.html.slim │ ├── paragraph.html.slim │ ├── section.html.slim │ └── ulist.html.slim ├── docbook45 │ ├── block_admonition.xml.slim │ ├── block_colist.xml.slim │ ├── block_dlist.xml.slim │ ├── block_example.xml.slim │ ├── block_floating_title.xml.slim │ ├── block_image.xml.slim │ ├── block_listing.xml.slim │ ├── block_literal.xml.slim │ ├── block_olist.xml.slim │ ├── block_open.xml.slim │ ├── block_page_break.xml.slim │ ├── block_paragraph.xml.slim │ ├── block_pass.xml.slim │ ├── block_preamble.xml.slim │ ├── block_quote.xml.slim │ ├── block_sidebar.xml.slim │ ├── block_table.xml.slim │ ├── block_thematic_break.xml.slim │ ├── block_ulist.xml.slim │ ├── block_verse.xml.slim │ ├── document.xml.slim │ ├── embedded.xml.slim │ ├── helpers.rb │ ├── inline_anchor.xml.slim │ ├── inline_break.xml.slim │ ├── inline_callout.xml.slim │ ├── inline_footnote.xml.slim │ ├── inline_image.xml.slim │ ├── inline_indexterm.xml.slim │ ├── inline_quoted.xml.slim │ └── section.xml.slim ├── dzslides │ ├── README.adoc │ ├── block_admonition.html.slim │ ├── block_colist.html.slim │ ├── block_dlist.html.slim │ ├── block_example.html.slim │ ├── block_floating_title.html.slim │ ├── block_image.html.slim │ ├── block_listing.html.slim │ ├── block_literal.html.slim │ ├── block_olist.html.slim │ ├── block_open.html.slim │ ├── block_paragraph.html.slim │ ├── block_pass.html.slim │ ├── block_quote.html.slim │ ├── block_table.html.slim │ ├── block_thematic_break.html.slim │ ├── block_ulist.html.slim │ ├── block_verse.html.slim │ ├── block_video.html.slim │ ├── document.html.slim │ ├── embedded.html.slim │ ├── helpers.rb │ ├── inline_anchor.html.slim │ ├── inline_break.html.slim │ ├── inline_callout.html.slim │ ├── inline_footnote.html.slim │ ├── inline_image.html.slim │ ├── inline_indexterm.html.slim │ ├── inline_kbd.html.slim │ ├── inline_quoted.html.slim │ └── section.html.slim ├── html5 │ ├── _attribution.html.slim │ ├── _footer.html.slim │ ├── _footnotes.html.slim │ ├── _hdlist.html.slim │ ├── _header.html.slim │ ├── _qanda.html.slim │ ├── _toc.html.slim │ ├── block_admonition.html.slim │ ├── block_audio.html.slim │ ├── block_colist.html.slim │ ├── block_dlist.html.slim │ ├── block_example.html.slim │ ├── block_floating_title.html.slim │ ├── block_image.html.slim │ ├── block_listing.html.slim │ ├── block_literal.html.slim │ ├── block_olist.html.slim │ ├── block_open.html.slim │ ├── block_outline.html.slim │ ├── block_page_break.html.slim │ ├── block_paragraph.html.slim │ ├── block_pass.html.slim │ ├── block_preamble.html.slim │ ├── block_quote.html.slim │ ├── block_sidebar.html.slim │ ├── block_stem.html.slim │ ├── block_table.html.slim │ ├── block_thematic_break.html.slim │ ├── block_toc.html.slim │ ├── block_ulist.html.slim │ ├── block_verse.html.slim │ ├── block_video.html.slim │ ├── document.html.slim │ ├── embedded.html.slim │ ├── helpers.rb │ ├── inline_anchor.html.slim │ ├── inline_break.html.slim │ ├── inline_button.html.slim │ ├── inline_callout.html.slim │ ├── inline_footnote.html.slim │ ├── inline_image.html.slim │ ├── inline_indexterm.html.slim │ ├── inline_kbd.html.slim │ ├── inline_menu.html.slim │ ├── inline_quoted.html.slim │ └── section.html.slim └── revealjs │ └── README.adoc └── test ├── examples ├── asciidoc-html │ ├── README │ ├── block_admonition.adoc │ ├── block_colist.adoc │ ├── block_listing.adoc │ ├── block_ulist.adoc │ ├── block_video.adoc │ ├── inline_callout.adoc │ └── inline_image.adoc └── html5 │ ├── block_admonition.html │ ├── block_audio.html │ ├── block_colist.html │ ├── block_dlist.html │ ├── block_example.html │ ├── block_floating_title.html │ ├── block_image.html │ ├── block_listing.html │ ├── block_literal.html │ ├── block_olist.html │ ├── block_open.html │ ├── block_outline.html │ ├── block_page_break.html │ ├── block_paragraph.html │ ├── block_pass.html │ ├── block_preamble.html │ ├── block_quote.html │ ├── block_sidebar.html │ ├── block_stem.html │ ├── block_table.html │ ├── block_thematic_break.html │ ├── block_toc.html │ ├── block_ulist.html │ ├── block_verse.html │ ├── block_video.html │ ├── document.html │ ├── embedded.html │ ├── inline_anchor.html │ ├── inline_break.html │ ├── inline_button.html │ ├── inline_callout.html │ ├── inline_footnote.html │ ├── inline_image.html │ ├── inline_kbd.html │ ├── inline_menu.html │ ├── inline_quoted.html │ └── section.html ├── html5_haml_test.rb ├── html5_slim_test.rb ├── tasks ├── generate.rake └── test.rake └── test_helper.rb /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most editorconfig file 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | indent_style = space 10 | indent_size = 2 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Gemfile.lock 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :test do 4 | gem 'asciidoctor', '~> 1.5.4' 5 | gem 'asciidoctor-doctest', '~> 1.5.2.0' 6 | gem 'coderay', '~> 1.1' 7 | gem 'haml', '~> 4.0' 8 | gem 'rake', '~> 10.0' 9 | gem 'slim', '~> 2.1' 10 | gem 'thread_safe', '~> 0.3.4' 11 | gem 'tilt', '~> 2.0' 12 | 13 | # doesn't work on JRuby 14 | gem 'pygments.rb', '~> 0.6', platforms: [:ruby, :mswin, :mingw] 15 | end 16 | -------------------------------------------------------------------------------- /LICENSE.adoc: -------------------------------------------------------------------------------- 1 | .The MIT License 2 | .... 3 | Copyright (C) 2012-2016 Dan Allen and the Asciidoctor Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | .... 23 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = Asciidoctor Backends 2 | 3 | In this repository, you'll find an assortment of backend templates for generating different output formats from AsciiDoc that you can use with the template converter in https://github.com/asciidoctor/asciidoctor[Asciidoctor]. 4 | These examples demonstrate how to make an html5 or docbook45 converter similar to the ones in Asciidoctor using purely templates, as well as how to use templates to generate HTML5 presentations from AsciiDoc. 5 | 6 | Please note that these templates are only meant to be examples. 7 | They are not activately maintained, are not production ready, and are not intended to be a drop-in replacement for the official converters. 8 | They are provided merely as a reference and starting point for creating your own template-based converter. 9 | 10 | Since the template converter in Asciidoctor works on a per-element basis, you can pull out one or more of these templates for customizing part of the HTML. 11 | Asciidoctor will drop back to the built-in converter to handle other elements in the document. 12 | You don't have to feed in the whole directory of templates at once. 13 | 14 | == General Usage Instructions 15 | 16 | CAUTION: These usage instructions are out of date, so follow with caution. 17 | 18 | . Ensure Asciidoctor, Slim, Haml and their dependencies are installed: 19 | 20 | $ gem install asciidoctor tilt haml thread_safe 21 | gem install slim --version 2.1.0 22 | + 23 | WARNING: The Slim-based templates are not yet compatible with Slim 3. 24 | 25 | . Clone `asciidoctor/asciidoctor-backends` to get templates for rendering presentation HTML: 26 | 27 | $ git clone https://github.com/asciidoctor/asciidoctor-backends 28 | 29 | . Edit `CONTENT_FILE` ( *.adoc or *.ad or ...): 30 | 31 | ** Slides & content per slide 32 | ** [Optional] Set presentation "options" at top of `CONTENT_FILE`. The options available & their values will depend on presentation library (some examples below). 33 | 34 | :${Attribute}: ${Value} 35 | 36 | . Generate HTML from Asciidoctor templates: 37 | 38 | .. Command Line: 39 | 40 | $ asciidoctor -T TEMPLATE_DIRECTORY ${options} CONTENT_FILE 41 | 42 | .. Build Script: use Ruby, JavaScript, Gradle, or your favorite build tool/script with presentation options 43 | 44 | . Copy or clone presentation library (to output destination/branch): 45 | 46 | $ git clone PRESENTATION_LIBRARY 47 | 48 | TIP: If you are using https://pages.github.com/[GitHub Pages], plan ahead by keeping your source files on `master` branch and all output files on the `gh-pages` branch. 49 | 50 | .Existing Backends Templates 51 | [cols="1a,2m,2"] 52 | |=== 53 | |Backend |`PRESENTATION_LIBRARY` |`TEMPLATE_DIRECTORY` 54 | 55 | |http://imakewebthings.com/deck.js/[deck.js] 56 | |https://github.com/imakewebthings/deck.js 57 | |replaced by: + 58 | https://github.com/asciidoctor/asciidoctor-deck.js[asciidoctor/asciidoctor-deck.js] 59 | 60 | |http://lab.hakim.se/reveal-js/#/[reveal.js] 61 | |https://github.com/hakimel/reveal.js 62 | |replaced by: + 63 | https://github.com/asciidoctor/asciidoctor-reveal.js[asciidoctor/asciidoctor-reveal.js] 64 | 65 | |http://paulrouget.com/dzslides/[DZSlides] 66 | |https://github.com/paulrouget/dzslides 67 | |`asciidoctor-backends/slim/dzslides` 68 | 69 | |http://markdalgleish.com/projects/bespoke.js/[Bespoke.js] 70 | |https://github.com/markdalgleish/bespoke.js 71 | |`asciidoctor-backends/slim/bespokejs` 72 | |=== 73 | 74 | NOTE: Some backends may be broken out into new repositories in order to manage releases independently (and potentially publish separate gems). 75 | Aggregation of those releases back into this project may be delayed. 76 | 77 | == Copyright and Licensing 78 | 79 | Copyright (C) 2012-2016 Dan Allen and the Asciidoctor Project. 80 | Free use of this software is granted under the terms of the MIT License. 81 | 82 | See the <> file for details. 83 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | 3 | Dir['test/tasks/*.rake'].each do |file| 4 | import file 5 | end 6 | 7 | # When no task specified, run test. 8 | task :default => :test 9 | -------------------------------------------------------------------------------- /erb/docbook45/document.xml.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> 2 | PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"><% 3 | if attr? 'toc' %> 4 | <% 5 | end 6 | if attr? 'sectnums' %> 7 | <% 8 | end 9 | documentinfo = '' 10 | if has_header? && !notitle 11 | title_line = @header.title 12 | if title_line.include? ': ' 13 | title, _, subtitle = title_line.rpartition ': ' 14 | documentinfo = %(#{title} 15 | #{subtitle}\n) 16 | else 17 | documentinfo = %(#{title_line}\n) 18 | end 19 | end 20 | documentinfo = %(#{documentinfo}#{(attr? 'revdate') ? (attr 'revdate') : (attr 'docdate')}\n) 21 | if has_header? 22 | if attr? 'author' 23 | if (authorcount = (attr 'authorcount').to_i) < 2 24 | authorinfo = [] 25 | if attr? 'firstname' 26 | authorinfo << %(#{attr 'firstname'}) 27 | end 28 | if attr? 'middlename' 29 | authorinfo << %(#{attr 'middlename'}) 30 | end 31 | if attr? 'lastname' 32 | authorinfo << %(#{attr 'lastname'}) 33 | end 34 | if attr? 'email' 35 | authorinfo << %(#{attr 'email'}) 36 | end 37 | documentinfo = %(#{documentinfo} 38 | #{authorinfo * "\n"} 39 | 40 | #{attr 'authorinitials'}\n) 41 | else 42 | documentinfo = %(#{documentinfo}\n) 43 | (1..authorcount).each do |idx| 44 | authorinfo = [] 45 | if attr? "firstname_#{idx}" 46 | authorinfo << %(#{attr "firstname_#{idx}"}) 47 | end 48 | if attr? "middlename_#{idx}" 49 | authorinfo << %(#{attr "middlename_#{idx}"}) 50 | end 51 | if attr? "lastname_#{idx}" 52 | authorinfo << %(#{attr "lastname_#{idx}"}) 53 | end 54 | if attr? "email_#{idx}" 55 | authorinfo << %(#{attr "email_#{idx}"}) 56 | end 57 | documentinfo = %(#{documentinfo} 58 | #{authorinfo * "\n"} 59 | \n) 60 | end 61 | documentinfo = %(#{documentinfo}\n) 62 | end 63 | end 64 | if (attr? 'revnumber') || (attr? 'revremark') 65 | revinfo = [] 66 | if attr? 'revnumber' 67 | revinfo << %(#{attr 'revnumber'}) 68 | end 69 | if attr? 'revdate' 70 | revinfo << %(#{attr 'revdate'}) 71 | end 72 | if attr? 'authorinitials' 73 | revinfo << %(#{attr 'authorinitials'}) 74 | end 75 | if attr? 'revremark' 76 | revinfo << %(#{attr 'revremark'}) 77 | end 78 | 79 | documentinfo = %(#{documentinfo} 80 | 81 | 82 | #{revinfo * "\n"} 83 | 84 | \n) 85 | 86 | documentinfo = %(#{documentinfo} 87 | #{docinfo}) 88 | if attr? 'orgname' 89 | documentinfo = %(#{documentinfo} 90 | #{attr 'orgname'}\n) 91 | end 92 | end 93 | end 94 | if doctype == 'book' %> 95 | > 96 | 97 | <%= documentinfo %> 98 | 99 | <%= content %> 100 | <% 101 | else %> 102 | > 103 | 104 | <%= documentinfo %> 105 | 106 | <%= content %> 107 | <% 108 | end %> 109 | -------------------------------------------------------------------------------- /erb/html5/block_admonition.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['admonitionblock',(attr :name),role].compact * ' ' %>"> 2 | 3 | 4 | 13 | 19 | 20 |
<% 5 | if @document.attr? :icons, 'font' %> 6 | <% 7 | elsif @document.attr? :icons %> 8 | <%= @caption %><% 9 | else %> 10 |
<%= @caption %>
<% 11 | end %> 12 |
<% 14 | if title? %> 15 |
<%= title %>
<% 16 | end %> 17 | <%= content %> 18 |
21 | 22 | -------------------------------------------------------------------------------- /erb/html5/block_audio.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['audioblock',@style,role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= captioned_title %>
<% 4 | end %> 5 |
6 | 12 |
13 | 14 | -------------------------------------------------------------------------------- /erb/html5/block_colist.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['colist',@style,role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= title %>
<% 4 | end 5 | if @document.attr? :icons 6 | font_icons = @document.attr? :icons, 'font' %> 7 | <% 8 | items.each_with_index do |item, i| 9 | num = i + 1 %> 10 | 11 | 15 | 16 | <% 17 | end %> 18 |
<% 12 | if font_icons %><%= num %><% 13 | else %><%= num %><% 14 | end %><%= item.text %>
<% 19 | else %> 20 |
    <% 21 | items.each do |item| %> 22 |
  1. 23 |

    <%= item.text %>

    24 |
  2. <% 25 | end %> 26 |
<% 27 | end %> 28 | 29 | -------------------------------------------------------------------------------- /erb/html5/block_dlist.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | case @style 3 | when 'qanda' 4 | %> class="<%= ['qlist','qanda',role].compact * ' ' %>"><% 5 | if title? %> 6 |
<%= title %>
<% 7 | end %> 8 |
    <% 9 | items.each do |questions, answer| %> 10 |
  1. <% 11 | [*questions].each do |question| %> 12 |

    <%= question.text %>

    <% 13 | end 14 | unless answer.nil? 15 | if answer.text? %> 16 |

    <%= answer.text %>

    <% 17 | end 18 | if answer.blocks? %> 19 | <%= answer.content %><% 20 | end 21 | end %> 22 |
  2. <% 23 | end %> 24 |
25 | <% 26 | when 'horizontal' 27 | %> class="<%= ['hdlist',role].compact * ' ' %>"><% 28 | if title? %> 29 |
<%= title %>
<% 30 | end %> 31 | <% 32 | if (attr? :labelwidth) || (attr? :itemwidth) %> 33 | 34 | > 35 | > 36 | <% 37 | end 38 | items.each do |terms, dd| %> 39 | 40 | 50 | 60 | <% 61 | end %> 62 |
<% 41 | terms = [*terms] 42 | last_term = terms.last 43 | terms.each do |dt| %> 44 | <%= dt.text %><% 45 | if dt != last_term %> 46 |
<% 47 | end 48 | end %> 49 |
<% 51 | unless dd.nil? 52 | if dd.text? %> 53 |

<%= dd.text %>

<% 54 | end 55 | if dd.blocks? %> 56 | <%= dd.content %><% 57 | end 58 | end %> 59 |
63 | <% 64 | else 65 | %> class="<%= ['dlist',@style,role].compact * ' ' %>"><% 66 | if title? %> 67 |
<%= title %>
<% 68 | end %> 69 |
<% 70 | items.each do |terms, dd| 71 | [*terms].each do |dt| %> 72 | ><%= dt.text %><% 73 | end 74 | unless dd.nil? %> 75 |
<% 76 | if dd.text? %> 77 |

<%= dd.text %>

<% 78 | end 79 | if dd.blocks? %> 80 | <%= dd.content %><% 81 | end %> 82 |
<% 83 | end 84 | end %> 85 |
86 | <% 87 | end %> 88 | -------------------------------------------------------------------------------- /erb/html5/block_example.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['exampleblock',role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= captioned_title %>
<% 4 | end %> 5 |
6 | <%= content %> 7 |
8 | 9 | -------------------------------------------------------------------------------- /erb/html5/block_floating_title.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><%= %(#{title}) %> 2 | -------------------------------------------------------------------------------- /erb/html5/block_image.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['imageblock',@style,role].compact * ' ' %>"<% 2 | if (attr? :align) || (attr? :float) 3 | %> style="<%= [("text-align: #{attr :align};" if attr? :align),("float: #{attr :float};" if attr? :float)].compact * ' ' %>"<% 4 | end %>> 5 |
<% 6 | if attr? :link %> 7 | <%= attr :alt %><%= (attr? :height) ? %( height="#{attr :height}") : nil %>><% 8 | else %> 9 | <%= attr :alt %><%= (attr? :height) ? %( height="#{attr :height}") : nil %>><% 10 | end %> 11 |
<% 12 | if title? %> 13 |
<%= captioned_title %>
<% 14 | end %> 15 | 16 | -------------------------------------------------------------------------------- /erb/html5/block_listing.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['listingblock',role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= captioned_title %>
<% 4 | end %> 5 |
<% 6 | nowrap = !(@document.attr? :prewrap) || (option? :nowrap) 7 | if @style == 'source' 8 | language = attr :language 9 | code_class = language ? [language, %(language-#{language})] : [] 10 | pre_class = ['highlight'] 11 | pre_lang = nil 12 | case attr 'source-highlighter' 13 | when 'coderay' 14 | pre_class = ['CodeRay'] 15 | when 'pygments' 16 | pre_class = ['pygments','highlight'] 17 | when 'prettify' 18 | pre_class = ['prettyprint'] 19 | pre_class << 'linenums' if attr? :linenums 20 | pre_class << language if language 21 | pre_class << %(language-#{language}) if language 22 | code_class = [] 23 | when 'html-pipeline' 24 | pre_lang = language 25 | pre_class = code_class = [] 26 | nowrap = false 27 | end 28 | pre_class << 'nowrap' if nowrap %> 29 | <%= pre_lang && %( lang="#{pre_lang}") %>>><%= content %><% 30 | else %> 31 | ><%= content %><% 32 | end %> 33 |
34 | 35 | -------------------------------------------------------------------------------- /erb/html5/block_literal.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['literalblock',role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= title %>
<% 4 | end %> 5 |
6 | ><%= content %> 7 |
8 | 9 | -------------------------------------------------------------------------------- /erb/html5/block_olist.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['olist',@style,role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= title %>
<% 4 | end %> 5 |
    <%= (keyword = list_marker_keyword) && %( type="#{keyword}") %>><% 6 | items.each do |item| %> 7 |
  1. 8 |

    <%= item.text %>

    <% 9 | if item.blocks? %> 10 | <%= item.content %><% 11 | end %> 12 |
  2. <% 13 | end %> 14 |
15 | 16 | -------------------------------------------------------------------------------- /erb/html5/block_open.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | if @style == 'abstract' 3 | if @parent == @document && @document.doctype == 'book' 4 | puts 'asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.' 5 | else 6 | %> class="<%= ['quoteblock','abstract',role].compact * ' ' %>"><% 7 | if title? %> 8 |
<%= title %>
<% 9 | end %> 10 |
11 | <%= content %> 12 |
13 | <% 14 | end 15 | elsif @style == 'partintro' && (@level != 0 || @parent.context != :section || @document.doctype != 'book') 16 | puts 'asciidoctor: ERROR: partintro block can only be used when doctype is book and it\'s a child of a book part. Excluding block content.' 17 | else 18 | %> class="<%= ['openblock',(@style == 'open' ? nil : @style),role].compact * ' ' %>"><% 19 | if title? %> 20 |
<%= title %>
<% 21 | end %> 22 |
23 | <%= content %> 24 |
25 | <% 26 | end %> 27 | -------------------------------------------------------------------------------- /erb/html5/block_page_break.html.erb: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /erb/html5/block_paragraph.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['paragraph',role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= title %>
<% 4 | end %> 5 |

<%= content %>

6 | 7 | -------------------------------------------------------------------------------- /erb/html5/block_pass.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><%= content %> 2 | -------------------------------------------------------------------------------- /erb/html5/block_preamble.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%>
2 |
3 | <%= content %> 4 |
<% 5 | if (attr? :toc) && (attr? 'toc-placement', 'preamble') %> 6 |
7 |
<%= attr 'toc-title' %>
8 | <%= converter.convert @document, 'outline' %> 9 |
<% 10 | end %> 11 |
12 | -------------------------------------------------------------------------------- /erb/html5/block_quote.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['quoteblock',role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= title %>
<% 4 | end %> 5 |
6 | <%= content %> 7 |
<% 8 | if (attr? :attribution) or (attr? :citetitle) %> 9 |
<% 10 | if attr? :citetitle %> 11 | <%= attr :citetitle %><% 12 | end 13 | if attr? :attribution 14 | if attr? :citetitle %>
<% 15 | end %> 16 | <%= "— #{attr :attribution}" %><% 17 | end %> 18 |
<% 19 | end %> 20 | 21 | -------------------------------------------------------------------------------- /erb/html5/block_ruler.html.erb: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /erb/html5/block_sidebar.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['sidebarblock',role].compact * ' ' %>"> 2 |
<% 3 | if title? %> 4 |
<%= title %>
<% 5 | end %> 6 | <%= content %> 7 |
8 | 9 | -------------------------------------------------------------------------------- /erb/html5/block_stem.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['mathblock',role].compact * ' ' %>"><% 2 | if title? %> 3 |
<%= title %>
<% 4 | end %> 5 |
<% 6 | open, close = Asciidoctor::BLOCK_MATH_DELIMITERS[@style.to_sym] 7 | equation = content.strip 8 | if (@subs.nil? || @subs.empty?) && !(attr? 'subs') 9 | equation = sub_specialcharacters equation 10 | end 11 | unless (equation.start_with? open) && (equation.end_with? close) 12 | equation = %(#{open}#{equation}#{close}) 13 | end 14 | %> 15 | <%= %(#{equation}\n) %> 16 |
17 | 18 | -------------------------------------------------------------------------------- /erb/html5/block_table.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= 2 | ['tableblock',"frame-#{attr :frame, 'all'}","grid-#{attr :grid, 'all'}",role].compact * ' ' %>"<% 3 | if (attr? :float) || !(option? :autowidth) %> style="<%= 4 | [("width: #{attr :tablepcwidth}%;" unless option? :autowidth),("float: #{attr :float};" if attr? :float)].compact * ' ' %>"<% 5 | end %>><% 6 | if title? %> 7 | <%= captioned_title %><% 8 | end 9 | unless (attr :rowcount).zero? %> 10 | <% 11 | if option? :autowidth 12 | @columns.size.times do %> 13 | <% 14 | end 15 | else 16 | @columns.each do |col| %> 17 | <% 18 | end 19 | end %> 20 | <% 21 | [:head, :foot, :body].select {|tsec| !@rows[tsec].empty? }.each do |tsec| %> 22 | ><% 23 | @rows[tsec].each do |row| %> 24 | <% 25 | row.each do |cell| 26 | # store reference of content in advance to resolve attribute assignments in cells 27 | if tsec == :head 28 | cell_content = cell.text 29 | else 30 | case cell.style 31 | when :verse, :literal 32 | cell_content = cell.text 33 | else 34 | cell_content = cell.content 35 | end 36 | end 37 | cell_css_style = (@document.attr? :cellbgcolor) ? %(background-color: #{@document.attr :cellbgcolor};) : nil %> 38 | <<%= (cell_tag_name = (tsec == :head || cell.style == :header ? 'th' : 'td')) %> class="<%= ['tableblock',"halign-#{cell.attr :halign}","valign-#{cell.attr :valign}"] * ' ' %>"<%= cell.colspan ? %( colspan="#{cell.colspan}") : nil %><%= cell.rowspan ? %( rowspan="#{cell.rowspan}") : nil %><%= cell_css_style ? %( style="#{cell_css_style}") : nil %>><% 39 | if tsec == :head %><%= cell_content %><% 40 | else 41 | case cell.style 42 | when :asciidoc %>
<%= cell_content %>
<% 43 | when :verse %>
<%= cell_content %>
<% 44 | when :literal %>
<%= cell_content %>
<% 45 | else 46 | cell_content.each do |text| %>

<%= text %>

<% end 47 | end 48 | end %>><% 49 | end %> 50 | <% 51 | end %> 52 |
><% 53 | end 54 | end %> 55 | 56 | -------------------------------------------------------------------------------- /erb/html5/block_toc.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | if @document.attr? :toc 3 | toc_id = @id 4 | toc_role = (attr :role, (@document.attr 'toc-class', 'toc')) 5 | toc_title_id = nil 6 | toc_title = title? ? title : (@document.attr 'toc-title') 7 | toc_levels = (attr? :levels) ? (attr :levels).to_i : (@document.attr :toclevels, 2).to_i 8 | if !toc_id && (@document.embedded? || !(@document.attr? 'toc-placement')) 9 | toc_id = 'toc' 10 | toc_title_id = 'toctitle' 11 | end 12 | %> class="<%= toc_role %>"><% 13 | if toc_title %> 14 |
><%= toc_title %>
<% 15 | end %> 16 | <%= converter.convert_with_options @document, 'outline', :toclevels => toc_levels %><% 17 | end %> 18 | -------------------------------------------------------------------------------- /erb/html5/block_ulist.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | if (checklist = (option? :checklist) ? 'checklist' : nil) 3 | if option? :interactive 4 | marker_checked = '' 5 | marker_unchecked = '' 6 | else 7 | if @document.attr? :icons, 'font' 8 | marker_checked = '' 9 | marker_unchecked = '' 10 | else 11 | marker_checked = '✓' 12 | marker_unchecked = '❏' 13 | end 14 | end 15 | end %> class="<%= ['ulist',checklist,@style,role].compact * ' ' %>"><% 16 | if title? %> 17 |
<%= title %>
<% 18 | end %> 19 | ><% 20 | items.each do |item| %> 21 |
  • 22 |

    <% 23 | if checklist && (item.attr? :checkbox) %><%= %(#{(item.attr? :checked) ? marker_checked : marker_unchecked} #{item.text}) %><% 24 | else %><%= item.text %><% 25 | end %>

    <% 26 | if item.blocks? %> 27 | <%= item.content %><% 28 | end %> 29 |
  • <% 30 | end %> 31 | 32 | 33 | -------------------------------------------------------------------------------- /erb/html5/block_verse.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['verseblock',role].compact * ' ' %>"><% 2 | if title? %> 3 |
    <%= title %>
    <% 4 | end %> 5 |
    <%= content %>
    <% 6 | if (attr? :attribution) or (attr? :citetitle) %> 7 |
    <% 8 | if attr? :citetitle %> 9 | <%= attr :citetitle %><% 10 | end 11 | if attr? :attribution 12 | if attr? :citetitle %>
    <% 13 | end %> 14 | <%= "— #{attr :attribution}" %><% 15 | end %> 16 |
    <% 17 | end %> 18 | 19 | -------------------------------------------------------------------------------- /erb/html5/block_video.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%> class="<%= ['videoblock',@style,role].compact * ' ' %>"><% 2 | if title? %> 3 |
    <%= captioned_title %>
    <% 4 | end %> 5 |
    <% 6 | case attr :poster 7 | when 'vimeo' 8 | start_anchor = (attr? :start) ? %(#at=#{attr :start}) : nil 9 | delimiter = '?' 10 | autoplay_param = (option? :autoplay) ? %(#{delimiter}autoplay=1) : nil 11 | delimiter = '&' if autoplay_param 12 | loop_param = (option? :loop) ? %(#{delimiter}loop=1) : nil 13 | src = %(//player.vimeo.com/video/#{attr :target}#{start_anchor}#{autoplay_param}#{loop_param}) %> 14 | <%= (attr? :height) ? %( height="#{attr :height}") : nil %> src="<%= src %>" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen><% 15 | when 'youtube' 16 | params = ['rel=0'] 17 | params << %(start=#{attr :start}) if attr? :start 18 | params << %(end=#{attr :end}) if attr? :end 19 | params << 'autoplay=1' if option? :autoplay 20 | params << 'loop=1' if option? :loop 21 | params << 'controls=0' if option? :nocontrols 22 | src = %(//www.youtube.com/embed/#{attr :target}?#{params * '&'}) %> 23 | <%= (attr? :height) ? %( height="#{attr :height}") : nil %> src="<%= src %>" frameborder="0"<%= (option? :nofullscreen) ? nil : ' allowfullscreen' %>><% 24 | else %> 25 | <% 32 | end %> 33 |
    34 | 35 | -------------------------------------------------------------------------------- /erb/html5/embedded.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | if !notitle && has_header? 3 | %>><%= @header.title %><% 4 | end %><%= content %><% 5 | if footnotes? && !(attr? :nofootnotes) %> 6 |
    7 |
    <% 8 | footnotes.each do |fn| %><%= %( 9 |
    10 | #{fn.index}. #{fn.text} 11 |
    ) %><% 12 | end %> 13 |
    <% 14 | end %> 15 | -------------------------------------------------------------------------------- /erb/html5/inline_anchor.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | case @type 3 | when :xref 4 | refid = (attr :refid) || @target 5 | %><%= %(#{@text || @document.references[:ids].fetch(refid, %[[#{refid}]]).tr_s("\n", ' ')}) %><% 6 | when :ref %><%= %() %><% 7 | when :bibref %><%= %([#{@target}]) %><% 8 | else %><%= %(#{@text}) %><% 9 | end %> 10 | -------------------------------------------------------------------------------- /erb/html5/inline_break.html.erb: -------------------------------------------------------------------------------- 1 | <%= @text %>
    2 | -------------------------------------------------------------------------------- /erb/html5/inline_button.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><%= @text %> 2 | -------------------------------------------------------------------------------- /erb/html5/inline_callout.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | if @document.attr? :icons, 'font' %>(<%= @text %>)<% 3 | elsif @document.attr? :icons %>" alt="<%= @text %>"><% 4 | else %>(<%= @text %>)<% 5 | end %> 6 | -------------------------------------------------------------------------------- /erb/html5/inline_footnote.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | idx = attr :index 3 | if @type == :xref 4 | %><%= %([#{idx}]) %><% 5 | else 6 | %><%= %([#{idx}]) %><% 7 | end %> 8 | -------------------------------------------------------------------------------- /erb/html5/inline_image.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%>><% 2 | if @type == 'icon' && (@document.attr? :icons, 'font') 3 | style_class = [%(icon-#{@target})] 4 | style_class << %(icon-#{attr :size}) if attr? :size 5 | style_class << %(icon-rotate-#{attr :rotate}) if attr? :rotate 6 | style_class << %(icon-flip-#{attr :flip}) if attr? :flip 7 | title_attr = (attr? :title) ? %( title="#{attr :title}") : nil 8 | img = %() 9 | elsif @type == 'icon' && !(@document.attr? :icons) 10 | img = %([#{attr :alt}]) 11 | else 12 | img_src = (@type == 'icon' ? (icon_uri @target) : (image_uri @target)) 13 | img_attrs = [:alt, :width, :height, :title].map {|name| (attr? name) ? %( #{name}="#{attr name}") : nil }.join 14 | img = %() 15 | end 16 | if attr? :link %>><%= img %><% 17 | else %><%= img %><% 18 | end %> 19 | -------------------------------------------------------------------------------- /erb/html5/inline_indexterm.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><%= @type == :visible ? @text : nil %> 2 | -------------------------------------------------------------------------------- /erb/html5/inline_kbd.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | keys = attr 'keys' 3 | if keys.size == 1 4 | %><%= keys.first %><% 5 | else 6 | %><% 7 | idx = 0 8 | keys.map do |key| 9 | %><%= (idx += 1) == 1 ? nil : '+' %><%= key %><% 10 | end %><% 11 | end %> 12 | -------------------------------------------------------------------------------- /erb/html5/inline_menu.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | menu = attr 'menu' 3 | submenus = attr 'submenus' 4 | menuitem = attr 'menuitem' 5 | if !submenus.empty? 6 | submenu_path = submenus.map {|submenu| %(#{submenu} ▸ ) }.join.chop 7 | %><%= menu %> ▸ <%= submenu_path %> <%= menuitem %><% 8 | elsif !menuitem.nil? 9 | %><%= menu %> ▸ <%= menuitem %><% 10 | else 11 | %><%= menu %><% 12 | end %> 13 | -------------------------------------------------------------------------------- /erb/html5/inline_quoted.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><%= @id && %() %><% 2 | class_attr = (style_class = role) ? %( class="#{style_class}") : nil 3 | case @type 4 | when :emphasis %><%= %(#{@text}) %><% 5 | when :strong %><%= %(#{@text}) %><% 6 | when :monospaced %><%= %(#{@text}) %><% 7 | when :superscript %><%= %(#{@text}) %><% 8 | when :subscript %><%= %(#{@text}) %><% 9 | when :double %><%= class_attr ? %(“#{@text}”) : %(“#{@text}”) %><% 10 | when :single %><%= class_attr ? %(‘#{@text}’) : %(‘#{@text}’) %><% 11 | when :asciimath, :latexmath 12 | open, close = Asciidoctor::INLINE_MATH_DELIMITERS[@type] %><%= %(#{open}#{@text}#{close}) %><% 13 | else %><%= class_attr ? %(#{@text}) : @text %><% 14 | end %> 15 | -------------------------------------------------------------------------------- /erb/html5/section.html.erb: -------------------------------------------------------------------------------- 1 | <%#encoding:UTF-8%><% 2 | slevel = @level.zero? && @special ? 1 : @level 3 | anchor = link_start = link_end = nil 4 | if @id 5 | if @document.attr? :sectanchors 6 | anchor = %() 7 | elsif @document.attr? :sectlinks 8 | link_start = %() 9 | link_end = '' 10 | end 11 | end 12 | if slevel.zero? 13 | %> class="sect0"><%= %(#{anchor}#{link_start}#{title}#{link_end}) %> 14 | <%= content %><% 15 | else 16 | snum = @numbered && @caption.nil? && slevel <= (@document.attr 'sectnumlevels', 3).to_i ? %(#{sectnum} ) : nil 17 | hlevel = slevel + 1 18 | %>
    19 | <%= @id && %( id="#{@id}") %>><%= %(#{anchor}#{link_start}#{snum}#{captioned_title}#{link_end}) %>><% 20 | if slevel == 1 %> 21 |
    22 | <%= content %> 23 |
    <% 24 | else %> 25 | <%= content %><% 26 | end %> 27 |
    <% 28 | end %> 29 | -------------------------------------------------------------------------------- /erb/manpage/README.adoc: -------------------------------------------------------------------------------- 1 | The manpage backend templates are now *deprecated* since the manpage converter has been integrated into core. 2 | 3 | $ asciidoctor -b manpage sample.adoc 4 | -------------------------------------------------------------------------------- /erb/manpage/block_admonition.erb: -------------------------------------------------------------------------------- 1 | .if n \{\ 2 | .sp 3 | .\} 4 | .RS 4 5 | .it 1 an-trap 6 | .nr an-no-space-flag 1 7 | .nr an-break-flag 1 8 | .br 9 | .ps +1 10 | \fB<%= @caption %>\fR 11 | .ps -1 12 | .br 13 | <%= manify content %> 14 | .sp .5v 15 | .RE 16 | -------------------------------------------------------------------------------- /erb/manpage/block_dlist.erb: -------------------------------------------------------------------------------- 1 | <% previous_has_content = true %><% items.each do |terms, dd| %><% 2 | if previous_has_content %>.PP 3 | <% 4 | end 5 | if !previous_has_content %>, <% end 6 | # FIXME support multiple terms per item 7 | %><%= manify [*terms].first.text, !dd.nil? %><% 8 | if !dd.nil? 9 | previous_has_content = true %>.RS 4 10 | <%= manify dd.text, false %><% 11 | if dd.blocks? %> 12 | <%= dd.content.rstrip + "\n" %><% 13 | else 14 | %><%= "\n" %><% 15 | end %>.RE 16 | <% 17 | else 18 | previous_has_content = false 19 | end 20 | end %> 21 | -------------------------------------------------------------------------------- /erb/manpage/block_listing.erb: -------------------------------------------------------------------------------- 1 | .sp 2 | .if n \{\ 3 | .RS 4 4 | .\} 5 | .nf 6 | <%= manify content, true, true %> 7 | .fi 8 | .if n \{\ 9 | .RE 10 | .\} 11 | -------------------------------------------------------------------------------- /erb/manpage/block_literal.erb: -------------------------------------------------------------------------------- 1 | .sp 2 | .if n \{\ 3 | .RS 4 4 | .\} 5 | .nf 6 | <%= manify content, true, true %> 7 | .fi 8 | .if n \{\ 9 | .RE 10 | .\} 11 | -------------------------------------------------------------------------------- /erb/manpage/block_olist.erb: -------------------------------------------------------------------------------- 1 | <% items.each_with_index do |li, idx| %>.sp 2 | .RS 4 3 | .ie n \{\ 4 | \h'-04' <%= idx + 1 %>.\h'+01'\c 5 | .\} 6 | .el \{\ 7 | .sp -1 8 | .IP " <%= idx + 1 %>." 4.2 9 | .\} 10 | <%= manify li.text %><% if li.blocks? %><%= li.content %><% end %> 11 | .RE 12 | <% end %> 13 | -------------------------------------------------------------------------------- /erb/manpage/block_paragraph.erb: -------------------------------------------------------------------------------- 1 | .sp 2 | <%= manify content %> 3 | -------------------------------------------------------------------------------- /erb/manpage/block_ulist.erb: -------------------------------------------------------------------------------- 1 | <% items.each do |li| %>.sp 2 | .RS 4 3 | .ie n \{\ 4 | \h'-04'\(bu\h'+03'\c 5 | .\} 6 | .el \{\ 7 | .sp -1 8 | .IP \(bu 2.3 9 | .\} 10 | <%= manify li.text %><% if li.blocks? %><%= li.content %><% end %> 11 | .RE 12 | <% end %> 13 | -------------------------------------------------------------------------------- /erb/manpage/block_verse.erb: -------------------------------------------------------------------------------- 1 | .sp 2 | .nf 3 | <%= manify content, true, true %> 4 | .fi 5 | -------------------------------------------------------------------------------- /erb/manpage/document.erb: -------------------------------------------------------------------------------- 1 | '\" t 2 | .\" Title: <%= doctitle.split('(').first.downcase %> 3 | .\" Author: <%= (attr? 'authors') ? (attr 'authors') : '[see the "AUTHORS" section]' %> 4 | .\" Generator: Asciidoctor <%= attr 'asciidoctor-version' %> 5 | .\" Date: <%= attr 'docdate' %> 6 | .\" Manual: <%= (manual = (attr? 'manmanual') ? (attr 'manmanual') : '\ \&') %> 7 | .\" Source: <%= (source = (attr? 'mansource') ? (attr 'mansource') : '\ \&') %> 8 | .\" Language: English 9 | .\" 10 | .TH "<%= manify doctitle.split('(').first.upcase, false %>" "<%= doctitle.split('(').last.chop %>" "<%= attr 'docdate' %>" "<%= manify source, false %>" "<%= manify manual, false %>" 11 | .ie \n(.g .ds Aq \(aq 12 | .el .ds Aq ' 13 | .nh 14 | .ad l 15 | <%= content %><% 16 | if attr? 'authors' %>.SH "AUTHOR" 17 | .PP 18 | \fB<%= attr 'authors' %>\fR 19 | .RS 4 20 | Author. 21 | .RE<% end %> 22 | -------------------------------------------------------------------------------- /erb/manpage/helpers.rb: -------------------------------------------------------------------------------- 1 | # Folds each endline into a single space, escapes special man characters, 2 | # reverts HTML entity references back to their original form, strips trailing 3 | # whitespace and, optionally, appends a newline 4 | def manify(str, append_newline = true, preserve_space = false) 5 | if preserve_space 6 | str = str.gsub("\t", (' ' * 8)) 7 | else 8 | str = str.tr_s("\n\t ", ' ') 9 | end 10 | str 11 | .gsub(/\./, '\\\&.') 12 | .gsub('-', '\\-') 13 | .gsub('<', '<') 14 | .gsub('>', '>') 15 | .gsub(' — ', ' \\(em ') 16 | .gsub('​', '') # NOTE remove zero-width space as it's something specific for HTML output 17 | .gsub('—', '\\-\\-') 18 | .gsub('’', '\\(cq') 19 | .gsub('…', '\\\&...') 20 | .gsub('\'', '\\*(Aq') 21 | .rstrip + (append_newline ? "\n" : '') 22 | end 23 | -------------------------------------------------------------------------------- /erb/manpage/inline_anchor.erb: -------------------------------------------------------------------------------- 1 | <% case @type 2 | when :link 3 | if @target.start_with? 'mailto:' %><%= @target[7..-1] %><% 4 | else %><%= @target %><% 5 | end 6 | else %><%= @target %><% 7 | end %> 8 | -------------------------------------------------------------------------------- /erb/manpage/inline_quoted.erb: -------------------------------------------------------------------------------- 1 | <% case @type 2 | when :emphasis %>\fI<%= @text %>\fR<% 3 | when :strong %>\fB<%= @text %>\fR<% 4 | else %><%= @text %><% 5 | end %> 6 | -------------------------------------------------------------------------------- /erb/manpage/section.erb: -------------------------------------------------------------------------------- 1 | .S<%= @level > 1 ? 'S' : 'H' %> "<%= @level > 1 ? title : title.upcase %>" 2 | <%= title.upcase == "NAME" ? content.gsub(/\A\.sp\n/, '') : content %> 3 | -------------------------------------------------------------------------------- /haml/deckjs/README.adoc: -------------------------------------------------------------------------------- 1 | = haml/deckjs has moved! 2 | 3 | The deck.js backend for Asciidoctor (based on Haml) has been graduated to its own repository. 4 | 5 | https://github.com/asciidoctor/asciidoctor-deck.js 6 | 7 | Please clone this repository individually to use it. 8 | -------------------------------------------------------------------------------- /haml/docbook45/block_admonition.xml.haml: -------------------------------------------------------------------------------- 1 | - haml_tag((attr :name), :id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)) do 2 | - if title? 3 | %title=title 4 | - if blocks? 5 | =content 6 | - else 7 | %simpara=content.chomp 8 | -------------------------------------------------------------------------------- /haml/docbook45/block_colist.xml.haml: -------------------------------------------------------------------------------- 1 | %calloutlist{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 2 | - if title? 3 | %title=title 4 | - items.each do |item| 5 | %callout{:arearefs=>(item.attr :coids)} 6 | %para=item.text 7 | - if item.blocks? 8 | =item.content 9 | -------------------------------------------------------------------------------- /haml/docbook45/block_dlist.xml.haml: -------------------------------------------------------------------------------- 1 | - case attr :style 2 | - when 'qanda' 3 | %qandaset{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 4 | - if title? 5 | %title=title 6 | - items.each do |terms, dd| 7 | %qandaentry 8 | %question 9 | - [*terms].each do |dt| 10 | %simpara=dt.text 11 | - unless dd.nil? 12 | %answer 13 | - if dd.text? 14 | %simpara=dd.text 15 | - if dd.blocks? 16 | =dd.content 17 | - when 'glossary' 18 | - items.each do |terms, dd| 19 | %glossentry 20 | - [*terms].each do |dt| 21 | %glossterm=dt.text 22 | - unless dd.nil? 23 | %glossdef 24 | - if dd.text? 25 | %simpara=dd.text 26 | - if dd.blocks? 27 | =dd.content 28 | - when 'horizontal' 29 | - haml_tag((title? ? 'table' : 'informaltable'), :id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext), 30 | :tabstyle=>'horizontal', :frame=>'none', :colsep=>0, :rowsep=>0) do 31 | - if title? 32 | %title=title 33 | %tgroup(cols=2) 34 | %colspec(colwidth="#{attr :labelwidth, 15}*")/ 35 | %colspec(colwidth="#{attr :labelwidth, 85}*")/ 36 | %tbody(valign='top') 37 | - items.each do |terms, dd| 38 | %row 39 | %entry 40 | - [*terms].each do |dt| 41 | %simpara=dt.text 42 | - unless dd.nil? 43 | %entry 44 | - if dd.text? 45 | %simpara=dd.text 46 | - if dd.blocks? 47 | =dd.content 48 | - else 49 | %variablelist{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 50 | - if title? 51 | %title=title 52 | - items.each do |terms, dd| 53 | %varlistentry 54 | - [*terms].each do |dt| 55 | %term=dt.text 56 | - unless dd.nil? 57 | %listitem 58 | - if dd.text? 59 | %simpara=dd.text 60 | - if dd.blocks? 61 | =dd.content 62 | -------------------------------------------------------------------------------- /haml/docbook45/block_example.xml.haml: -------------------------------------------------------------------------------- 1 | - if title? 2 | %example{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 3 | - if title? 4 | %title=title 5 | - if blocks? 6 | =content 7 | - else 8 | %simpara=content.chomp 9 | - else 10 | %informalexample{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 11 | - if blocks? 12 | =content 13 | - else 14 | %simpara=content.chomp 15 | -------------------------------------------------------------------------------- /haml/docbook45/block_floating_title.xml.haml: -------------------------------------------------------------------------------- 1 | %bridgehead{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext), :renderas=>"sect#@level"}=title 2 | -------------------------------------------------------------------------------- /haml/docbook45/block_image.xml.haml: -------------------------------------------------------------------------------- 1 | %figure{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 2 | - if title? 3 | %title=title 4 | %mediaobject 5 | %imageobject 6 | %imagedata{:fileref=>image_uri(attr :target), :contentwidth=>(attr :width), :contentdepth=>(attr :height), :scale=>(attr :scale), :width=>(attr :scaledwidth), :scalefit=>((attr? :scaledwidth) ? 1 : nil), :align=>(attr :align)} 7 | %textobject 8 | %phrase=attr :alt 9 | -------------------------------------------------------------------------------- /haml/docbook45/block_listing.xml.haml: -------------------------------------------------------------------------------- 1 | - if !title? 2 | - if attr?(:style, 'source') && attr?(:language) 3 | %programlisting{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext), :language=>(attr :language), 4 | :linenumbering=>((attr? :linenums) ? 'numbered' : 'unnumbered')}=content 5 | - else 6 | %screen{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)}=content 7 | - else 8 | %formalpara{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 9 | %title=title 10 | %para 11 | - if attr?(:style, 'source') && attr?(:language) 12 | %programlisting{:language=>(attr :language), :linenumbering=>((attr? :linenums) ? 'numbered' : 'unnumbered')}=content 13 | - else 14 | %screen=content 15 | -------------------------------------------------------------------------------- /haml/docbook45/block_literal.xml.haml: -------------------------------------------------------------------------------- 1 | - if !title? 2 | %literallayout{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext), :class=>'monospaced'}=content 3 | - else 4 | %formalpara{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 5 | %title=title 6 | %para 7 | %literallayout(class='monospaced')=content 8 | -------------------------------------------------------------------------------- /haml/docbook45/block_olist.xml.haml: -------------------------------------------------------------------------------- 1 | %orderedlist{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext), :numeration=>(attr :style)} 2 | - if title? 3 | %title=title 4 | - items.each do |item| 5 | %listitem 6 | %simpara=item.text 7 | - if item.blocks? 8 | =item.content 9 | -------------------------------------------------------------------------------- /haml/docbook45/block_open.xml.haml: -------------------------------------------------------------------------------- 1 | - case attr 'style' 2 | - when 'abstract' 3 | - if @parent == @document && @document.doctype == 'book' 4 | - puts 'asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.' 5 | - else 6 | %abstract 7 | - if title? 8 | %title=title 9 | - if blocks? 10 | =content 11 | - else 12 | %simpara=content 13 | - when 'partintro' 14 | - unless @document.doctype == 'book' && @parent.context == :section && @level == 0 15 | - puts 'asciidoctor: ERROR: partintro block can only be used when doctype is book and its a child of a part section. Excluding block content.' 16 | - else 17 | %partintro{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 18 | - if title? 19 | %title=title 20 | - if blocks? 21 | =content 22 | - else 23 | %simpara=content 24 | - else 25 | =content 26 | -------------------------------------------------------------------------------- /haml/docbook45/block_page_break.xml.haml: -------------------------------------------------------------------------------- 1 | %simpara 2 | -------------------------------------------------------------------------------- /haml/docbook45/block_paragraph.xml.haml: -------------------------------------------------------------------------------- 1 | - if title? 2 | %formalpara{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 3 | %title=title 4 | %para=content 5 | - else 6 | %simpara{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)}=content 7 | -------------------------------------------------------------------------------- /haml/docbook45/block_pass.xml.haml: -------------------------------------------------------------------------------- 1 | =content 2 | -------------------------------------------------------------------------------- /haml/docbook45/block_preamble.xml.haml: -------------------------------------------------------------------------------- 1 | - if @document.doctype == 'book' 2 | %preface{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 3 | -# title is mandatory, but can be an empty tag 4 | %title=title 5 | =content 6 | - else 7 | =content 8 | -------------------------------------------------------------------------------- /haml/docbook45/block_quote.xml.haml: -------------------------------------------------------------------------------- 1 | %blockquote{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 2 | - if title? 3 | %title=title 4 | - if (attr? :attribution) || (attr? :citetitle) 5 | %attribution 6 | - if attr? :attribution 7 | =attr :attribution 8 | - if attr? :citetitle 9 | %citetitle=attr :citetitle 10 | - if blocks? 11 | =content 12 | - else 13 | %simpara=content.chomp 14 | -------------------------------------------------------------------------------- /haml/docbook45/block_sidebar.xml.haml: -------------------------------------------------------------------------------- 1 | %sidebar{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 2 | - if title? 3 | %title=title 4 | - if blocks? 5 | =content 6 | - else 7 | %simpara=content.chomp 8 | -------------------------------------------------------------------------------- /haml/docbook45/block_table.xml.haml: -------------------------------------------------------------------------------- 1 | - haml_tag((title? ? 'table' : 'informaltable'), :id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext), 2 | :frame=>(attr :frame, 'all'), :rowsep=>['none', 'cols'].include?(attr :grid) ? 0 : 1, :colsep=>['none', 'rows'].include?(attr :grid) ? 0 : 1) do 3 | - if title? 4 | %title=title 5 | - if attr? :width 6 | 7 | 8 | 9 | %tgroup{:cols=>(attr :colcount)} 10 | - @columns.each do |col| 11 | %colspec(colname="col_#{col.attr :colnumber}" colwidth="#{col.attr((attr? :width) ? :colabswidth : :colpcwidth)}*")/ 12 | - [:head, :foot, :body].select {|tblsec| !@rows[tblsec].empty? }.each do |tblsec| 13 | - haml_tag "t#{tblsec}" do 14 | - @rows[tblsec].each do |row| 15 | %row 16 | - row.each do |cell| 17 | %entry{:align=>(cell.attr :halign), :valign=>(cell.attr :valign), 18 | :namest=>(cell.colspan && "col_#{cell.column.attr :colnumber}"), 19 | :nameend=>(cell.colspan && "col_#{(cell.column.attr :colnumber) + cell.colspan - 1}"), 20 | :morerows=>(cell.rowspan && (cell.rowspan - 1))} 21 | - if tblsec == :head 22 | =cell.text 23 | - else 24 | - case cell.attr :style 25 | - when :asciidoc 26 | =cell.content 27 | - when :verse 28 | %literallayout=cell.text 29 | - when :literal 30 | %literallayout(class='monospaced')=cell.text 31 | - when :header 32 | - cell.content.each do |text| 33 | %simpara 34 | %emphasis(role='strong')=text 35 | - else 36 | - cell.content.each do |text| 37 | %simpara=text 38 | -------------------------------------------------------------------------------- /haml/docbook45/block_thematic_break.xml.haml: -------------------------------------------------------------------------------- 1 | %simpara 2 | 3 | -------------------------------------------------------------------------------- /haml/docbook45/block_ulist.xml.haml: -------------------------------------------------------------------------------- 1 | - if attr? :style, 'bibliography' 2 | %bibliodiv{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 3 | - if title? 4 | %title=title 5 | - items.each do |item| 6 | %bibliomixed 7 | %bibliomisc=item.text 8 | - if item.blocks? 9 | =item.content 10 | - else 11 | %itemizedlist{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 12 | - if title? 13 | %title=title 14 | - items.each do |item| 15 | %listitem 16 | %simpara=item.text 17 | - if item.blocks? 18 | =item.content 19 | -------------------------------------------------------------------------------- /haml/docbook45/block_verse.xml.haml: -------------------------------------------------------------------------------- 1 | %blockquote{:id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 2 | - if title? 3 | %title=title 4 | - if (attr? :attribution) || (attr? :citetitle) 5 | %attribution 6 | - if attr? :attribution 7 | =attr :attribution 8 | - if attr? :citetitle 9 | %citetitle=attr :citetitle 10 | %literallayout=content 11 | -------------------------------------------------------------------------------- /haml/docbook45/document.xml.haml: -------------------------------------------------------------------------------- 1 | - docinfo = capture_haml do 2 | - if has_header? && !notitle 3 | - segments = @header.title.rpartition(': ') 4 | - if segments.first.empty? 5 | %title=segments.last 6 | - else 7 | %title=segments.first 8 | %subtitle=segments.last 9 | %date=(attr? :revdate) ? (attr :revdate) : (attr :docdate) 10 | - if has_header? 11 | - if attr? :author 12 | - if attr? :authorcount, 1 13 | %author 14 | - if attr? :firstname 15 | %firstname=attr :firstname 16 | - if attr? :middlename 17 | %othername=attr :middlename 18 | - if attr? :lastname 19 | %surname=attr :lastname 20 | - if attr? :email 21 | %email=attr :email 22 | %authorinitials=attr :authorinitials 23 | - else 24 | %authorgroup 25 | - (1..(attr :authorcount)).each do |idx| 26 | %author 27 | - if attr? "firstname_#{idx}" 28 | %firstname=attr "firstname_#{idx}" 29 | - if attr? "middlename_#{idx}" 30 | %othername=attr "middlename_#{idx}" 31 | - if attr? "lastname_#{idx}" 32 | %surname=attr "lastname_#{idx}" 33 | - if attr? "email_#{idx}" 34 | %email=attr "email_#{idx}" 35 | -# this check seems weak 36 | - if (attr? :revdate) && ((attr? :revnumber) || (attr? :revremark)) 37 | %revhistory 38 | %revision 39 | - if attr? :revnumber 40 | %revnumber=attr :revnumber 41 | %date=attr :revdate 42 | - if attr? :authorinitials 43 | %authorinitials=attr :authorinitials 44 | - if attr? :revremark 45 | %revremark=attr :revremark 46 | 47 | 48 | - if attr? :toc 49 | 50 | - if attr? :sectnums 51 | 52 | - case doctype 53 | - when 'book' 54 | %book{:lang=>(attr :lang, 'en' unless attr? :nolang)} 55 | %bookinfo 56 | =docinfo 57 | =content 58 | - when 'article' 59 | %article{:lang=>(attr :lang, 'en' unless attr? :nolang)} 60 | %articleinfo 61 | =docinfo 62 | =content 63 | -------------------------------------------------------------------------------- /haml/docbook45/embedded.xml.haml: -------------------------------------------------------------------------------- 1 | =content 2 | -------------------------------------------------------------------------------- /haml/docbook45/helpers.rb: -------------------------------------------------------------------------------- 1 | # Add custom functions to this module that you want to use in your Haml 2 | # templates. Within the template you can invoke them as top-level functions 3 | # just like the built-in helper functions that Haml provides. 4 | module Haml::Helpers 5 | #def a_helper_function 6 | #end 7 | end 8 | -------------------------------------------------------------------------------- /haml/docbook45/inline_anchor.xml.haml: -------------------------------------------------------------------------------- 1 | - case @type 2 | - when :ref 3 | %anchor{:id=>@target, :xreflabel=>@text}/ 4 | - when :xref 5 | - if @text.nil? 6 | %xref{:linkend=>@target}/ 7 | - else 8 | %link{:linkend=>@target}=@text 9 | - when :link 10 | %ulink{:url=>@target}=@text 11 | - when :bibref 12 | %anchor{:id=>@target, :xreflabel=>"[#@target]"} 13 | [#{@target}] 14 | -------------------------------------------------------------------------------- /haml/docbook45/inline_break.xml.haml: -------------------------------------------------------------------------------- 1 | =@text 2 | 3 | -------------------------------------------------------------------------------- /haml/docbook45/inline_callout.xml.haml: -------------------------------------------------------------------------------- 1 | %co(id=@id)/ 2 | -------------------------------------------------------------------------------- /haml/docbook45/inline_footnote.xml.haml: -------------------------------------------------------------------------------- 1 | - if @type == :xref 2 | %footnoteref(linkend=@target)/ 3 | - else 4 | %footnote(id=@id) 5 | %simpara=@text 6 | -------------------------------------------------------------------------------- /haml/docbook45/inline_image.xml.haml: -------------------------------------------------------------------------------- 1 | %inlinemediaobject 2 | %imageobject 3 | %imagedata{:fileref=>image_uri(@target), :contentwidth=>(attr :width), :contentdepth=>(attr :height)} 4 | %textobject 5 | %phrase=attr :alt 6 | -------------------------------------------------------------------------------- /haml/docbook45/inline_indexterm.xml.haml: -------------------------------------------------------------------------------- 1 | - if @type == :visible 2 | %indexterm> 3 | %primary=@text 4 | =@text 5 | - else 6 | - terms = (attr :terms) 7 | - numterms = terms.size 8 | - if numterms > 2 9 | %indexterm< 10 | %primary=terms[0] 11 | %secondary>=terms[1] 12 | %tertiary>=terms[2] 13 | - if numterms > 1 14 | %indexterm< 15 | %primary=terms[numterms - 2] 16 | %secondary>=terms[numterms - 1] 17 | %indexterm< 18 | %primary=terms[numterms - 1] 19 | -------------------------------------------------------------------------------- /haml/docbook45/inline_quoted.xml.haml: -------------------------------------------------------------------------------- 1 | - if attr? :role 2 | - text = "#@text" 3 | - else 4 | - text = @text 5 | - case @type 6 | - when :emphasis 7 | %emphasis=text 8 | - when :strong 9 | %emphasis(role='strong')=text 10 | - when :monospaced 11 | %literal=text 12 | - when :superscript 13 | %superscript=text 14 | - when :subscript 15 | %subscript=text 16 | - when :double 17 | \“#{text}” 18 | - when :single 19 | \‘#{text}’ 20 | - else 21 | =text 22 | -------------------------------------------------------------------------------- /haml/docbook45/section.xml.haml: -------------------------------------------------------------------------------- 1 | - haml_tag((@special ? (@level <= 1 ? @sectname : 'section') : (@document.doctype == 'book' && @level <= 1 ? (@level == 0 ? 'part' : 'chapter') : 'section')), 2 | :id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)) do 3 | - if title? 4 | %title=title 5 | =content 6 | -------------------------------------------------------------------------------- /haml/html5/block_admonition.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['admonitionblock', (attr :name), role]} 2 | %table 3 | %tr 4 | %td.icon 5 | - if @document.attr? :icons, 'font' 6 | %i{:class=>"fa icon-#{attr :name}", :title=>@caption} 7 | - elsif @document.attr? :icons 8 | %img{:src=>icon_uri(attr :name), :alt=>@caption} 9 | - else 10 | .title=@caption 11 | %td.content 12 | - if title? 13 | .title=title 14 | =content 15 | -------------------------------------------------------------------------------- /haml/html5/block_audio.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['audioblock', @style, role]} 2 | - if title? 3 | .title=captioned_title 4 | .content 5 | %audio{:src=>media_uri(attr :target), :autoplay=>(option? :autoplay), 6 | :controls=>!(option? :nocontrols), :loop=>(option? :loop)} 7 | Your browser does not support the audio tag. 8 | -------------------------------------------------------------------------------- /haml/html5/block_colist.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['colist', @style, role]} 2 | - if title? 3 | .title=title 4 | - if @document.attr? :icons 5 | - font_icons = @document.attr? :icons, 'font' 6 | %table 7 | - items.each_with_index do |item, i| 8 | - num = i + 1 9 | %tr 10 | %td< 11 | - if font_icons 12 | %i.conum{:data=>{:value=>num}}> 13 | %b=num 14 | - else 15 | %img{:src=>icon_uri("callouts/#{num}"), :alt=>num} 16 | %td=item.text 17 | - else 18 | %ol 19 | - items.each do |item| 20 | %li 21 | %p=item.text 22 | -------------------------------------------------------------------------------- /haml/html5/block_dlist.html.haml: -------------------------------------------------------------------------------- 1 | - case @style 2 | - when 'qanda' 3 | %div{:id=>@id, :class=>['qlist', 'qanda', role]} 4 | - if title? 5 | .title=title 6 | %ol 7 | - items.each do |questions, answer| 8 | %li 9 | - [*questions].each do |question| 10 | %p< 11 | %em=question.text 12 | - unless answer.nil? 13 | - if answer.text? 14 | %p<=answer.text 15 | - if answer.blocks? 16 | =answer.content 17 | - when 'horizontal' 18 | %div{:id=>@id, :class=>['hdlist', role]} 19 | - if title? 20 | .title=title 21 | %table 22 | - if (attr? :labelwidth) || (attr? :itemwidth) 23 | %colgroup 24 | %col{:style=>((attr? :labelwidth) ? %(width:#{(attr :labelwidth).chomp '%'}%;) : nil)} 25 | %col{:style=>((attr? :itemwidth) ? %(width:#{(attr :itemwidth).chomp '%'}%;) : nil)} 26 | - items.each do |terms, dd| 27 | %tr 28 | %td{:class=>['hdlist1', ('strong' if (option? :strong))]} 29 | - terms = [*terms] 30 | - last_term = terms.last 31 | - terms.each do |dt| 32 | =dt.text 33 | - if dt != last_term 34 | %br 35 | %td.hdlist2 36 | - unless dd.nil? 37 | - if dd.text? 38 | %p<=dd.text 39 | - if dd.blocks? 40 | =dd.content 41 | - else 42 | %div{:id=>@id, :class=>['dlist', @style, role]} 43 | - if title? 44 | .title=title 45 | %dl 46 | - items.each do |terms, dd| 47 | - [*terms].each do |dt| 48 | %dt{:class=>('hdlist1' unless @style)}=dt.text 49 | - unless dd.nil? 50 | %dd 51 | - if dd.text? 52 | %p<=dd.text 53 | - if dd.blocks? 54 | =dd.content 55 | -------------------------------------------------------------------------------- /haml/html5/block_example.haml.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['exampleblock', role]} 2 | - if title? 3 | .title=captioned_title 4 | .content 5 | =content 6 | -------------------------------------------------------------------------------- /haml/html5/block_floating_title.html.haml: -------------------------------------------------------------------------------- 1 | - haml_tag "h#{@level + 1}##{@id}", title, :class => [@style, role] 2 | -------------------------------------------------------------------------------- /haml/html5/block_image.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['imageblock', @style, role], 2 | :style=>((css_style = [("text-align: #{attr :align}" if attr? :align), 3 | ("float: #{attr :float}" if attr? :float)].compact * '; ').empty? ? nil : css_style)} 4 | .content 5 | - if attr? :link 6 | %a.image{:href=>(attr :link)} 7 | %img{:src=>image_uri(attr :target), :alt=>(attr :alt), :width=>(attr :width), :height=>(attr :height)} 8 | - else 9 | %img{:src=>image_uri(attr :target), :alt=>(attr :alt), :width=>(attr :width), :height=>(attr :height)} 10 | - if title? 11 | .title=captioned_title 12 | -------------------------------------------------------------------------------- /haml/html5/block_listing.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['listingblock', role]} 2 | - if title? 3 | .title=captioned_title 4 | .content 5 | - nowrap = !(@document.attr? :prewrap) || (option? :nowrap) 6 | - if @style == 'source' 7 | - code_lang = attr :language, nil, false 8 | - code_class = ["language-#{code_lang}"] if code_lang 9 | - pre_class = ['highlight'] 10 | - pre_lang = nil 11 | - case document.attr 'source-highlighter' 12 | - when 'coderay' 13 | - pre_class.unshift 'CodeRay' 14 | - code_class = nil 15 | - when 'pygments' 16 | - pre_class.unshift 'pygments' 17 | - code_class = nil 18 | - when 'highlightjs', 'highlight.js' 19 | - pre_class.unshift 'highlightjs' 20 | - when 'prettify' 21 | - pre_class.unshift 'prettyprint' 22 | - pre_class << 'linenums' if attr? :linenums 23 | - when 'html-pipeline' 24 | - pre_lang = code_lang 25 | - code_class = code_lang = pre_class = nil 26 | - nowrap = false 27 | - pre_class << 'nowrap' if nowrap 28 | %pre{:class=>pre_class, :lang=>pre_lang} 29 | %code{:class=>code_class, 'data-lang'=>code_lang} 30 | :preserve 31 | #{content} 32 | - else 33 | %pre{:class=>('nowrap' if nowrap)}=content 34 | -------------------------------------------------------------------------------- /haml/html5/block_literal.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['literalblock', role]} 2 | - if title? 3 | .title=title 4 | .content 5 | %pre{:class=>(!(@document.attr? :prewrap) || (option? :nowrap) ? 'nowrap' : nil)}=content 6 | -------------------------------------------------------------------------------- /haml/html5/block_olist.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['olist', @style, role]} 2 | - if title? 3 | .title=title 4 | %ol{:class=>@style, :start=>(attr :start), :type=>list_marker_keyword} 5 | - items.each do |item| 6 | %li 7 | %p=item.text 8 | - if item.blocks? 9 | =item.content 10 | -------------------------------------------------------------------------------- /haml/html5/block_open.html.haml: -------------------------------------------------------------------------------- 1 | - if @style == 'abstract' 2 | - if @parent == @document && @document.doctype == 'book' 3 | - puts 'asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.' 4 | - else 5 | %div{:id=>@id, :class=>['quoteblock', 'abstract', role]} 6 | - if title? 7 | .title=title 8 | %blockquote=content 9 | - elsif @style == 'partintro' && (@document.doctype != 'book' || @parent.context != :section || @level != 0) 10 | - puts 'asciidoctor: ERROR: partintro block can only be used when doctype is book and it\'s a child of a book part. Excluding block content.' 11 | - else 12 | %div{:id=>@id, :class=>['openblock', (@style != 'open' ? @style : nil), role]} 13 | - if title? 14 | .title=title 15 | .content 16 | =content 17 | -------------------------------------------------------------------------------- /haml/html5/block_outline.html.haml: -------------------------------------------------------------------------------- 1 | - unless sections.empty? 2 | - toclevels ||= (document.attr 'toclevels', 2).to_i 3 | - slevel = section_level sections.first 4 | %ul{:class=>"sectlevel#{slevel}"} 5 | - sections.each do |sec| 6 | %li 7 | %a{:href=>"##{sec.id}"}= section_title sec 8 | - if (sec.level < toclevels) && (child_toc = converter.convert sec, 'outline') 9 | = child_toc 10 | -------------------------------------------------------------------------------- /haml/html5/block_page_break.html.haml: -------------------------------------------------------------------------------- 1 | %div(style='page-break-after: always;') 2 | -------------------------------------------------------------------------------- /haml/html5/block_paragraph.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['paragraph', role]}> 2 | - if title? 3 | .title=title 4 | %p<=content 5 | -------------------------------------------------------------------------------- /haml/html5/block_pass.html.haml: -------------------------------------------------------------------------------- 1 | =content 2 | -------------------------------------------------------------------------------- /haml/html5/block_preamble.html.haml: -------------------------------------------------------------------------------- 1 | #preamble 2 | .sectionbody 3 | =content 4 | - if (attr? :toc) && (attr? 'toc-placement', 'preamble') 5 | #toc{:class=>(attr 'toc-class', 'toc')} 6 | #toctitle=(attr 'toc-title') 7 | =converter.convert @document, 'outline' 8 | -------------------------------------------------------------------------------- /haml/html5/block_quote.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['quoteblock', role]} 2 | - if title? 3 | .title=title 4 | %blockquote=content 5 | - if (attr? :attribution) or (attr? :citetitle) 6 | .attribution 7 | - if attr? :attribution 8 | — #{attr :attribution} 9 | - if attr? :citetitle 10 | - if attr? :attribution 11 | %br 12 | %cite=attr :citetitle 13 | -------------------------------------------------------------------------------- /haml/html5/block_sidebar.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['sidebarblock', role]} 2 | .content 3 | - if title? 4 | .title=title 5 | =content 6 | -------------------------------------------------------------------------------- /haml/html5/block_stem.html.haml: -------------------------------------------------------------------------------- 1 | - open, close = Asciidoctor::BLOCK_MATH_DELIMITERS[@style.to_sym] 2 | - equation = content 3 | - unless (equation.start_with? open) && (equation.end_with? close) 4 | - equation = %(#{open}#{equation}#{close}) 5 | %div{:id=>@id, :class=>['stemblock', role]} 6 | - if title? 7 | .title=title 8 | .content=equation 9 | -------------------------------------------------------------------------------- /haml/html5/block_table.html.haml: -------------------------------------------------------------------------------- 1 | %table{:id=>@id, :class=>['tableblock', "frame-#{attr :frame, 'all'}", "grid-#{attr :grid, 'all'}", spread?, role], 2 | :style=>((css_style = [("width: #{attr :tablepcwidth}%;" unless autowidth? || spread?), 3 | ("float: #{attr :float};" if attr? :float)].compact * ' ').empty? ? nil : css_style)} 4 | - if title? 5 | %caption.title=captioned_title 6 | - unless (attr :rowcount).zero? 7 | %colgroup 8 | - if autowidth? 9 | - @columns.each do 10 | %col 11 | - else 12 | - @columns.each do |col| 13 | %col(style="width: #{col.attr :colpcwidth}%;") 14 | - [:head, :foot, :body].select {|tblsec| !@rows[tblsec].empty? }.each do |tblsec| 15 | - haml_tag "t#{tblsec}" do 16 | - @rows[tblsec].each do |row| 17 | %tr 18 | - row.each do |cell| 19 | -# store reference of content in advance to resolve attribute assignments in cells 20 | - if tblsec == :head 21 | - cell_content = cell.text 22 | - else 23 | - case cell.style 24 | - when :verse, :literal 25 | - cell_content = cell.text 26 | - else 27 | - cell_content = cell.content 28 | - cell_css_style = (@document.attr? :cellbgcolor) ? %(background-color: #{@document.attr :cellbgcolor};) : nil 29 | - haml_tag (tblsec == :head || cell.style == :header ? 'th' : 'td'), :<, :class=>['tableblock', "halign-#{cell.attr :halign}", "valign-#{cell.attr :valign}"], 30 | :colspan=>cell.colspan, :rowspan=>cell.rowspan, :style=>cell_css_style do 31 | - if tblsec == :head 32 | =cell_content 33 | - else 34 | - case cell.style 35 | - when :asciidoc 36 | %div=cell_content 37 | - when :verse 38 | .verse~cell_content 39 | - when :literal 40 | .literal 41 | %pre=cell_content 42 | - else 43 | - cell_content.each do |text| 44 | %p.tableblock<=text 45 | -------------------------------------------------------------------------------- /haml/html5/block_thematic_break.html.haml: -------------------------------------------------------------------------------- 1 | %hr 2 | -------------------------------------------------------------------------------- /haml/html5/block_toc.html.haml: -------------------------------------------------------------------------------- 1 | - if @document.attr? :toc 2 | - toc_id = @id 3 | - toc_role = (attr 'role', (@document.attr 'toc-class', 'toc')) 4 | - toc_title_id = "#{toc_id}title" if toc_id 5 | - toc_title = title? ? title : (@document.attr 'toc-title') 6 | - if !toc_id && (@document.embedded? || !(@document.attr? 'toc-placement')) 7 | - toc_id = 'toc' 8 | - toc_title_id = 'toctitle' 9 | %div{:id=>toc_id, :class=>toc_role} 10 | .title{:id=>toc_title_id}=toc_title 11 | =converter.convert_with_options @document, 'outline', :toclevels => ((attr? :levels) ? (attr :levels).to_i : nil) 12 | -------------------------------------------------------------------------------- /haml/html5/block_ulist.html.haml: -------------------------------------------------------------------------------- 1 | - if (checklist = (option? :checklist) ? 'checklist' : nil) 2 | - if option? :interactive 3 | - marker_checked = '' 4 | - marker_unchecked = '' 5 | - else 6 | - if @document.attr? :icons, 'font' 7 | - marker_checked = '' 8 | - marker_unchecked = '' 9 | - else 10 | - marker_checked = '✓' 11 | - marker_unchecked = '❏' 12 | %div{:id=>@id, :class=>['ulist', checklist, @style, role]} 13 | - if title? 14 | .title=title 15 | %ul{:class=>(checklist || @style)} 16 | - items.each do |item| 17 | %li 18 | %p< 19 | - if checklist && (item.attr? :checkbox) 20 | =%(#{(item.attr? :checked) ? marker_checked : marker_unchecked} #{item.text}) 21 | - else 22 | =item.text 23 | - if item.blocks? 24 | =item.content 25 | -------------------------------------------------------------------------------- /haml/html5/block_verse.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['verseblock', role]} 2 | - if title? 3 | .title=title 4 | %pre.content=content 5 | - if (attr? :attribution) or (attr? :citetitle) 6 | .attribution 7 | - if attr? :attribution 8 | — #{attr :attribution} 9 | - if attr? :citetitle 10 | - if attr? :attribution 11 | %br 12 | %cite=attr :citetitle 13 | -------------------------------------------------------------------------------- /haml/html5/block_video.html.haml: -------------------------------------------------------------------------------- 1 | %div{:id=>@id, :class=>['videoblock', @style, role]} 2 | - if title? 3 | .title=captioned_title 4 | .content 5 | - if video_iframe? 6 | %iframe{:width=>(attr :width), :height=>(attr :height), :src=>video_uri, :frameborder=>0, :allowfullscreen=>!(option? :nofullscreen)} 7 | - else 8 | %video{:src=>video_uri, :width=>(attr :width), :height=>(attr :height), 9 | :poster=>((attr :poster) ? media_uri(attr :poster) : nil), :autoplay=>(option? :autoplay), 10 | :controls=>!(option? :nocontrols), :loop=>(option? :loop)} 11 | Your browser does not support the video tag. 12 | -------------------------------------------------------------------------------- /haml/html5/embedded.html.haml: -------------------------------------------------------------------------------- 1 | - unless notitle || !has_header? 2 | %h1{:id=>@id}=@header.title 3 | =content 4 | - unless !footnotes? || attr?(:nofootnotes) 5 | #footnotes 6 | %hr 7 | - footnotes.each do |fn| 8 | .footnote{:id=>['_footnote', fn.index]} 9 | = succeed ". #{fn.text}" do 10 | %a(href="#_footnoteref_#{fn.index}")=fn.index 11 | -------------------------------------------------------------------------------- /haml/html5/helpers.rb: -------------------------------------------------------------------------------- 1 | # Add custom functions to this module that you want to use in your Haml 2 | # templates. Within the template you can invoke them as top-level functions 3 | # just like the built-in helper functions that Haml provides. 4 | module Haml::Helpers 5 | 6 | ## 7 | # Returns corrected section level. 8 | # 9 | # @param sec [Asciidoctor::Section] the section node (default: self). 10 | # @return [Integer] 11 | # 12 | def section_level(sec = self) 13 | @_section_level ||= (sec.level == 0 && sec.special) ? 1 : sec.level 14 | end 15 | 16 | ## 17 | # Returns the captioned section's title, optionally numbered. 18 | # 19 | # @param sec [Asciidoctor::Section] the section node (default: self). 20 | # @return [String] 21 | # 22 | def section_title(sec = self) 23 | sectnumlevels = document.attr(:sectnumlevels, 3).to_i 24 | 25 | if sec.numbered && !sec.caption && sec.level <= sectnumlevels 26 | [sec.sectnum, sec.captioned_title].join(' ') 27 | else 28 | sec.captioned_title 29 | end 30 | end 31 | 32 | #-------------------------------------------------------- 33 | # block_table 34 | # 35 | 36 | def autowidth? 37 | option? :autowidth 38 | end 39 | 40 | def spread? 41 | 'spread' if !(option? 'autowidth') && (attr :tablepcwidth) == 100 42 | end 43 | 44 | #-------------------------------------------------------- 45 | # block_video 46 | # 47 | 48 | # @return [Boolean] +true+ if the video should be embedded in an iframe. 49 | def video_iframe? 50 | ['vimeo', 'youtube'].include?(attr :poster) 51 | end 52 | 53 | def video_uri 54 | case (attr :poster, '').to_sym 55 | when :vimeo 56 | params = { 57 | :autoplay => (1 if option? 'autoplay'), 58 | :loop => (1 if option? 'loop') 59 | } 60 | start_anchor = "#at=#{attr :start}" if attr? :start 61 | "//player.vimeo.com/video/#{attr :target}#{start_anchor}#{url_query params}" 62 | 63 | when :youtube 64 | video_id, list_id = (attr :target).split('/', 2) 65 | params = { 66 | :rel => 0, 67 | :start => (attr :start), 68 | :end => (attr :end), 69 | :list => (attr :list, list_id), 70 | :autoplay => (1 if option? 'autoplay'), 71 | :loop => (1 if option? 'loop'), 72 | :controls => (0 if option? 'nocontrols') 73 | } 74 | "//www.youtube.com/embed/#{video_id}#{url_query params}" 75 | else 76 | anchor = [(attr :start), (attr :end)].join(',').chomp(',') 77 | anchor.prepend '#t=' unless anchor.empty? 78 | media_uri "#{attr :target}#{anchor}" 79 | end 80 | end 81 | 82 | # Formats URL query parameters. 83 | def url_query(params) 84 | str = params.map { |k, v| 85 | next if v.nil? || v.to_s.empty? 86 | [k, v] * '=' 87 | }.compact.join('&') 88 | 89 | str.prepend('?') unless str.empty? 90 | end 91 | end 92 | -------------------------------------------------------------------------------- /haml/html5/inline_anchor.html.haml: -------------------------------------------------------------------------------- 1 | - case @type 2 | - when :xref 3 | - refid = (attr :refid) || @target 4 | %a(href="#{@target}")<=(@text || @document.references[:ids].fetch(refid, "[#{refid}]")).tr_s("\n", ' ') 5 | - when :ref 6 | %a(id=@target) 7 | - when :bibref 8 | %a(id=@target)> 9 | =%([#{@target}]) 10 | - else 11 | %a(href=@target){:id=>@id, :class=>role, :target=>(attr :window), :title=>(attr :title)}=@text 12 | -------------------------------------------------------------------------------- /haml/html5/inline_break.html.haml: -------------------------------------------------------------------------------- 1 | = precede @text do 2 | %br 3 | -------------------------------------------------------------------------------- /haml/html5/inline_button.html.haml: -------------------------------------------------------------------------------- 1 | %b.button=@text 2 | -------------------------------------------------------------------------------- /haml/html5/inline_callout.html.haml: -------------------------------------------------------------------------------- 1 | - if @document.attr? :icons, 'font' 2 | %i.conum{:data=>{:value=>@text}}> 3 | %b="(#{@text})" 4 | - elsif @document.attr? :icons 5 | %img{:src=>icon_uri("callouts/#{@text}"), :alt=>@text} 6 | - else 7 | %b.conum="(#{@text})" 8 | -------------------------------------------------------------------------------- /haml/html5/inline_footnote.html.haml: -------------------------------------------------------------------------------- 1 | - if (index = attr :index) 2 | - if @type == :xref 3 | %span.footnoteref< 4 | = surround '[', ']' do 5 | %a.footnote(href="#_footnote_#{index}" title="View footnote.")=index 6 | - else 7 | %span.footnote{:id=>(['_footnote', @id] if @id)}< 8 | = surround '[', ']' do 9 | %a.footnote(href="#_footnote_#{index}" title="View footnote."){:id=>['_footnoteref', index]}=index 10 | - elsif @type == :xref 11 | %span.footnoteref.red(title="Unresolved footnote reference.")="[#{text}]" 12 | -------------------------------------------------------------------------------- /haml/html5/inline_image.html.haml: -------------------------------------------------------------------------------- 1 | %span{:class=>[@type, role], :style=>((attr? :float) ? "float: #{attr :float}" : nil)}< 2 | - if @type == 'icon' && (@document.attr? :icons, 'font') 3 | - style_class = ["fa fa-#{@target}"] 4 | - style_class << "fa-#{attr :size}" if attr? :size 5 | - style_class << "fa-rotate-#{attr :rotate}" if attr? :rotate 6 | - style_class << "fa-flip-#{attr :flip}" if attr? :flip 7 | - if attr? :link 8 | %a.image{:href=>(attr :link), :target=>(attr :window)} 9 | %i{:class=>style_class, :title=>(attr :title)} 10 | - else 11 | %i{:class=>style_class, :title=>(attr :title)} 12 | - elsif @type == 'icon' && !(@document.attr? :icons) 13 | - if attr? :link 14 | %a.image{:href=>(attr :link), :target=>(attr :window)} 15 | [#{attr :alt}] 16 | - else 17 | [#{attr :alt}] 18 | - else 19 | - src = (@type == 'icon' ? (icon_uri @target) : (image_uri @target)) 20 | - if attr? :link 21 | %a.image{:href=>(attr :link), :target=>(attr :window)} 22 | %img{:src=>src, :alt=>(attr :alt), :width=>(attr :width), :height=>(attr :height), :title=>(attr :title)} 23 | - else 24 | %img{:src=>src, :alt=>(attr :alt), :width=>(attr :width), :height=>(attr :height), :title=>(attr :title)} 25 | -------------------------------------------------------------------------------- /haml/html5/inline_indexterm.html.haml: -------------------------------------------------------------------------------- 1 | - if @type == :visible 2 | =@text 3 | -------------------------------------------------------------------------------- /haml/html5/inline_kbd.html.haml: -------------------------------------------------------------------------------- 1 | - if (keys = attr 'keys').size == 1 2 | %kbd=keys.first 3 | - else 4 | %kbd.keyseq 5 | - keys.each_with_index do |key, idx| 6 | - unless idx.zero? 7 | ='+' 8 | %kbd>=key 9 | -------------------------------------------------------------------------------- /haml/html5/inline_menu.html.haml: -------------------------------------------------------------------------------- 1 | - menu = attr 'menu' 2 | - menuitem = attr 'menuitem' 3 | - if !(submenus = attr 'submenus').empty? 4 | %span.menuseq 5 | %span.menu>=menu 6 | =' ▸ ' 7 | =submenus.map {|submenu| %(#{submenu} ▸ ) }.join 8 | %span.menuitem>=menuitem 9 | - elsif !menuitem.nil? 10 | %span.menuseq 11 | %span.menu>=menu 12 | =' ▸ ' 13 | %span.menuitem>=menuitem 14 | - else 15 | %span.menu=menu 16 | -------------------------------------------------------------------------------- /haml/html5/inline_quoted.html.haml: -------------------------------------------------------------------------------- 1 | - unless @id.nil? 2 | %a{:id=>@id}> 3 | - case @type 4 | - when :emphasis 5 | %em{:class=>role}=@text 6 | - when :strong 7 | %strong{:class=>role}=@text 8 | - when :monospaced 9 | %code{:class=>role}=@text 10 | - when :superscript 11 | %sup{:class=>role}=@text 12 | - when :subscript 13 | %sub{:class=>role}=@text 14 | - when :mark 15 | %mark{:class=>role}=@text 16 | - when :double 17 | =(role? ? %(“#{@text}”) : %(“#{@text}”)) 18 | - when :single 19 | =(role? ? %(‘#{@text}’) : %(‘#{@text}’)) 20 | - when :asciimath, :latexmath 21 | - open, close = Asciidoctor::INLINE_MATH_DELIMITERS[@type] 22 | =%(#{open}#{@text}#{close}) 23 | - else 24 | =(role? ? %(#{@text}) : @text) 25 | -------------------------------------------------------------------------------- /haml/html5/section.html.haml: -------------------------------------------------------------------------------- 1 | - slevel = @level == 0 && @special ? 1 : @level 2 | - anchor = nil 3 | - link = nil 4 | - if @id 5 | - if @document.attr? :sectanchors 6 | - anchor = %() 7 | - link = nil 8 | - elsif @document.attr? :sectlinks 9 | - anchor = nil 10 | - link = %() 11 | - if slevel == 0 12 | %h1{:id=>@id, :class=>"sect0"}=%(#{anchor}#{link}#{title}#{link && ''}) 13 | =content 14 | - else 15 | %div{:class=>["sect#{slevel}", role]} 16 | - snum = @numbered && @caption.nil? && slevel <= (@document.attr 'sectnumlevels', 3).to_i ? %(#{sectnum} ) : nil 17 | - haml_tag "h#{slevel + 1}##{@id}", %(#{anchor}#{link}#{snum}#{captioned_title}#{link && ''}) 18 | - if slevel == 1 19 | .sectionbody 20 | =content 21 | - else 22 | =content 23 | -------------------------------------------------------------------------------- /slim/bespokejs/document.html.slim: -------------------------------------------------------------------------------- 1 | doctype 5 2 | html lang=(attr :lang, 'en' unless attr? :nolang) 3 | head 4 | meta charset='utf-8' 5 | meta name="viewport" content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui' 6 | title=(doctitle sanitize: true, use_fallback: true) 7 | link rel='stylesheet' type='text/css' href='bespoke.js/default.css' 8 | body 9 | article 10 | section 11 | h1=@header.title 12 | =content 13 | script src='bespoke.js/bespoke.js' 14 | -------------------------------------------------------------------------------- /slim/bespokejs/listing.html.slim: -------------------------------------------------------------------------------- 1 | - if @style == 'source' && (attr? :language, nil, false) 2 | pre 3 | code class="language-#{attr :language}" =content 4 | - else 5 | pre =content 6 | -------------------------------------------------------------------------------- /slim/bespokejs/paragraph.html.slim: -------------------------------------------------------------------------------- 1 | p=content 2 | -------------------------------------------------------------------------------- /slim/bespokejs/section.html.slim: -------------------------------------------------------------------------------- 1 | section class=role 2 | - title_class = (blocks? && blocks.first.context == :ulist) ? 'bullet' : nil 3 | h2 class=title_class =title 4 | =content 5 | -------------------------------------------------------------------------------- /slim/bespokejs/ulist.html.slim: -------------------------------------------------------------------------------- 1 | ul class=role 2 | - items.each do |item| 3 | li 4 | =item.text 5 | - if item.blocks? 6 | =item.content 7 | -------------------------------------------------------------------------------- /slim/docbook45/block_admonition.xml.slim: -------------------------------------------------------------------------------- 1 | *{:tag=>(attr :name), :id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 2 | - if title? 3 | title=title 4 | - if blocks? 5 | =content 6 | - else 7 | simpara=content 8 | -------------------------------------------------------------------------------- /slim/docbook45/block_colist.xml.slim: -------------------------------------------------------------------------------- 1 | calloutlist id=@id role=(attr :role) xreflabel=(attr :reftext) 2 | - if title? 3 | title=title 4 | - items.each do |item| 5 | callout arearefs=(item.attr :coids) 6 | para=item.text 7 | - if item.blocks? 8 | =item.content 9 | -------------------------------------------------------------------------------- /slim/docbook45/block_dlist.xml.slim: -------------------------------------------------------------------------------- 1 | - case attr :style 2 | - when 'qanda' 3 | qandaset id=@id role=(attr :role) xreflabel=(attr :reftext) 4 | - if title? 5 | title=title 6 | - items.each do |terms, dd| 7 | qandaentry 8 | question 9 | - [*terms].each do |dt| 10 | simpara=dt.text 11 | - unless dd.nil? 12 | answer 13 | - if dd.text? 14 | simpara=dd.text 15 | - if dd.blocks? 16 | =dd.content 17 | - when 'glossary' 18 | - items.each do |terms, dd| 19 | glossentry 20 | - [*terms].each do |dt| 21 | glossterm=dt.text 22 | - unless dd.nil? 23 | glossdef 24 | - if dd.text? 25 | simpara=dd.text 26 | - if dd.blocks? 27 | =dd.content 28 | - when 'horizontal' 29 | *{:tag=>title? ? 'table' : 'informaltable', :id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext), 30 | :tabstyle=>'horizontal', :frame=>'none', :colsep=>0, :rowsep=>0} 31 | - if title? 32 | title=title 33 | tgroup cols=2 34 | colspec colwidth="#{attr :labelwidth, 15}*" / 35 | colspec colwidth="#{attr :labelwidth, 85}*" / 36 | tbody valign='top' 37 | - items.each do |terms, dd| 38 | row 39 | entry 40 | - [*terms].each do |dt| 41 | simpara=dt.text 42 | - unless dd.nil? 43 | entry 44 | - if dd.text? 45 | simpara=dd.text 46 | - if dd.blocks? 47 | =dd.content 48 | - else 49 | variablelist id=@id role=(attr :role) xreflabel=(attr :reftext) 50 | - if title? 51 | title=title 52 | - items.each do |terms, dd| 53 | varlistentry 54 | - [*terms].each do |dt| 55 | term=dt.text 56 | - unless dd.nil? 57 | listitem 58 | - if dd.text? 59 | simpara=dd.text 60 | - if dd.blocks? 61 | =dd.content 62 | -------------------------------------------------------------------------------- /slim/docbook45/block_example.xml.slim: -------------------------------------------------------------------------------- 1 | - if title? 2 | example id=@id role=(attr :role) xreflabel=(attr :reftext) 3 | title=title 4 | - if blocks? 5 | =content 6 | - else 7 | simpara=content 8 | - else 9 | informalexample id=@id role=(attr :role) xreflabel=(attr :reftext) 10 | - if blocks? 11 | =content 12 | - else 13 | simpara=content 14 | -------------------------------------------------------------------------------- /slim/docbook45/block_floating_title.xml.slim: -------------------------------------------------------------------------------- 1 | bridgehead id=@id role=(attr :role) xreflabel=(attr :reftext) renderas="sect#@level" =title 2 | -------------------------------------------------------------------------------- /slim/docbook45/block_image.xml.slim: -------------------------------------------------------------------------------- 1 | figure id=@id role=(attr :role) xreflabel=(attr :reftext) 2 | - if title? 3 | title=title 4 | mediaobject 5 | imageobject 6 | imagedata fileref=image_uri(attr :target) contentwidth=(attr :width) contentdepth=(attr :height) scale=(attr :scale) width=(attr :scaledwidth) scalefit=((attr? :scaledwidth) ? 1 : nil) align=(attr :align) 7 | textobject: phrase=attr :alt 8 | -------------------------------------------------------------------------------- /slim/docbook45/block_listing.xml.slim: -------------------------------------------------------------------------------- 1 | - if !title? 2 | - if attr?(:style, 'source') && attr?(:language) 3 | programlisting(id=@id role=(attr :role) xreflabel=(attr :reftext) language=(attr :language) 4 | linenumbering=((attr? :linenums) ? 'numbered' : 'unnumbered')) =content 5 | - else 6 | screen id=@id role=(attr :role) xreflabel=(attr :reftext) =content 7 | - else 8 | formalpara id=@id role=(attr :role) xreflabel=(attr :reftext) 9 | title=title 10 | para 11 | - if attr?(:style, 'source') && attr?(:language) 12 | programlisting language=(attr :language) linenumbering=((attr? :linenums) ? 'numbered' : 'unnumbered') =content 13 | - else 14 | screen=content 15 | -------------------------------------------------------------------------------- /slim/docbook45/block_literal.xml.slim: -------------------------------------------------------------------------------- 1 | - if !title? 2 | literallayout id=@id role=(attr :role) xreflabel=(attr :reftext) class='monospaced' =content 3 | - else 4 | formalpara id=@id role=(attr :role) xreflabel=(attr :reftext) 5 | title=title 6 | para 7 | literallayout class='monospaced' =content 8 | -------------------------------------------------------------------------------- /slim/docbook45/block_olist.xml.slim: -------------------------------------------------------------------------------- 1 | orderedlist id=@id role=(attr :role) xreflabel=(attr :reftext) numeration=(attr :style) 2 | - if title? 3 | title=title 4 | - items.each do |item| 5 | listitem 6 | simpara=item.text 7 | - if item.blocks? 8 | =item.content 9 | -------------------------------------------------------------------------------- /slim/docbook45/block_open.xml.slim: -------------------------------------------------------------------------------- 1 | - case attr 'style' 2 | - when 'abstract' 3 | - if @parent == @document && @document.doctype == 'book' 4 | - puts 'asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.' 5 | - else 6 | abstract 7 | - if title? 8 | title=title 9 | - if blocks? 10 | =content 11 | - else 12 | simpara=content 13 | - when 'partintro' 14 | - unless @document.doctype == 'book' && @parent.context == :section && @level == 0 15 | - puts 'asciidoctor: ERROR: partintro block can only be used when doctype is book and its a child of a part section. Excluding block content.' 16 | - else 17 | partintro id=@id role=(attr :role) xreflabel=(attr :reftext) 18 | - if title? 19 | title=title 20 | - if blocks? 21 | =content 22 | - else 23 | simpara=content 24 | - else 25 | =content 26 | -------------------------------------------------------------------------------- /slim/docbook45/block_page_break.xml.slim: -------------------------------------------------------------------------------- 1 | simpara 2 | -------------------------------------------------------------------------------- /slim/docbook45/block_paragraph.xml.slim: -------------------------------------------------------------------------------- 1 | - if title? 2 | formalpara id=@id role=(attr :role) xreflabel=(attr :reftext) 3 | title=title 4 | para=content 5 | - else 6 | simpara id=@id role=(attr :role) xreflabel=(attr :reftext) =content 7 | -------------------------------------------------------------------------------- /slim/docbook45/block_pass.xml.slim: -------------------------------------------------------------------------------- 1 | =content 2 | -------------------------------------------------------------------------------- /slim/docbook45/block_preamble.xml.slim: -------------------------------------------------------------------------------- 1 | - if @document.doctype == 'book' 2 | preface id=@id role=(attr :role) xreflabel=(attr :reftext) 3 | / title is mandatory, but can be an empty tag 4 | title=title 5 | =content 6 | - else 7 | =content 8 | -------------------------------------------------------------------------------- /slim/docbook45/block_quote.xml.slim: -------------------------------------------------------------------------------- 1 | blockquote id=@id role=(attr :role) xreflabel=(attr :reftext) 2 | - if title? 3 | title=title 4 | - if (attr? :attribution) || (attr? :citetitle) 5 | attribution 6 | - if attr? :attribution 7 | =attr :attribution 8 | - if attr? :citetitle 9 | citetitle=attr :citetitle 10 | - if blocks? 11 | =content 12 | - else 13 | simpara=content 14 | -------------------------------------------------------------------------------- /slim/docbook45/block_sidebar.xml.slim: -------------------------------------------------------------------------------- 1 | sidebar id=@id role=(attr :role) xreflabel=(attr :reftext) 2 | - if title? 3 | title=title 4 | - if blocks? 5 | =content 6 | - else 7 | simpara=content 8 | -------------------------------------------------------------------------------- /slim/docbook45/block_table.xml.slim: -------------------------------------------------------------------------------- 1 | *{:tag=>title? ? 'table' : 'informaltable', :id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext), 2 | :frame=>(attr :frame, 'all'), :rowsep=>['none', 'cols'].include?(attr :grid) ? 0 : 1, :colsep=>['none', 'rows'].include?(attr :grid) ? 0 : 1} 3 | - if title? 4 | title=title 5 | - if attr? :width 6 | 7 | 8 | 9 | tgroup cols=(attr :colcount) 10 | - @columns.each do |col| 11 | colspec colname="col_#{col.attr :colnumber}" colwidth="#{col.attr((attr? :width) ? :colabswidth : :colpcwidth)}*" / 12 | - [:head, :foot, :body].select {|tblsec| !@rows[tblsec].empty? }.each do |tblsec| 13 | *{:tag=>"t#{tblsec}"} 14 | - @rows[tblsec].each do |row| 15 | row 16 | - row.each do |cell| 17 | entry(align=(cell.attr :halign) valign=(cell.attr :valign) 18 | namest=(cell.colspan && "col_#{cell.column.attr :colnumber}") 19 | nameend=(cell.colspan && "col_#{(cell.column.attr :colnumber) + cell.colspan - 1}") 20 | morerows=(cell.rowspan && (cell.rowspan - 1))) 21 | - if tblsec == :head 22 | =cell.text 23 | - else 24 | - case cell.attr :style 25 | - when :asciidoc 26 | =cell.content 27 | - when :verse 28 | literallayout=cell.text 29 | - when :literal 30 | literallayout class='monospaced' =cell.text 31 | - when :header 32 | - cell.content.each do |text| 33 | simpara: emphasis role='strong' =text 34 | - else 35 | - cell.content.each do |text| 36 | simpara=text 37 | -------------------------------------------------------------------------------- /slim/docbook45/block_thematic_break.xml.slim: -------------------------------------------------------------------------------- 1 | simpara 2 | 3 | -------------------------------------------------------------------------------- /slim/docbook45/block_ulist.xml.slim: -------------------------------------------------------------------------------- 1 | - if attr? :style, 'bibliography' 2 | bibliodiv id=@id role=(attr :role) xreflabel=(attr :reftext) 3 | - if title? 4 | title=title 5 | - items.each do |item| 6 | bibliomixed 7 | bibliomisc=item.text 8 | - if item.blocks? 9 | =item.content 10 | - else 11 | itemizedlist id=@id role=(attr :role) xreflabel=(attr :reftext) 12 | - if title? 13 | title=title 14 | - items.each do |item| 15 | listitem 16 | simpara=item.text 17 | - if item.blocks? 18 | =item.content 19 | -------------------------------------------------------------------------------- /slim/docbook45/block_verse.xml.slim: -------------------------------------------------------------------------------- 1 | blockquote id=@id role=(attr :role) xreflabel=(attr :reftext) 2 | - if title? 3 | title=title 4 | - if (attr? :attribution) || (attr? :citetitle) 5 | attribution 6 | - if attr? :attribution 7 | =attr :attribution 8 | - if attr? :citetitle 9 | citetitle=attr :citetitle 10 | literallayout=content 11 | -------------------------------------------------------------------------------- /slim/docbook45/document.xml.slim: -------------------------------------------------------------------------------- 1 | - docinfo = Helpers.capture_output do 2 | - if has_header? && !notitle 3 | - segments = @header.title.rpartition(': ') 4 | - if segments.first.empty? 5 | title=segments.last 6 | - else 7 | title=segments.first 8 | subtitle=segments.last 9 | date=(attr? :revdate) ? (attr :revdate) : (attr :docdate) 10 | - if has_header? 11 | - if attr? :author 12 | - if attr? :authorcount, 1 13 | author 14 | - if attr? :firstname 15 | firstname=attr :firstname 16 | - if attr? :middlename 17 | othername=attr :middlename 18 | - if attr? :lastname 19 | surname=attr :lastname 20 | - if attr? :email 21 | email=attr :email 22 | authorinitials=attr :authorinitials 23 | - else 24 | authorgroup 25 | - (1..(attr :authorcount)).each do |idx| 26 | author 27 | - if attr? "firstname_#{idx}" 28 | firstname=attr "firstname_#{idx}" 29 | - if attr? "middlename_#{idx}" 30 | othername=attr "middlename_#{idx}" 31 | - if attr? "lastname_#{idx}" 32 | surname=attr "lastname_#{idx}" 33 | - if attr? "email_#{idx}" 34 | email=attr "email_#{idx}" 35 | / this check seems weak 36 | - if (attr? :revdate) && ((attr? :revnumber) || (attr? :revremark)) 37 | revhistory 38 | revision 39 | - if attr? :revnumber 40 | revnumber=attr :revnumber 41 | date=attr :revdate 42 | - if attr? :authorinitials 43 | authorinitials=attr :authorinitials 44 | - if attr? :revremark 45 | revremark=attr :revremark 46 | | 47 | | 48 | - if attr? :toc 49 | 50 | - if attr? :sectnums 51 | 52 | - case doctype 53 | - when 'book' 54 | book lang=(attr :lang, 'en' unless attr? :nolang) 55 | bookinfo 56 | - docinfo.yield 57 | =content 58 | - when 'article' 59 | article lang=(attr :lang, 'en' unless attr? :nolang) 60 | articleinfo 61 | - docinfo.yield 62 | =content 63 | -------------------------------------------------------------------------------- /slim/docbook45/embedded.xml.slim: -------------------------------------------------------------------------------- 1 | =content 2 | -------------------------------------------------------------------------------- /slim/docbook45/helpers.rb: -------------------------------------------------------------------------------- 1 | # Add custom functions to this module that you want to use in your Slim 2 | # templates. Within the template you must namespace the function 3 | # (unless someone can show me how to include them in the evaluation context). 4 | # You can change the namespace to whatever you want. 5 | module Helpers 6 | def self.capture_output(*args, &block) 7 | Proc.new { block.call(*args) } 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /slim/docbook45/inline_anchor.xml.slim: -------------------------------------------------------------------------------- 1 | - case @type 2 | - when :ref 3 | anchor id=@target xreflabel=@text / 4 | - when :xref 5 | - if @text.nil? 6 | xref linkend=@target / 7 | - else 8 | link linkend=@target =@text 9 | - when :link 10 | ulink url=@target =@text 11 | - when :bibref 12 | anchor id=@target xreflabel="[#@target]" 13 | | [#@target] 14 | -------------------------------------------------------------------------------- /slim/docbook45/inline_break.xml.slim: -------------------------------------------------------------------------------- 1 | =@text 2 | 3 | -------------------------------------------------------------------------------- /slim/docbook45/inline_callout.xml.slim: -------------------------------------------------------------------------------- 1 | co id=@id / 2 | -------------------------------------------------------------------------------- /slim/docbook45/inline_footnote.xml.slim: -------------------------------------------------------------------------------- 1 | - if @type == :xref 2 | footnoteref linkend=@target / 3 | - else 4 | footnote id=@id : simpara=@text 5 | -------------------------------------------------------------------------------- /slim/docbook45/inline_image.xml.slim: -------------------------------------------------------------------------------- 1 | inlinemediaobject 2 | imageobject 3 | imagedata fileref=image_uri(@target) contentwidth=(attr :width) contentdepth=(attr :height) 4 | textobject: phrase=attr :alt 5 | -------------------------------------------------------------------------------- /slim/docbook45/inline_indexterm.xml.slim: -------------------------------------------------------------------------------- 1 | - if @type == :visible 2 | indexterm: primary=@text 3 | =@text 4 | - else 5 | - terms = (attr :terms) 6 | - numterms = terms.size 7 | - if numterms > 2 8 | indexterm 9 | primary=terms[0] 10 | secondary=terms[1] 11 | tertiary=terms[2] 12 | - if numterms > 1 13 | indexterm 14 | primary=terms[numterms - 2] 15 | secondary=terms[numterms - 1] 16 | indexterm: primary=terms[numterms - 1] 17 | -------------------------------------------------------------------------------- /slim/docbook45/inline_quoted.xml.slim: -------------------------------------------------------------------------------- 1 | - if attr? :role 2 | - text = "#@text" 3 | - else 4 | - text = @text 5 | - case @type 6 | - when :emphasis 7 | emphasis=text 8 | - when :strong 9 | emphasis role='strong' =text 10 | - when :monospaced 11 | literal=text 12 | - when :superscript 13 | superscript=text 14 | - when :subscript 15 | subscript=text 16 | - when :double 17 | | “#{text}” 18 | - when :single 19 | | ‘#{text}’ 20 | - else 21 | =text 22 | -------------------------------------------------------------------------------- /slim/docbook45/section.xml.slim: -------------------------------------------------------------------------------- 1 | *{:tag=>(@special ? (@level <= 1 ? @sectname : 'section') : (@document.doctype == 'book' && @level <= 1 ? (@level == 0 ? 'part' : 'chapter') : 'section')), 2 | :id=>@id, :role=>(attr :role), :xreflabel=>(attr :reftext)} 3 | - if title? 4 | title=title 5 | =content 6 | -------------------------------------------------------------------------------- /slim/dzslides/README.adoc: -------------------------------------------------------------------------------- 1 | = DZSlides backend for Asciidoctor 2 | Dan Allen; Cédric Exbrayat 3 | 4 | This backend is used to convert an AsciiDoc document to a HTML5 slide presentation driven by a DZSlides fork. 5 | 6 | == Initial Setup 7 | 8 | First, download (or git clone) the https://github.com/asciidoctor/asciidoctor-backends[asciidoctor-backends] repository to a convenient location. 9 | 10 | $ git clone https://github.com/asciidoctor/asciidoctor-backends.git 11 | 12 | Next, clone the https://github.com/mojavelinux/dzslides[dzslides] repository into your working directory (where your AsciiDoc document resides). 13 | 14 | $ git clone https://github.com/mojavelinux/dzslides.git 15 | 16 | If you list the files in your working directory, you should see: 17 | 18 | .... 19 | slides.adoc 20 | dzslides/ 21 | .... 22 | 23 | == Settings 24 | 25 | There are some attributes that can be set at the top of the document which they are specific of +dzslides+ backend. 26 | 27 | [cols="1m,1,1m"] 28 | |=== 29 | |Attribute |Description |Example 30 | 31 | |:link-assets: 32 | |Link instead of embed the dzslides assets 33 | | 34 | 35 | |:dzslides-style: