rake4latex 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/{lib/call_rake4latex.rb → call_rake4latex.rb} +21 -9
  2. data/lib/rake4latex.rb +113 -180
  3. data/lib/rake4latex/base.rb +205 -0
  4. data/lib/rake4latex/clean.rb +53 -0
  5. data/lib/rake4latex/latexdependencies.rb +2 -0
  6. data/lib/rake4latex/latexrunner.rb +31 -15
  7. data/lib/rake4latex/rake4latex.yaml +76 -0
  8. data/lib/rake4latex/rules.rb +90 -18
  9. data/lib/rake4latex/splitindex.rb +5 -2
  10. data/lib/rake4latex/template.rb +60 -0
  11. data/lib/rake4latex/tex_statistic.rb +8 -3
  12. data/lib/rake4latex_dvipdfm.rb +40 -0
  13. data/lib/rake4latex_lualatex.rb +22 -0
  14. data/lib/rake4latex_pdflatex.rb +22 -0
  15. data/lib/rake4latex_ps2pdf.rb +27 -0
  16. data/lib/rake4latex_xelatex.rb +22 -0
  17. data/license.txt +15 -0
  18. data/readme.html +70 -23
  19. data/readme.txt +58 -18
  20. data/readme_call_rake4latex.txt +25 -0
  21. data/test/_expected/bibtex_test.txt +10 -0
  22. data/test/_expected/bibtex_test_bib.txt +5 -0
  23. data/test/_expected/dvipdfm_test.txt +7 -0
  24. data/test/_expected/gloss_test.txt +16 -0
  25. data/test/_expected/gloss_test_bib.txt +8 -0
  26. data/test/_expected/includes_test.txt +8 -0
  27. data/test/_expected/index_test.txt +7 -0
  28. data/test/_expected/longtable_test.txt +6 -0
  29. data/test/_expected/minitoc_test.txt +8 -0
  30. data/test/_expected/ps2pdf_test.txt +8 -0
  31. data/test/_expected/rail_test.txt +7 -0
  32. data/test/_expected/rail_test_error.txt +10 -0
  33. data/test/_expected/splitindex_test.txt +8 -0
  34. data/test/_expected/supertabular_test.txt +6 -0
  35. data/test/_expected/supertabular_test_statistic.txt +30 -0
  36. data/test/_expected/z_complex_test.txt +12 -0
  37. data/test/_test_call/test_call.rb +14 -0
  38. data/test/_test_call/testdocument.tex +18 -0
  39. data/test/bibtex/rakefile.rb +11 -5
  40. data/test/bibtex/testdocument.bib +1 -0
  41. data/test/dvipdfm/rakefile.rb +43 -0
  42. data/test/dvipdfm/testdocument.tex +10 -0
  43. data/test/gloss/rakefile.rb +65 -0
  44. data/test/gloss/test_gloss.bib +4 -0
  45. data/test/gloss/testdocument.tex +31 -0
  46. data/test/includes/rakefile.rb +4 -4
  47. data/test/index/rakefile.rb +1 -1
  48. data/test/longtable/rakefile.rb +1 -1
  49. data/test/ps2pdf/rakefile.rb +43 -0
  50. data/test/ps2pdf/testdocument.tex +10 -0
  51. data/test/rail/rakefile.rb +10 -19
  52. data/test/rail/testrail.tex +2 -6
  53. data/test/rail/testrail_error.tex +58 -0
  54. data/test/supertabular/rakefile.rb +1 -1
  55. data/test/unittest_rake4latex.rb +66 -0
  56. data/test/z_complex/rakefile.rb +2 -2
  57. metadata +64 -6
@@ -31,6 +31,6 @@ task :test => [ :touch, 'testdocument.pdf' ]
31
31
 
32
32
  if $0 == __FILE__
33
33
  app = Rake.application
34
- app.set_latexrunner_default(:loglevel, Log4r::DEBUG)
34
+ Rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
35
35
  app[:default].invoke
36
36
  end
@@ -38,6 +38,6 @@ task :test => [ :touch, 'testdocument.pdf' ]
38
38
 
39
39
  if $0 == __FILE__
40
40
  app = Rake.application
