templates/helpers.rb in asciidoctor-revealjs-1.1.3 vs templates/helpers.rb in asciidoctor-revealjs-2.0.0

- old
+ new

@@ -22,10 +22,19 @@ def to_boolean val val && val != 'false' && val.to_s != '0' || false end + # false needs to be verbatim everything else is a string. + # Calling side isn't responsible for quoting so we are doing it here + def to_valid_slidenumber val + # corner case: empty is empty attribute which is true + return true if val == "" + # using to_s here handles both the 'false' string and the false boolean + val.to_s == 'false' ? false : "'#{val}'" + end + ## # These constants and functions are from the asciidictor-html5s project # https://github.com/jirutka/asciidoctor-html5s/blob/a71db48a1dd5196b668b3a3d93693c5d877c5bf3/data/templates/helpers.rb # Defaults @@ -89,9 +98,23 @@ [sec.sectnum, sec.captioned_title].join(' ') else sec.captioned_title end end + + + # Between delimiters (--) is code taken from asciidoctor-bespoke 1.0.0.alpha.1 + # Licensed under MIT, Copyright (C) 2015-2016 Dan Allen and the Asciidoctor Project + #-- + # Retrieve the converted content, wrap it in a `<p>` element if + # the content_model equals :simple and return the result. + # + # Returns the block content as a String, wrapped inside a `<p>` element if + # the content_model equals `:simple`. + def resolve_content + @content_model == :simple ? %(<p>#{content}</p>) : content + end + #-- end # More custom functions can be added in another namespace if required #module Helpers