summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2014-01-29 01:42:14 -0700
committerDan Allen <dan.j.allen@gmail.com>2014-01-29 01:42:14 -0700
commit0b13682408b5da8283550aa15ab349f1e86408eb (patch)
tree67c542f92cebb72b287cec9db9b243bcc56fc136 /bin
parentbc9ae745084121c7aafd301de4406809d53b6e90 (diff)
primitive support for AsciiDoc attributes in cli
Diffstat (limited to 'bin')
-rwxr-xr-xbin/asciidoctor-pdf10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/asciidoctor-pdf b/bin/asciidoctor-pdf
index bac17310..847c0a96 100755
--- a/bin/asciidoctor-pdf
+++ b/bin/asciidoctor-pdf
@@ -1,5 +1,11 @@
#!/usr/bin/env ruby
+attributes = %w(idprefix=@ listing-caption=Listing@)
+while ARGV[0] == '-a'
+ ARGV.shift
+ attributes << ARGV.shift
+end
+
asciidoc_file = ARGV[0] || %(README.adoc)
unless (File.exist? asciidoc_file) && (File.readable? asciidoc_file)
warn %(ERROR: The specified file does not exist or cannot be read: #{asciidoc_file})
@@ -27,9 +33,7 @@ pdf_file = %(#{file_rootname}.pdf)
options = {
safe: :safe,
template_dir: TemplatesDir,
- attributes: %(idprefix=@)
- #attributes: %(idprefix=@ source-highlighter=coderay)
- #attributes: %(idprefix=@ listing-caption=Listing@)
+ attributes: attributes
}
doc = ::Asciidoctor.load_file asciidoc_file, options