41
- app.set_latexrunner_default(:loglevel, Log4r::DEBUG)
41
+ Rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
42
42
  app[:default].invoke
43
43
  end
@@ -0,0 +1,43 @@
1
+ #
2
+ #Test ps2pdf
3
+ #
4
+ Dir.chdir('../../lib'){ require 'rake4latex_ps2pdf'}
5
+
6
+ #Prepeare longtable-content
7
+ #~ 6.times{
8
+ #~ puts "%10i & " % (rand(10).to_s * (rand(9) + 1)) +
9
+ #~ "%10i & " % (rand(10).to_s * (rand(9) + 1)) +
10
+ #~ "\\blindtext\\\\\\\hline"
11
+ #~ }
12
+ #~ exit
13
+
14
+ #~ deps = [
15
+ #~ 'testdocument.tex'
16
+ #~ ]
17
+ #~ file 'testdocument.dvi' => deps
18
+ #~ file 'testdocument.pdf' => deps
19
+
20
+ #~ file 'testdocument.dvi' => LaTeXRunner.find_included_files( 'testdocument.tex' ).flatten.uniq
21
+
22
+ task :basefile => 'testdocument.tex'
23
+ task :touch => 'testdocument.tex' #Zeitstempel anpassen/Kompilation erzwingen
24
+
25
+ task :default => [:touch]
26
+ #~ task :default => 'testdocument.dvi'
27
+ task :default => 'testdocument.pdf'
28
+ task :default => :clean
29
+
30
+ #~ task :clean do
31
+ #~ puts CLEAN.inspect
32
+ #~ puts CLOBBER.inspect
33
+ #~ end
34
+
35
+ desc "Testtask for Unittest"
36
+ task :test => [ :touch, 'testdocument.pdf' ]
37
+
38
+
39
+ if $0 == __FILE__
40
+ app = Rake.application
41
+ #~ Rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
42
+ app[:default].invoke
43
+ end
@@ -0,0 +1,10 @@
1
+ \documentclass[10pt,ngerman]{scrartcl}
2
+ \usepackage{babel}
3
+ \usepackage[ansinew]{inputenc}
4
+ \usepackage{blindtext}
5
+ \usepackage{hyperref}
6
+ % ----------------------------------------------------------------
7
+ \begin{document}
8
+ \blinddocument
9
+ \end{document}
10
+ % ----------------------------------------------------------------
@@ -1,22 +1,8 @@
1
1
  #
2
- #Test index
2
+ #Test rail
3
3
  #
4
4
  Dir.chdir('../../lib'){ require 'rake4latex'}
5
5
 
6
- desc "Call Rail"
7
- tex_postrule '.rao' => '.rai' do |t|
8
- stdout, stderr = catch_screen_output{
9
- #fixme: Dateinamen l�nger 8 stellen
10
- cmd = "C:/usr/texmf/tex/Latex/rail/rail.exe -t #{t.source.ext('')}"
11
- puts cmd
12
- puts `#{cmd}`
13
- }
14
- if $? != 0
15
- Rake.application.latexrunner.logger.fatal("There where Rail errors. \n#{stdout}")
16
- end
17
- #~ puts stdout
18
- end
19
-
20
6
  #~ deps = [
21
7
  #~ 'testrail.tex'
22
8
  #~ ]
@@ -26,7 +12,9 @@ end
26
12
  #~ file 'testrail.dvi' => LaTeXRunner.find_included_files( 'testrail.tex' ).flatten.uniq
27
13
 
28
14
  task :basefile => 'testrail.tex'
15
+ task :basefile => 'testrail_error.tex'
29
16
  task :touch => 'testrail.tex' #Zeitstempel anpassen/Kompilation erzwingen
17
+ task :touch => 'testrail_error.tex' #Zeitstempel anpassen/Kompilation erzwingen
30
18
 
31
19
  task :default => :touch
32
20
  #~ task :default => 'testrail.dvi'
@@ -40,12 +28,15 @@ task :default => :clean
40
28
 
41
29
  desc "Testtask for Unittest"
42
30
  task :test => [ :touch, 'testrail.pdf' ]
31
+ task :test_error => [ :touch, 'testrail_error.pdf' ]
43
32
 
