Skip to content

Instantly share code, notes, and snippets.

@denisdefreyne
Created February 17, 2014 20:52
Show Gist options
  • Save denisdefreyne/9058888 to your computer and use it in GitHub Desktop.
Save denisdefreyne/9058888 to your computer and use it in GitHub Desktop.
Preprocessor that extract AsciiDoc (Asciidoctor) metadata
preprocess do
@items.each do |item|
case item[:extension]
when 'adoc', 'asciidoc'
Asciidoctor::Document.new(item.raw_content).attributes.each_pair do |k,v|
item[k.to_sym] = v
end
end
end
end
# Now you can access e.g. @item[:author] and @item[:revdate]! :D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment