Class: Macaw
- Inherits:
-
Object
- Object
- Macaw
- Defined in:
- lib/macaw/rules/tex.rb,
lib/macaw/version.rb,
lib/macaw/rules/make.rb,
lib/macaw/rules/biber.rb,
lib/macaw/rules/clean.rb,
lib/macaw/rules/dvips.rb,
lib/macaw/rules/latex.rb,
lib/macaw/rules/xetex.rb,
lib/macaw/rules/bibtex.rb,
lib/macaw/rules/indent.rb,
lib/macaw/rules/luatex.rb,
lib/macaw/rules/pdftex.rb,
lib/macaw/rules/ps2pdf.rb,
lib/macaw/rules/sketch.rb,
lib/macaw/rules/animate.rb,
lib/macaw/rules/dvipdfm.rb,
lib/macaw/rules/nomencl.rb,
lib/macaw/rules/songidx.rb,
lib/macaw/rules/xelatex.rb,
lib/macaw/rules/dvipdfmx.rb,
lib/macaw/rules/lmkclean.rb,
lib/macaw/rules/lualatex.rb,
lib/macaw/rules/pdflatex.rb,
lib/macaw/rules/texcount.rb,
lib/macaw/rules/makeindex.rb,
lib/macaw/rules/xdvipdfmx.rb,
lib/macaw/rules/xelatexmk.rb,
lib/macaw/rules/lualatexmk.rb,
lib/macaw/rules/pdflatexmk.rb,
lib/macaw/rules/sumatrapdf.rb,
lib/macaw/rules/dvipsps2pdf.rb,
lib/macaw/rules/frontespizio.rb,
lib/macaw/rules/makeglossaries.rb
Overview
MakeGlossaries rule for arara author: Marco Daniel requres arara 3.0+
Constant Summary collapse
- VERSION =
"0.0.38"
Instance Method Summary collapse
- #animate(delay = nil, loop = nil, density = nil) ⇒ Object
- #biber(options = nil) ⇒ Object
- #bibtex(options = nil) ⇒ Object
- #clean(files) ⇒ Object
- #dvipdfm(options = nil, output = nil) ⇒ Object
- #dvipdfmx(output = nil, options = nil) ⇒ Object
- #dvips(options = nil, output = nil) ⇒ Object
- #dvipsps2pdf(options = nil, output = nil) ⇒ Object
- #frontespizio(engine) ⇒ Object
- #indent(overwrite = nil, silent = nil, trace = nil, localSettings = nil, output = nil, onlyDefault = nil, cruft = nil) ⇒ Object
- #latex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
- #lmkclean(include = nil) ⇒ Object
- #lualatex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
- #lualatexmk(action = nil, shell = nil, synctex = nil, options = nil, style = nil) ⇒ Object
- #luatex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
- #make(task = nil) ⇒ Object
- #makeglossaries(options = nil) ⇒ Object
- #makeindex(style = nil, german = nil, options = nil, extension = nil) ⇒ Object
- #nomencl(style = nil, options = nil) ⇒ Object
- #pdflatex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
- #pdflatexmk(action = nil, shell = nil, synctex = nil, options = nil, style = nil) ⇒ Object
- #pdftex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
- #ps2pdf(options = nil, output = nil) ⇒ Object
- #sketch(options = nil) ⇒ Object
- #songidx(input) ⇒ Object
- #sumatrapdf(pdf = nil) ⇒ Object
- #tex(action, shell = nil, options = nil) ⇒ Object
-
#texcount(parameters) ⇒ Object
this probably needs to be a lot fancier, but I can’t be arsed about it right now.
- #xelatex(action, shell = nil, synctex = nil, options = nil) ⇒ Object
- #xelatexmk(action, shell = nil, synctex = nil, style = nil) ⇒ Object
- #xetex(action, shell = nil, synctex = nil, options = nil) ⇒ Object
Instance Method Details
#animate(delay = nil, loop = nil, density = nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/macaw/rules/animate.rb', line 19 def animate(delay=nil, loop=nil, density=nil) delay ||= 10 loop ||= 0 density ||= 300 Macaw.system "convert -delay #{delay} -loop #{loop} -density #{density} #{~"#{@base}.pdf"} #{~"#{@base}.gif"}" end |
#biber(options = nil) ⇒ Object
5 6 7 |
# File 'lib/macaw/rules/biber.rb', line 5 def biber(=nil) Macaw.system "biber #{} #{~@base}" end |
#bibtex(options = nil) ⇒ Object
5 6 7 |
# File 'lib/macaw/rules/bibtex.rb', line 5 def bibtex(=nil) Macaw.system "bibtex #{} #{~"#{@base}.aux"}" end |
#clean(files) ⇒ Object
5 6 7 8 9 |
# File 'lib/macaw/rules/clean.rb', line 5 def clean(files) files.reject{|f| f.downcase == @file.downcase}.each{|f| File.unlink(f) } end |
#dvipdfm(options = nil, output = nil) ⇒ Object
5 6 7 8 |
# File 'lib/macaw/rules/dvipdfm.rb', line 5 def dvipdfm(=nil, output=nil) output ||= @base Macaw.system "dvipdfm #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{}" end |
#dvipdfmx(output = nil, options = nil) ⇒ Object
5 6 7 8 |
# File 'lib/macaw/rules/dvipdfmx.rb', line 5 def dvipdfmx(=nil, output=nil) output ||= @base Macaw.system "dvipdfmx #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{}" end |
#dvips(options = nil, output = nil) ⇒ Object
5 6 7 8 |
# File 'lib/macaw/rules/dvips.rb', line 5 def dvips(=nil, output=nil) output ||= @base Macaw.system "dvips #{~"#{@base}.dvi"} -o #{~"#{output}.ps"} #{}" end |
#dvipsps2pdf(options = nil, output = nil) ⇒ Object
5 6 7 8 9 |
# File 'lib/macaw/rules/dvipsps2pdf.rb', line 5 def dvipsps2pdf(=nil, output=nil) output ||= @base Macaw.system "dvips #{~"#{@base}.dvi"} -o #{~"#{@base}.ps"} #{}" Macaw.system "ps2pdf #{} #{~"#{@base}.ps"} #{~"#{output}.pdf"}" end |
#frontespizio(engine) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/macaw/rules/frontespizio.rb', line 6 def frontespizio(engine) engine ||= 'pdflatex' Macaw.system "#{engine} #{~@base}" Macaw.system "#{engine} #{~"#{@base}-frn"}" Macaw.system "dvips -o #{~"#{@base}-frn.eps"} #{~"#{@base}-frn"}" if engine == 'latex' Macaw.system "#{engine} #{~@base}" end |
#indent(overwrite = nil, silent = nil, trace = nil, localSettings = nil, output = nil, onlyDefault = nil, cruft = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/macaw/rules/indent.rb', line 22 def indent(overwrite=nil, silent=nil, trace=nil, localSettings=nil, output=nil, onlyDefault=nil, cruft=nil) cmd = ["latexindent.#{OS.windows? ? 'exe' : 'pl'}"] cmd << '-s' if silent cmd << '-t' if trace cmd << '-l' if localSettings cmd << "-c=#{~cruft}" if cruft cmd << '-w' if overwrite cmd << '-d' if onlyDefault cmd << "-o #{~output}" if output cmd << ~@file cmd << ~output if output Macaw.system cmd end |
#latex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/macaw/rules/latex.rb', line 6 def latex(action=nil, shell=nil, synctex=nil, draft=nil, =nil) cmd = ['latex'] cmd << "--interaction=#{action}" if action cmd << '--draftmode' if draft cmd << shell ? '--shell-escape' : '--no-shell-escape' cmd << "--synctex=#{synctex ? 1 : 0}" cmd << cmd << ~@file Macaw.system cmd end |
#lmkclean(include = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/macaw/rules/lmkclean.rb', line 5 def lmkclean(include=nil) include ||= '-c' cmd = ['latexmk'] cmd << include.downcase if include && %w{all -c}.include(include.downcase) cmd << ~@file Macaw.system cmd end |
#lualatex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/macaw/rules/lualatex.rb', line 6 def lualatex(action=nil, shell=nil, synctex=nil, draft=nil, =nil) cmd = ['lualatex'] cmd << "--interaction=#{action}" if action cmd << '--draftmode' if draft cmd << "--#{shell ? '' : 'no-'}shell-escape" cmd << "--synctex=#{synctex ? 1 : 0}" cmd << cmd << ~@file Macaw.system cmd end |
#lualatexmk(action = nil, shell = nil, synctex = nil, options = nil, style = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/macaw/rules/lualatexmk.rb', line 5 def lualatexmk(action=nil, shell=nil, synctex=nil, =nil, style=nil) cmd = [] cmd << "latexmk -e '$pdflatex=q/lualatex%O%S/'" cmd << "--interaction=#{action}" if action cmd << "--synctex=#{synctex ? 1 : 0}" cmd << shell ? '--shell-escape' : '--no-shell-escape' cmd << cmd << "$makeindex=q/makeindex %O -s #{style}.ist -o %D %S/" if style cmd << "-pdf #{~@file}" Macaw.system cmd end |
#luatex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/macaw/rules/luatex.rb', line 6 def luatex(action=nil, shell=nil, synctex=nil, draft=nil, =nil) cmd = ['luatex'] cmd << "--interaction=#{action}" if action cmd << '--draftmode' if draft cmd << "--#{shell ? '' : 'no-'}shell-escape" cmd << "--synctex=#{synctex ? 1 : 0}" cmd << cmd << ~@file Macaw.system cmd end |
#make(task = nil) ⇒ Object
6 7 8 |
# File 'lib/macaw/rules/make.rb', line 6 def make(task=nil) Macaw.system ['make', task] end |
#makeglossaries(options = nil) ⇒ Object
5 6 7 8 |
# File 'lib/macaw/rules/makeglossaries.rb', line 5 def makeglossaries(=nil) Macaw.system ['makeglossaries', , ~@base] end |
#makeindex(style = nil, german = nil, options = nil, extension = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/macaw/rules/makeindex.rb', line 6 def makeindex(style=nil, german=nil, =nil, extension=nil) extension ||= 'idx' cmd = ['makeindex'] cmd << '-g' if german cmd << "-s #{style}" if style cmd << ~"#{@base}.#{extension}" Macaw.system cmd end |
#nomencl(style = nil, options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/macaw/rules/nomencl.rb', line 6 def nomencl(style=nil, =nil) style ||= nomencl cmd = ['makeindex'] cmd << cmd << ~"#{@base}.nlo" cmd << '-s ' + ~"#{style}.ist" if style cmd << '-o ' + ~"#{@base}.nls" Macaw.system cmd end |
#pdflatex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/macaw/rules/pdflatex.rb', line 6 def pdflatex(action=nil, shell=nil, synctex=nil, draft=nil, =nil) cmd = ['pdflatex'] cmd << "--interaction=#{action}" if action cmd << '--draftmode' if draft cmd << shell ? '--shell-escape' : '--no-shell-escape' cmd << "--synctex=#{synctex ? 1 : 0}" cmd << cmd << ~@file Macaw.system cmd end |
#pdflatexmk(action = nil, shell = nil, synctex = nil, options = nil, style = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/macaw/rules/pdflatexmk.rb', line 5 def pdflatexmk(action=nil, shell=nil, synctex=nil, =nil, style=nil) cmd = ["latexmk -e '$pdflatex=q/pdflatex%O%S/'"] cmd << "--interaction=#{action}" if action cmd << "--synctex=#{synctex ? 1 : 0}" cmd << "--#{shell ? '' : 'no-'}shell-escape" cmd << cmd << "-e '$makeindex=q/makeindex %O -s #{~"#{style}.ist"} -o %D %S/'" if style cmd << '-pdf' cmd << ~@file Macaw.system cmd end |
#pdftex(action = nil, shell = nil, synctex = nil, draft = nil, options = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/macaw/rules/pdftex.rb', line 5 def pdftex(action=nil, shell=nil, synctex=nil, draft=nil, =nil) cmd = ['pdftex'] cmd << "--interaction=#{action}" if action cmd << '--draftmode' if draft cmd << "--#{shell ? '' : 'no-'}shell-escape" cmd << "--synctex=#{synctex ? 1 : 0}" cmd << cmd << ~@file Macaw.system cmd end |
#ps2pdf(options = nil, output = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/macaw/rules/ps2pdf.rb', line 6 def ps2pdf(=nil, output=nil) output ||= @base cmd = ['ps2pdf'] cmd << cmd << ~"#{@base}.ps" cmd << ~"#{output}.pdf" Macaw.system cmd end |
#sketch(options = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/macaw/rules/sketch.rb', line 5 def sketch(=nil) cmd = ['sketch'] cmd << cmd << ~@file cmd << '-o' cmd << ~"#{@base}.tex" Macaw.system cmd end |
#songidx(input) ⇒ Object
5 6 7 |
# File 'lib/macaw/rules/songidx.rb', line 5 def songidx(input) Macaw.system "songidx " + ~"#{input}.sxd" end |
#sumatrapdf(pdf = nil) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/macaw/rules/sumatrapdf.rb', line 3 def sumatrapdf(pdf=nil) pdf ||= "#{@base}.pdf" Macaw.log('spawning sumatrapdf...') pdf = ~pdf Process.spawn "sumatrapdf -reuse-instance #{pdf}" end |
#tex(action, shell = nil, options = nil) ⇒ Object
6 7 8 |
# File 'lib/macaw/rules/tex.rb', line 6 def tex(action, shell=nil, =nil) Macaw.system ['tex', action ? "--interaction=#{action}" : nil, "--#{shell ? '' : 'no-'}shell-escape", , ~@file] end |
#texcount(parameters) ⇒ Object
this probably needs to be a lot fancier, but I can’t be arsed about it right now.
6 7 8 |
# File 'lib/macaw/rules/texcount.rb', line 6 def texcount(parameters) Macaw.system ['texcount'] + parameters end |
#xelatex(action, shell = nil, synctex = nil, options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/macaw/rules/xelatex.rb', line 6 def xelatex(action, shell=nil, synctex=nil, =nil) Macaw.system [ 'xelatex', "--interaction=#{action}", "--#{shell ? '' : 'no-'}shell-escape", "--synctex=#{syntex ? 1 : 0}", , ~@file ] end |
#xelatexmk(action, shell = nil, synctex = nil, style = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/macaw/rules/xelatexmk.rb', line 5 def xelatexmk(action, shell=nil, synctex=nil, style=nil) Macaw.system [ "latexmk -e '$pdflatex=q/xelatex%O%S/' --interaction=#{action} --synctex=#{synctex ? 1 : 0} --#{shell ? '' : 'no-'}shell-escape", , style ? "-e '$makeindex=q/makeindex %O -s #{style}.ist -o %D %S/'" : nil, '-pdf', ~@file ] end |
#xetex(action, shell = nil, synctex = nil, options = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/macaw/rules/xetex.rb', line 5 def xetex(action, shell=nil, synctex=nil, =nil) Macaw.system [ 'xetex', "--interaction=#{action}", "--#{shell ? '' : 'no-'}shell-escape", "--synctex=#{synctex ? 1 : 0}", , ~@file ] end |