44
33
 
45
34
  if $0 == __FILE__
46
35
  app = Rake.application
47
- #~ app.set_latexrunner_default(:loglevel, Log4r::DEBUG)
48
- #~ app.set_latexrunner_default(:texerrors_allowed, true)
49
- #~ app[:default].invoke
50
- app[:test].invoke
36
+ #~ Rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
37
+ #~ Rake4LaTeX.set_latexrunner_default(:texerrors_allowed, true)
38
+ app[:default].invoke
39
+ #~ app[:test].invoke
40
+ #~ app[:test_error].invoke
41
+ #~ app[:clean].invoke
51
42
  end
@@ -10,15 +10,13 @@
10
10
 
11
11
  % ----------------------------------------------------------------
12
12
  \begin{document}
13
- \section{Rail-Diagramms}
14
- \subsection{Via Ruby-object}
15
-
13
+ \section{Rail-Diagramms ok}
16
14
 
17
15
  %
18
16
  % Define a rail-diagramm block
19
17
  %
20
18
  \begin{rail}
21
- block :
19
+ block1 :
22
20
  ( lbrace | 'begin' )
23
21
  ( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] )
24
22
  comm
@@ -26,7 +24,5 @@ block :
26
24
  ;
27
25
  \end{rail}
28
26
 
29
-
30
-
31
27
  \end{document}
32
28
  % ----------------------------------------------------------------
@@ -0,0 +1,58 @@
1
+ \documentclass[ngerman]{scrartcl}
2
+ \usepackage{babel}
3
+ \usepackage[ansinew]{inputenc}
4
+ \usepackage{hyperref}
5
+ % ----------------------------------------------------------------
6
+ \usepackage{rail}
7
+
8
+ \title{Rail-Diagramms in Creole}
9
+ \hypersetup{pdftitle={Rail-Diagramms in Creole}}
10
+
11
+ % ----------------------------------------------------------------
12
+ \begin{document}
13
+ \section{Rail-Diagramms ok}
14
+
15
+ %
16
+ % Define a rail-diagramm block
17
+ %
18
+ \begin{rail}
19
+ block1 :
20
+ ( lbrace | 'begin' )
21
+ ( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] )
22
+ comm
23
+ ( rbrace | 'end' )
24
+ ;
25
+ \end{rail}
26
+
27
+ \section{Rail-Diagramms with error}
28
+
29
+ \begin{rail}
30
+ block2 :
31
+ lbrace | 'begin' )
32
+ ;
33
+ \end{rail}
34
+
35
+ \begin{rail}
36
+ block3 :
37
+ lbrace | 'begin' )
38
+ ;
39
+ \end{rail}
40
+
41
+
42
+ \section{Rail-Diagramms ok}
43
+
44
+ %
45
+ % Define a rail-diagramm block
46
+ %
47
+ \begin{rail}
48
+ block4 :
49
+ ( lbrace | 'begin' )
50
+ ( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] )
51
+ comm
52
+ ( rbrace | 'end' )
53
+ ;
54
+ \end{rail}
55
+
56
+
57
+ \end{document}
58
+ % ----------------------------------------------------------------
@@ -40,7 +40,7 @@ task :test_statistic => [ :statistic ]
40
40
 
41
41
  if $0 == __FILE__
42
42
  app = Rake.application
43
- app.set_latexrunner_default(:loglevel, Log4r::DEBUG)
43
+ Rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
44
44
  #~ app[:default].invoke
45
45
  app[:test].invoke
46
46
  app[:test_statistic].invoke
@@ -2,6 +2,7 @@ require 'test/unit'
2
2
  require 'assert_equal_filecontent'
3
3
 
4
4
  Dir.chdir('../lib'){ require 'rake4latex'}
5
+ include Rake4LaTeX
5
6
 
6
7
  class Test_LaTeXRunner < Test::Unit::TestCase
7
8
  def test_initialize()
@@ -34,6 +35,71 @@ class Test_LaTeXRunner < Test::Unit::TestCase
34
35
 
35
36
  end
36
37
  end
