2019-11-26

Tags: blog, asciidoc, jbake

Some collected notes from a jbake presentation…​

JBake Data Model

  • global variables: available to all templates regardless of type

  • Page / Post / Custom: variables for predefined templates

  • Index: index template has extra variables available related to paging

  • Tags: data related to tagged documents

slide 33: refers to :metaproperty: for 'attached' + script name; place script in same folder as document. Add href in header to attached doc

custom type = videos

jbake.properties: add template.<newtype>.tpl=<templateName>

iframe(width: "560", height: "315",
    src: "https://www.youtube.com/embed/${content.video}",
    frameboarder: "0",
    allow: "accelerometer; autoplay; encrYpted-media; gyroscope; picture-in-picture",
    allowfullscreen: true
)

asciidoctor extensions

for comments, math formulas, diagrams, QR codes, …​ ex jbake.properties: add asciidoctor.option.requires=asciidoctor-diagram

[ditaa]
----
  +-------+      +-------+
  |       |      |       |
  |   A   +----->|   B   |
  |  {d}  |      |  {s}  |
  +-------+      +-------+

other extensions: https://puravida-software.gitlab.io/asciidoctor-extensions/ for disqus or google-analytics still more at https://asciidoctor.org/docs/extensions/

include source code in documentation

[source, java]
----
link:https://raw.githubusercontent.com/mariogarcia/jbake_greach/master/src/test/groovy/greach/workshop/oss/LibraryTest.groovy[]
----

gradle example

JBake at JUGChennai

type=post will use post.ftl type=page will use page.ftl status=(draft|published)

Data Variables

  • $v2.6.7

  • ${posts} // collection of all posts

  • ${pages} // collection of all pages

  • ${config.[options]} //map of config data

  • expandable header

    • ie summary=This is a summary of the larger post

    • <p>${content.summary}</p>