diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2014-04-29 23:11:13 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2014-04-29 23:11:13 -0600 |
| commit | 1182d79261f6ef74010342121548637634072c0e (patch) | |
| tree | 909b468f93e6a6ab7c50502e915c7a4a8ceba94f /bin | |
| parent | 6a4f05a50eef858f301e25326d58f7519e973253 (diff) | |
add theme argument; only change dpi if IMAGE_DPI env is set
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/asciidoctor-pdf | 8 | ||||
| -rwxr-xr-x | bin/optimize-pdf | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/bin/asciidoctor-pdf b/bin/asciidoctor-pdf index e8d5ddd7..b5b5927a 100755 --- a/bin/asciidoctor-pdf +++ b/bin/asciidoctor-pdf @@ -6,6 +6,11 @@ while ARGV[0] == '-a' attributes << ARGV.shift end +theme_file = if ARGV[0] == '--theme' + ARGV.shift + 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}) @@ -25,8 +30,9 @@ DataDir = File.join File.dirname(__FILE__), '..', 'data' ThemesDir = File.join DataDir, 'themes' TemplatesDir = File.join DataDir, 'templates' -theme_data = ::Asciidoctor::ThemeLoader.load_file File.join ThemesDir, 'default-theme.yml' +#theme_data = ::Asciidoctor::ThemeLoader.load_file File.join ThemesDir, 'default-theme.yml' #theme_data = ::Asciidoctor::ThemeLoader.load_file File.join ThemesDir, 'asciidoctor-theme.yml' +theme_data = ::Asciidoctor::ThemeLoader.load_file(theme_file || (File.join ThemesDir, 'default-theme.yml')) file_rootname = ::Asciidoctor::Helpers.rootname File.basename asciidoc_file pdf_file = %(#{file_rootname}.pdf) diff --git a/bin/optimize-pdf b/bin/optimize-pdf index 9b0a716f..d05fd251 100755 --- a/bin/optimize-pdf +++ b/bin/optimize-pdf @@ -23,7 +23,9 @@ if [ -f "$FILE_BASENAME.pdfmarks" ]; then FILE_PDFMARKS=$FILE_BASENAME.pdfmarks fi DOWNSAMPLE_IMAGES=true -IMAGE_DPI=150 +if [ -z $IMAGE_DPI ]; then + IMAGE_DPI=150 +fi # /prepress defaults (see http://ghostscript.com/doc/current/Ps2pdf.htm) # -d{Color,Gray,Mono}ImageDownsampleType=/Bicubic @@ -39,6 +41,11 @@ IMAGE_DPI=150 # -r72 # # for info about pdfmarks, see http://milan.kupcevic.net/ghostscript-ps-pdf +# +# to convert to grayscale, add the following (though doesn't always work) +# +# -dProcessColorModel=/DeviceGray \ +# -dColorConversionStrategy=/Gray \ "$GS" -q -dNOPAUSE -dBATCH -dSAFER -dNOOUTERSAVE \ -sDEVICE=pdfwrite \ |