38
+
39
+ class Test_LaTeXRunner_Programms < Test::Unit::TestCase
40
+
41
+ def test_generell()
42
+ assert_instance_of(Hash, Rake4LaTeX::Programms)
43
+ Rake4LaTeX::Programms.each{|tool, options |
44
+ assert_instance_of(Hash, options )
45
+ #Check valid keys. comment is ok, but not needed
46
+ options.delete( 'comment')
47
+ assert_equal(%w{cmd parameters}, options.keys.sort)
48
+
49
+ assert_instance_of(String, options['cmd'] )
50
+
51
+ assert_instance_of(Array, options['parameters'] )
52
+ options['parameters'].each{|parameter|
53
+ assert_instance_of(Hash, parameter )
54
+ }
55
+ }
56
+
57
+ end #test_generell
58
+ #
59
+ #Test all LaTeX-variants
60
+ def test_latex()
61
+ %w{latex pdflatex lualatex xelatex}.each{|latex|
62
+ tool = Rake4LaTeX::Programms[latex]
63
+ assert_instance_of(Hash, tool)
64
+ assert_equal(latex, tool['cmd'])
65
+ assert_equal("#{latex} -interaction=batchmode test.tex",
66
+ Rake4LaTeX.build_cmd(latex, :filename => 'test.tex' )
67
+ )
68
+ assert_equal("#{latex} -interaction=batchmode -output-directory=out test.tex",
69
+ Rake4LaTeX.build_cmd(latex, :filename => 'test.tex', :output_dir => 'out' )
70
+ )
71
+ }
72
+ end
73
+ #Test all LaTeX-variants
74
+ def test_bibtex()
75
+ tool = Rake4LaTeX::Programms['bibtex']
76
+ assert_instance_of(Hash, tool)
77
+ assert_equal('bibtex', tool['cmd'])
78
+ assert_equal("bibtex test.aux",
79
+ Rake4LaTeX.build_cmd('bibtex', :source => 'test.aux' )
80
+ )
81
+ end
82
+ def test_makeindex()
83
+ tool = Rake4LaTeX::Programms['makeindex']
84
+ assert_instance_of(Hash, tool)
85
+ assert_equal('makeindex', tool['cmd'])
86
+ assert_equal("makeindex test.idx",
87
+ Rake4LaTeX.build_cmd( 'makeindex', :file_in => 'test.idx' )
88
+ )
89
+ end
90
+ #Test all LaTeX-variants
91
+ def test_latex()
92
+ %w{dvipdfm dvips ps2pdf}.each{|tool_id|
93
+ tool = Rake4LaTeX::Programms[tool_id]
94
+ assert_instance_of(Hash, tool)
95
+ assert_equal(tool_id, tool['cmd'])
96
+ assert_equal("#{tool_id} test.tex",
97
+ Rake4LaTeX.build_cmd(tool_id, :filename => 'test.tex' )
98
+ )
99
+ }
100
+ end
101
+ end #Test_LaTeXRunner_Programms
102
+
37
103
  class Test_LaTeXDependencies < Test::Unit::TestCase
38
104
  def test_initialize()
39
105
 
@@ -49,8 +49,8 @@ task :test => [ :touch, 'testdocument.pdf' ]
49
49
 
50
50
  if $0 == __FILE__
51
51
  app = Rake.application
52
- #~ app.set_latexrunner_default(:maxruns, 1)
53
- #~ app.set_latexrunner_default(:loglevel, Log4r::DEBUG)
52
+ #~ Rake4LaTeX.set_latexrunner_default(:maxruns, 1)
53
+ #~ Rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
54
54
  #~ app.set_latexrunner_default(:texerrors_allowed, true)
55
55
  app[:default].invoke
56
56
  #~ app[:clean].invoke
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake4latex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Knut Lickert
@@ -9,9 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-03 00:00:00 +01:00
12
+ date: 2010-01-08 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: log4r
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
15
35
  - !ruby/object:Gem::Dependency
16
36
  name: more_unit_test
17
37
  type: :runtime
@@ -24,7 +44,8 @@ dependencies:
24
44
  version:
25
45
  description: |
26
46
  Rake4LaTeX contains rake-tasks to compile LaTeX-projects.
