macaw-ruby 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +23 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +16 -0
- data/bin/macaw +102 -0
- data/lib/macaw.rb +3 -0
- data/lib/macaw/rules/animate.rb +26 -0
- data/lib/macaw/rules/biber.rb +8 -0
- data/lib/macaw/rules/bibtex.rb +8 -0
- data/lib/macaw/rules/clean.rb +10 -0
- data/lib/macaw/rules/dvipdfm.rb +9 -0
- data/lib/macaw/rules/dvipdfmx.rb +9 -0
- data/lib/macaw/rules/dvips.rb +9 -0
- data/lib/macaw/rules/dvipsps2pdf.rb +10 -0
- data/lib/macaw/rules/frontespizio.rb +14 -0
- data/lib/macaw/rules/indent.rb +36 -0
- data/lib/macaw/rules/latex.rb +17 -0
- data/lib/macaw/rules/lmkclean.rb +13 -0
- data/lib/macaw/rules/lualatex.rb +17 -0
- data/lib/macaw/rules/lualatexmk.rb +17 -0
- data/lib/macaw/rules/luatex.rb +17 -0
- data/lib/macaw/rules/make.rb +9 -0
- data/lib/macaw/rules/makeglossaries.rb +9 -0
- data/lib/macaw/rules/makeindex.rb +16 -0
- data/lib/macaw/rules/nomencl.rb +17 -0
- data/lib/macaw/rules/pdflatex.rb +17 -0
- data/lib/macaw/rules/pdflatexmk.rb +17 -0
- data/lib/macaw/rules/pdftex.rb +16 -0
- data/lib/macaw/rules/ps2pdf.rb +16 -0
- data/lib/macaw/rules/sketch.rb +14 -0
- data/lib/macaw/rules/songidx.rb +8 -0
- data/lib/macaw/rules/tex.rb +9 -0
- data/lib/macaw/rules/xdvipdfmx.rb +9 -0
- data/lib/macaw/rules/xelatex.rb +16 -0
- data/lib/macaw/rules/xelatexmk.rb +14 -0
- data/lib/macaw/rules/xetex.rb +15 -0
- data/lib/macaw/version.rb +3 -0
- data/macaw.gemspec +24 -0
- data/test.tex +23 -0
- data/test/test_macaw.rb +8 -0
- data/tt.rb +8 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: abfcf859e9459f8b778168400517c665dc9897ef
|
4
|
+
data.tar.gz: f29d651161c713e9aadc1702c16a1250814590b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a6b3fc0a1399413005c253cac261871cd88fb3dd88d4749e800a9928dbb505bf31cd1ada8e8bacdf5e746215bb8954c0368edac085f1ce4e29cfd7cdeceb09d
|
7
|
+
data.tar.gz: 028d098f356df365abb4dda86e292ad4470dca562ff24155491ff4fd83dfb0096544c6def51eafa323311443b27a411c313a5ce3b02447d9288f2ea8d3d6bc9f
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
macaw-ruby (0.0.3)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
json_pure (1.8.1)
|
10
|
+
os (0.9.6)
|
11
|
+
rake (10.3.2)
|
12
|
+
require_all (1.3.2)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
bundler (~> 1.3)
|
19
|
+
json_pure
|
20
|
+
macaw-ruby!
|
21
|
+
os
|
22
|
+
rake
|
23
|
+
require_all
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 friflaj
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Macaw
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'macaw'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install macaw
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
task :default => :build
|
5
|
+
|
6
|
+
task :publish do
|
7
|
+
#sh "git tag #{Macaw::VERSION}"
|
8
|
+
#sh "git push"
|
9
|
+
sh "rm -f pkg/*"
|
10
|
+
Rake::Task["build"].invoke
|
11
|
+
sh "gem push #{Dir['pkg/*.gem'].join(' ')}"
|
12
|
+
end
|
13
|
+
|
14
|
+
task :test do
|
15
|
+
require './lib/macaw'
|
16
|
+
end
|
data/bin/macaw
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'pp'
|
5
|
+
require 'macaw'
|
6
|
+
require 'json/pure'
|
7
|
+
require 'shellwords'
|
8
|
+
|
9
|
+
def error(msg)
|
10
|
+
puts msg
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
|
14
|
+
error("No filename to process") if ARGV.size == 0
|
15
|
+
error("Expected exactly one filename to process #{ARGV.inspect}") if ARGV.size != 1
|
16
|
+
if File.file?(ARGV[0])
|
17
|
+
TEX = ARGV[0]
|
18
|
+
elsif File.file?(ARGV[0] + '.tex')
|
19
|
+
TEX = ARGV[0] + '.tex'
|
20
|
+
else
|
21
|
+
error("#{ARGV[0].inspect} does not exist") if !File.exists?(ARGV[0])
|
22
|
+
end
|
23
|
+
|
24
|
+
CONFIGFILE = [File.join(Dir.home, 'araraconfig.yaml'), File.join(Dir.home, '.araraconfig.yaml')].detect{|config| File.file?(config) }
|
25
|
+
CONFIG = CONFIGFILE ? YAML.load_file(CONFIGFILE) : {}
|
26
|
+
|
27
|
+
class JSON::Pure::Parser
|
28
|
+
IDENTIFIER = /[^:\s\\",{}\[\]]+/i
|
29
|
+
alias :parse_quoted_string :parse_string
|
30
|
+
|
31
|
+
def parse_string
|
32
|
+
if match?(IDENTIFIER)
|
33
|
+
str = scan(IDENTIFIER)
|
34
|
+
return true if str == 'yes'
|
35
|
+
return false if str == 'no'
|
36
|
+
return str
|
37
|
+
end
|
38
|
+
|
39
|
+
return parse_quoted_string
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Macaw
|
44
|
+
def initialize(tex)
|
45
|
+
@file = tex
|
46
|
+
@base = File.basename(@file, File.extname(@file))
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.run(file)
|
50
|
+
Macaw.load_rules
|
51
|
+
macaw = Macaw.new(file)
|
52
|
+
IO.readlines(file).each{|line|
|
53
|
+
next unless line =~ /^% arara: /
|
54
|
+
line.strip!
|
55
|
+
line.sub!(/^%\s+arara\s*:\s*/, '')
|
56
|
+
data = line.split(':', 2).collect{|v| v.strip}
|
57
|
+
|
58
|
+
cmd = data[0]
|
59
|
+
next if cmd == ''
|
60
|
+
|
61
|
+
error('Halted on user request' if cmd == 'halt'
|
62
|
+
|
63
|
+
params = {}
|
64
|
+
begin
|
65
|
+
params = JSON.parse(data[1]) if data[1]
|
66
|
+
rescue => e
|
67
|
+
error("cannot parse command #{line.inspect}: #{e}")
|
68
|
+
end
|
69
|
+
|
70
|
+
cmd = cmd.intern
|
71
|
+
|
72
|
+
error "no such rule #{cmd}" unless macaw.respond_to?(cmd)
|
73
|
+
|
74
|
+
accept = Macaw.instance_method(cmd).parameters
|
75
|
+
required = accept.collect{|k, v| k == :req ? v : nil}.compact
|
76
|
+
optional = accept.collect{|k, v| k != :req ? v : nil}.compact
|
77
|
+
|
78
|
+
missing = required - params.keys.collect{|k| k.intern}
|
79
|
+
error "#{line}: missing required parameter#{missing.size > 1 ? 's' : ''}: #{missing.inspect}" if missing.size > 0
|
80
|
+
|
81
|
+
unexpected = params.keys.collect{|k| k.intern} - accept.keys
|
82
|
+
error "#{line}: unexpected parameter#{unexpected.size > 1 ? 's' : ''}: #{unexpected.inspect}" if unexpected.size > 0
|
83
|
+
|
84
|
+
macaw.send(cmd, accept.collect{|k, v| params[v.to_s]}
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.system(cmd)
|
89
|
+
cmd = cmd.compact.join(' ') if cmd.is_a?(Array)
|
90
|
+
puts cmd
|
91
|
+
output = `#{cmd}`
|
92
|
+
puts output
|
93
|
+
return output if $?.to_i == 0
|
94
|
+
throw "#{cmd}: #{$?}"
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.load_rules
|
98
|
+
CONFIG['paths'].each{|path| puts path; require_all path} if CONFIG['paths']
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
Macaw.run(TEX)
|
data/lib/macaw.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Make animated .gif file from .pdf
|
2
|
+
# author: Chris Hughes
|
3
|
+
# last edited by: cmh, June 6th 2013
|
4
|
+
# requires arara 3.0+
|
5
|
+
#
|
6
|
+
# Sample usage:
|
7
|
+
#
|
8
|
+
# % arara: animate
|
9
|
+
# % arara: animate: {density: 200}
|
10
|
+
# % arara: animate: {density: 200, delay: 20}
|
11
|
+
#
|
12
|
+
# This rule is really just a shortcut for commands like the following
|
13
|
+
#
|
14
|
+
# convert -delay 10 -loop 0 -density 300 myfile.pdf myfile.gif
|
15
|
+
#
|
16
|
+
# which will output myfile.gif
|
17
|
+
#
|
18
|
+
class Macaw
|
19
|
+
def animate(delay=nil, loop=nil, density=nil)
|
20
|
+
delay ||= 10
|
21
|
+
loop ||= 0
|
22
|
+
density ||= 300
|
23
|
+
|
24
|
+
Macaw.system "convert -delay #{delay} -loop #{loop} -density #{density} #{"#{@base}.pdf".shellescape} #{"#{@base}.gif".shellescape}"
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# DVIPS rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# requires arara 3.0+
|
4
|
+
class Macaw
|
5
|
+
def dvipsps2pdf(options=nil, output=nil)
|
6
|
+
output ||= @base
|
7
|
+
Macaw.system "dvips #{"#{@base}.dvi".shellescape} -o #{"#{@base}.ps".shellescape} #{options}"
|
8
|
+
Macaw.system "ps2pdf #{options} #{"#{@base}.ps".shellescape} #{"#{output}.pdf".shellescape}"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Frontespizio rule for arara
|
2
|
+
# author: Francesco Endrici
|
3
|
+
# author: Enrico Gregorio
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def frontespizio(engine)
|
7
|
+
engine ||= 'pdflatex'
|
8
|
+
|
9
|
+
Macaw.system "#{engine} #{@base.shellescape}"
|
10
|
+
Macaw.system "#{engine} #{"#{@base}-frn".shellescape}"
|
11
|
+
Macaw.system "dvips -o #{"#{@base}-frn.eps".shellescape} #{"#{@base}-frn".shellescape}" if engine == 'latex'
|
12
|
+
Macaw.system "#{engine} #{@base.shellescape}"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'os'
|
2
|
+
# indent rule for arara
|
3
|
+
# author: Paulo Cereda, Chris Hughes
|
4
|
+
# last updated: 11/9/2013
|
5
|
+
# requires arara 3.0+
|
6
|
+
#
|
7
|
+
# Sample usage:
|
8
|
+
#
|
9
|
+
# % arara: indent
|
10
|
+
# % arara: indent: {overwrite: yes}
|
11
|
+
# % arara: indent: {output: myfile.tex, silent: no}
|
12
|
+
# % arara: indent: {output: myfile.tex, silent: yes, overwrite: yes}
|
13
|
+
# % arara: indent: {trace: true}
|
14
|
+
# % arara: indent: {localSettings: true}
|
15
|
+
# % arara: indent: {onlyDefault: on}
|
16
|
+
# % arara: indent: { cruft: /home/cmhughes/Desktop }
|
17
|
+
#
|
18
|
+
# Directories with spaces will cause issues in the cruft call.
|
19
|
+
#
|
20
|
+
# Note: output will take priority above overwrite
|
21
|
+
class Macaw
|
22
|
+
def indent(overwrite=nil, silent=nil, trace=nil, localSettings=nil, output=nil, onlyDefault=nil, cruft=nil)
|
23
|
+
cmd = ["latexindent.#{os.windows? ? 'exe' : 'pl'}"]
|
24
|
+
cmd << '-s' if silent
|
25
|
+
cmd << '-t' if trace
|
26
|
+
cmd << '-l' if localSettings
|
27
|
+
cmd << "-c=#{cruft.shellescape}" if cruft
|
28
|
+
cmd << '-w' if overwrite
|
29
|
+
cmd << '-d' if onlyDefault
|
30
|
+
cmd << "-o #{output.shellescape}" if output
|
31
|
+
cmd << @file.shellescape
|
32
|
+
cmd << output.shellescape if output
|
33
|
+
|
34
|
+
Macaw.system cmd
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# LaTeX rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# last edited by: Paulo Cereda
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def latex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
|
7
|
+
cmd = ['latex']
|
8
|
+
cmd << "--interaction=#{action}" if action
|
9
|
+
cmd << '--draftmode' if draft
|
10
|
+
cmd << shell ? '--shell-escape' : '--no-shell-escape'
|
11
|
+
cmd << "--synctex=#{synctex ? 1 : 0}"
|
12
|
+
cmd << options
|
13
|
+
cmd << @file.shellescape
|
14
|
+
|
15
|
+
Macaw.system cmd
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Clean rule for arara, via latexmk
|
2
|
+
# author: Brent Longborough
|
3
|
+
# requires arara 3.0+
|
4
|
+
class Macaw
|
5
|
+
def lmkclean(include=nil)
|
6
|
+
include ||= '-c'
|
7
|
+
|
8
|
+
cmd = ['latexmk']
|
9
|
+
cmd << include.downcase if include && %w{all -c}.include(include.downcase)
|
10
|
+
cmd << @file.shellescape
|
11
|
+
Macaw.system cmd
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# LuaLaTeX rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# last edited by: Paulo Cereda
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def lualatex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
|
7
|
+
cmd = ['lualatex']
|
8
|
+
cmd << "--interaction=#{action}" if action
|
9
|
+
cmd << '--draftmode' if draft
|
10
|
+
cmd << "--#{shell ? '' : 'no-'}shell-escape"
|
11
|
+
cmd << "--synctex=#{synctex ? 1 : 0}"
|
12
|
+
cmd << options
|
13
|
+
cmd << @file.shellescape
|
14
|
+
|
15
|
+
Macaw.system cmd
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# LaTeXmk with LuaLaTeX rule for arara
|
2
|
+
# author: Brent Longborough
|
3
|
+
# requires: arara 3.0+
|
4
|
+
class Macaw
|
5
|
+
def lualatexmk(action=nil, shell=nil, synctex=nil, options=nil, style=nil)
|
6
|
+
cmd = []
|
7
|
+
cmd << "latexmk -e '$pdflatex=q/lualatex%O%S/'"
|
8
|
+
cmd << "--interaction=#{action}" if action
|
9
|
+
cmd << "--synctex=#{synctex ? 1 : 0}"
|
10
|
+
cmd << shell ? '--shell-escape' : '--no-shell-escape'
|
11
|
+
cmd << options
|
12
|
+
cmd << "$makeindex=q/makeindex %O -s #{style}.ist -o %D %S/" if style
|
13
|
+
cmd << "-pdf #{@file.shellescape}"
|
14
|
+
|
15
|
+
Macaw.system cmd
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# LuaTeX rule for arara
|
2
|
+
# author: Paulo Cereda
|
3
|
+
# requires arara 3.0+
|
4
|
+
|
5
|
+
class Macaw
|
6
|
+
def luatex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
|
7
|
+
cmd = ['luatex']
|
8
|
+
cmd << "--interaction=#{action}" if action
|
9
|
+
cmd << '--draftmode' if draft
|
10
|
+
cmd << "--#{shell ? '' : 'no-'}shell-escape"
|
11
|
+
cmd << "--synctex=#{synctex ? 1 : 0}"
|
12
|
+
cmd << options
|
13
|
+
cmd << @file.shellescape
|
14
|
+
|
15
|
+
Macaw.system cmd
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# MakeIndex rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# last edited by: Paulo Cereda
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def makeindex(style=nil, german=nil, options=nil, extension=nil)
|
7
|
+
extension ||= 'idx'
|
8
|
+
|
9
|
+
cmd = ['makeindex']
|
10
|
+
cmd << '-g' if german
|
11
|
+
cmd << "-s #{style}" if style
|
12
|
+
cmd << "#{@base}.#{extension}".shellescape
|
13
|
+
|
14
|
+
Macaw.system cmd
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Nomencl rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# last edited by: Paulo Cereda
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def nomencl(style=nil, options=nil)
|
7
|
+
style ||= nomencl
|
8
|
+
|
9
|
+
cmd = ['makeindex']
|
10
|
+
cmd << options
|
11
|
+
cmd << "#{@base}.nlo".shellescape
|
12
|
+
cmd << '-s ' + "#{style}.ist".shellescape if style
|
13
|
+
cmd << '-o ' + "#{@base}.nls".shellescape
|
14
|
+
|
15
|
+
Macaw.system cmd
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# PDFLaTeX rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# last edited by: Paulo Cereda
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def pdflatex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
|
7
|
+
cmd = ['pdflatex']
|
8
|
+
cmd << "--interaction=#{action}" if action
|
9
|
+
cmd << '--draftmode' if draft
|
10
|
+
cmd << shell ? '--shell-escape' : '--no-shell-escape'
|
11
|
+
cmd << "--synctex=#{synctex ? 1 : 0}"
|
12
|
+
cmd << options
|
13
|
+
cmd << @file.shellescape
|
14
|
+
|
15
|
+
Macaw.system cmd
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# LaTeXmk with pdfLaTeX rule for arara
|
2
|
+
# author: Brent Longborough
|
3
|
+
# requires arara 3.0+
|
4
|
+
class Macaw
|
5
|
+
def pdflatexmk(action=nil, shell=nil, synctex=nil, options=nil, style=nil)
|
6
|
+
cmd = ["latexmk -e '$pdflatex=q/pdflatex%O%S/'"]
|
7
|
+
cmd << "--interaction=#{action}" if action
|
8
|
+
cmd << "--synctex=#{synctex ? 1 : 0}"
|
9
|
+
cmd << "--#{shell ? '' : 'no-'}shell-escape"
|
10
|
+
cmd << options
|
11
|
+
cmd << "-e '$makeindex=q/makeindex %O -s #{"#{style}.ist".shellescape} -o %D %S/'" if style
|
12
|
+
cmd << '-pdf'
|
13
|
+
cmd << @file.shellescape
|
14
|
+
|
15
|
+
Macaw.system cmd
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# PDFTeX rule for arara
|
2
|
+
# author: Paulo Cereda
|
3
|
+
# requires arara 3.0+
|
4
|
+
class Macaw
|
5
|
+
def pdftex(action=nil, shell=nil, synctex=nil, draft=nil, options=nil)
|
6
|
+
cmd = ['pdftex']
|
7
|
+
cmd << "--interaction=#{action}" if action
|
8
|
+
cmd << '--draftmode' if draft
|
9
|
+
cmd << "--#{shell ? '' : 'no-'}shell-escape"
|
10
|
+
cmd << "--synctex=#{synctex ? 1 : 0}"
|
11
|
+
cmd << options
|
12
|
+
cmd << @file.shellescape
|
13
|
+
|
14
|
+
Macaw.system cmd
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# PS2PDF rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# last edited by: Paulo Cereda
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def ps2pdf(options=nil, output=nil)
|
7
|
+
output ||= @base
|
8
|
+
|
9
|
+
cmd = ['ps2pdf']
|
10
|
+
cmd << options
|
11
|
+
cmd << "#{@base}.ps".shellescape
|
12
|
+
cmd << "#{output}.pdf".shellescape
|
13
|
+
|
14
|
+
Macaw.system cmd
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Sketch rule for arara
|
2
|
+
# author: Sergey Ulyanov
|
3
|
+
# requires arara 3.0+
|
4
|
+
class Macaw
|
5
|
+
def sketch(options=nil)
|
6
|
+
cmd = ['sketch']
|
7
|
+
cmd << options
|
8
|
+
cmd << @file.shellescape
|
9
|
+
cmd << '-o'
|
10
|
+
cmd << "#{@base}.tex".shellescape
|
11
|
+
|
12
|
+
Macaw.system cmd
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# TeX rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# last edited by: Paulo Cereda
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def tex(action, shell=nil, options=nil)
|
7
|
+
Macaw.system ['tex', action ? "--interaction=#{action}" : nil, "--#{shell ? '' : 'no-'}shell-escape", options, @file.shellescape]
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# XeLaTeX rule for arara
|
2
|
+
# author: Marco Daniel
|
3
|
+
# last edited by: Paulo Cereda
|
4
|
+
# requires arara 3.0+
|
5
|
+
class Macaw
|
6
|
+
def xelatex(action, shell=nil, synctex=nil, options=nil)
|
7
|
+
Macaw.system [
|
8
|
+
'xelatex',
|
9
|
+
"--interaction=#{action}",
|
10
|
+
"--#{shell ? '' : 'no-'}shell-escape",
|
11
|
+
"--synctex=#{syntex ? 1 : 0}",
|
12
|
+
options,
|
13
|
+
@file.shellescape
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# LaTeXmk with XeLaTeX rule for arara
|
2
|
+
# author: Brent Longborough
|
3
|
+
# requires arara 3.0+
|
4
|
+
class Macaw
|
5
|
+
def xelatexmk(action, shell=nil, synctex=nil, style=nil)
|
6
|
+
Macaw.system [
|
7
|
+
"latexmk -e '$pdflatex=q/xelatex%O%S/' --interaction=#{action} --synctex=#{synctex ? 1 : 0} --#{shell ? '' : 'no-'}shell-escape",
|
8
|
+
options,
|
9
|
+
style ? "-e '$makeindex=q/makeindex %O -s #{style}.ist -o %D %S/'" : nil,
|
10
|
+
'-pdf',
|
11
|
+
@file.shellescape
|
12
|
+
]
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# XeLaTeX rule for arara
|
2
|
+
# author: Paulo Cereda
|
3
|
+
# requires arara 3.0+
|
4
|
+
class Macaw
|
5
|
+
def xetex(action, shell=nil, synctex=nil, options=nil)
|
6
|
+
Macaw.system [
|
7
|
+
'xetex',
|
8
|
+
"--interaction=#{action}",
|
9
|
+
"--#{shell ? '' : 'no-'}shell-escape",
|
10
|
+
"--synctex=#{synctex ? 1 : 0}",
|
11
|
+
options,
|
12
|
+
@file.shellescape
|
13
|
+
]
|
14
|
+
end
|
15
|
+
end
|
data/macaw.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'macaw/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "macaw-ruby"
|
8
|
+
spec.version = Macaw::VERSION
|
9
|
+
spec.executables << 'macaw'
|
10
|
+
spec.authors = ["Emiliano Heyns"]
|
11
|
+
spec.email = ["Emiliano.Heyns@iris-advies.com"]
|
12
|
+
spec.description = %q{Ruby Arara}
|
13
|
+
spec.summary = %q{Ruby Arara}
|
14
|
+
spec.homepage = ""
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
end
|
data/test.tex
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
% arara: zoterobib: {collection: /0/QG6TAZSK, exportNotes: yes}
|
2
|
+
% arara: cleanup
|
3
|
+
% arara: pdflatex: {synctex: yes, action: nonstopmode, options: "-halt-on-error -file-line-error-style"}
|
4
|
+
% arara: biber
|
5
|
+
% arara: pdflatex: {synctex: yes, action: batchmode, options: "-halt-on-error -file-line-error-style"}
|
6
|
+
% arara: pdflatex: {synctex: yes, action: nonstopmode, options: "-halt-on-error -file-line-error-style"}
|
7
|
+
% arara: cleanup
|
8
|
+
% rara: sumatrapdf
|
9
|
+
% rara: wordcount
|
10
|
+
\documentclass[10pt,a4paper,draft]{article}
|
11
|
+
|
12
|
+
\title{My title}
|
13
|
+
\author{Emiliano Heyns}
|
14
|
+
|
15
|
+
\usepackage{tipa}
|
16
|
+
|
17
|
+
\begin{document}
|
18
|
+
|
19
|
+
\maketitle
|
20
|
+
|
21
|
+
|
22
|
+
\end{document}
|
23
|
+
|
data/test/test_macaw.rb
ADDED
data/tt.rb
ADDED
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: macaw-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Emiliano Heyns
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Ruby Arara
|
42
|
+
email:
|
43
|
+
- Emiliano.Heyns@iris-advies.com
|
44
|
+
executables:
|
45
|
+
- macaw
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/macaw
|
55
|
+
- lib/macaw.rb
|
56
|
+
- lib/macaw/rules/animate.rb
|
57
|
+
- lib/macaw/rules/biber.rb
|
58
|
+
- lib/macaw/rules/bibtex.rb
|
59
|
+
- lib/macaw/rules/clean.rb
|
60
|
+
- lib/macaw/rules/dvipdfm.rb
|
61
|
+
- lib/macaw/rules/dvipdfmx.rb
|
62
|
+
- lib/macaw/rules/dvips.rb
|
63
|
+
- lib/macaw/rules/dvipsps2pdf.rb
|
64
|
+
- lib/macaw/rules/frontespizio.rb
|
65
|
+
- lib/macaw/rules/indent.rb
|
66
|
+
- lib/macaw/rules/latex.rb
|
67
|
+
- lib/macaw/rules/lmkclean.rb
|
68
|
+
- lib/macaw/rules/lualatex.rb
|
69
|
+
- lib/macaw/rules/lualatexmk.rb
|
70
|
+
- lib/macaw/rules/luatex.rb
|
71
|
+
- lib/macaw/rules/make.rb
|
72
|
+
- lib/macaw/rules/makeglossaries.rb
|
73
|
+
- lib/macaw/rules/makeindex.rb
|
74
|
+
- lib/macaw/rules/nomencl.rb
|
75
|
+
- lib/macaw/rules/pdflatex.rb
|
76
|
+
- lib/macaw/rules/pdflatexmk.rb
|
77
|
+
- lib/macaw/rules/pdftex.rb
|
78
|
+
- lib/macaw/rules/ps2pdf.rb
|
79
|
+
- lib/macaw/rules/sketch.rb
|
80
|
+
- lib/macaw/rules/songidx.rb
|
81
|
+
- lib/macaw/rules/tex.rb
|
82
|
+
- lib/macaw/rules/xdvipdfmx.rb
|
83
|
+
- lib/macaw/rules/xelatex.rb
|
84
|
+
- lib/macaw/rules/xelatexmk.rb
|
85
|
+
- lib/macaw/rules/xetex.rb
|
86
|
+
- lib/macaw/version.rb
|
87
|
+
- macaw.gemspec
|
88
|
+
- test.tex
|
89
|
+
- test/test_macaw.rb
|
90
|
+
- tt.rb
|
91
|
+
homepage: ''
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.2.2
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Ruby Arara
|
115
|
+
test_files:
|
116
|
+
- test/test_macaw.rb
|