27
- Necessary makeindex or bibliography-calls are done.
47
+ Necessary makeindex or bibliography-calls are done,
48
+ support of splitindex, gloss, rail.
28
49
 
29
50
  email: knut@lickert.net
30
51
  executables: []
@@ -34,17 +55,28 @@ extensions: []
34
55
  extra_rdoc_files: []
35
56
 
36
57
  files:
37
- - lib/call_rake4latex.rb
58
+ - call_rake4latex.rb
38
59
  - lib/rake4latex.rb
60
+ - lib/rake4latex/clean.rb
61
+ - lib/rake4latex_dvipdfm.rb
62
+ - lib/rake4latex_lualatex.rb
63
+ - lib/rake4latex_pdflatex.rb
64
+ - lib/rake4latex_ps2pdf.rb
65
+ - lib/rake4latex_xelatex.rb
66
+ - lib/rake4latex/base.rb
39
67
  - lib/rake4latex/latexdependencies.rb
40
68
  - lib/rake4latex/latexrunner.rb
41
69
  - lib/rake4latex/splitindex.rb
42
70
  - lib/rake4latex/rules.rb
43
71
  - lib/rake4latex/tex_statistic.rb
72
+ - lib/rake4latex/template.rb
73
+ - lib/rake4latex/rake4latex.yaml
44
74
  - readme.txt
45
75
  - readme.html
76
+ - readme_call_rake4latex.txt
77
+ - license.txt
46
78
  has_rdoc: true
47
- homepage: http://www.rubypla.net/rake4latex-0.0.1
79
+ homepage: http://gems.rubypla.net/
48
80
  licenses: []
49
81
 
50
82
  post_install_message:
@@ -67,15 +99,38 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
99
  version:
68
100
  requirements:
69
101
  - A (La)TeX-system
70
- rubyforge_project:
102
+ rubyforge_project: rake4latex
71
103
  rubygems_version: 1.3.5
72
104
  signing_key:
73
105
  specification_version: 3
74
106
  summary: Rake4LaTeX contains rake-tasks to compile TeX-Documents.
75
107
  test_files:
108
+ - test/_expected/bibtex_test.txt
109
+ - test/_expected/bibtex_test_bib.txt
110
+ - test/_expected/dvipdfm_test.txt
111
+ - test/_expected/gloss_test.txt
112
+ - test/_expected/gloss_test_bib.txt
113
+ - test/_expected/includes_test.txt
114
+ - test/_expected/index_test.txt
115
+ - test/_expected/longtable_test.txt
116
+ - test/_expected/minitoc_test.txt
117
+ - test/_expected/ps2pdf_test.txt
118
+ - test/_expected/rail_test.txt
119
+ - test/_expected/rail_test_error.txt
120
+ - test/_expected/splitindex_test.txt
121
+ - test/_expected/supertabular_test.txt
122
+ - test/_expected/supertabular_test_statistic.txt
123
+ - test/_expected/z_complex_test.txt
124
+ - test/_test_call/test_call.rb
125
+ - test/_test_call/testdocument.tex
76
126
  - test/bibtex/rakefile.rb
77
127
  - test/bibtex/testdocument.bib
78
128
  - test/bibtex/testdocument.tex
129
+ - test/dvipdfm/rakefile.rb
130
+ - test/dvipdfm/testdocument.tex
131
+ - test/gloss/rakefile.rb
132
+ - test/gloss/test_gloss.bib
133
+ - test/gloss/testdocument.tex
79
134
  - test/includes/rakefile.rb
80
135
  - test/includes/testdocument.tex
81
136
  - test/includes/testincludes/testinclude1.tex
@@ -86,8 +141,11 @@ test_files:
86
141
  - test/longtable/testdocument.tex
87
142
  - test/minitoc/rakefile.rb
88
143
  - test/minitoc/testdocument.tex
144
+ - test/ps2pdf/rakefile.rb
145
+ - test/ps2pdf/testdocument.tex
89
146
  - test/rail/rakefile.rb
90
147
  - test/rail/testrail.tex
148
+ - test/rail/testrail_error.tex
91
149
  - test/splitindex/rakefile.rb
92
150
  - test/splitindex/testdocument.tex
93
151
  - test/supertabular/rakefile.rb