public this repo is viewable by everyone
Description: Ruby LaTeX to PDF preprocessor (and Rails plugin)
Homepage: http://rtex.rubyforge.org
Clone URL: git://github.com/bruce/rtex.git
Click here to lend your support to: rtex and make a donation at www.pledgie.com !
Cleanup docs for 2.0 release
bruce (author)
9 days ago
commit  44c8101c353ff577d1e1501b334c016c6d754ced
tree    6849c60a594404f48f61be1ea732fc8f0361a9cd
parent  4c3a42bdcd10d2af8f4c19b8db22b6b0b08c9719
...
1
2
3
 
4
5
6
 
7
8
9
...
1
2
 
3
4
 
 
5
6
7
8
0
@@ -1,9 +1,8 @@
0
 = RTeX: TeX/PDF Generation for Ruby
0
 
0
-Project homepage: http://rtex.rubyforge.org
0
+Project homepage (FAQ, manual, documentation, contact info): http://rtex.rubyforge.org
0
 
0
-Please file comments and bug reports at http://rubyforge.org/projects/rtex
0
-(in the Forum and the Tracker, respectively).
0
+Source repository at: http://github.com/bruce/rtex
0
 
0
 == Dependencies
0
 
...
12
13
14
 
 
 
15
16
17
...
12
13
14
15
16
17
18
19
20
0
@@ -12,6 +12,9 @@ PROJ.libs = %w[]
0
 PROJ.ruby_opts = []
0
 PROJ.test_opts = []
0
 
0
+PROJ.rdoc_main = 'README.rdoc'
0
+PROJ.rdoc_include.push 'README.rdoc', 'README_RAILS.rdoc'
0
+
0
 PROJ.description = "LaTeX preprocessor for PDF generation; Rails plugin"
0
 PROJ.summary = PROJ.description
0
 
...
4
5
6
7
 
 
8
9
10
11
12
13
 
 
 
 
14
15
16
17
 
 
 
18
19
20
21
22
23
24
25
26
27
28
...
4
5
6
 
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 
 
 
30
31
32
0
@@ -4,25 +4,29 @@ require 'document'
0
 require 'version'
0
 
0
 module RTeX
0
-
0
+
0
+ # Load code to initialize RTeX for framework
0
   def self.framework(name)
0
     require File.dirname(__FILE__) << "/rtex/framework/#{name}"
0
     framework = ::RTeX::Framework.const_get(name.to_s.capitalize)
0
     framework.setup
0
   end
0
   
0
+ def self.filters #:nodoc:
0
+ @filters ||= {}
0
+ end
0
+
0
   def self.basic_layout #:nodoc:
0
     "\\documentclass[12pt]{article}\n\\begin{document}\n<%= yield %>\n\\end{document}"
0
   end
0
   
0
+ # Define a processing filter
0
+ # call-seq:
0
+ # filter(:name) { |text_to_transform| ... } # => result
0
   def self.filter(name, &block)
0
     filters[name.to_s] = block
0
   end
0
   
0
- def self.filters #:nodoc:
0
- @filters ||= {}
0
- end
0
-
0
   filter :textile do |source|
0
     require File.dirname(__FILE__) << '/../vendor/instiki/redcloth_for_tex'
0
     RedClothForTex.new(source).to_tex
...
16
17
18
 
 
 
 
 
19
20
21
22
23
24
 
25
26
27
...
37
38
39
40
 
 
41
42
43
44
45
46
 
 
47
48
49
...
52
53
54
55
 
 
56
57
58
...
60
61
62
 
 
 
 
63
64
65
66
67
 
68
69
70
71
 
72
73
74
75
 
76
77
78
...
80
81
82
 
83
84
85
...
87
88
89
 
90
91
92
...
103
104
105
106
 
107
108
109
...
16
17
18
19
20
21
22
23
24
25
26
27
28
 
29
30
31
32
...
42
43
44
 
45
46
47
48
49
50
51
 
52
53
54
55
56
...
59
60
61
 
62
63
64
65
66
...
68
69
70
71
72
73
74
75
76
77
78
 
79
80
81
82
 
83
84
85
86
 
87
88
89
90
...
92
93
94
95
96
97
98
...
100
101
102
103
104
105
106
...
117
118
119
 
120
121
122
123
0
@@ -16,12 +16,17 @@ module RTeX
0
     class GenerationError < ::StandardError; end
0
     class ExecutableNotFoundError < ::StandardError; end
0
     
0
+ # Default options
0
+ # [+:preprocess+] Are we preprocessing? Default is +false+
0
+ # [+:preprocessor+] Executable to use during preprocessing (generating TOCs, etc). Default is +latex+
0
+ # [+:shell_redirect+] Option redirection for shell output (eg, +"> /dev/null 2>&1"+ ). Default is +nil+.
0
+ # [+:tmpdir+] Location of temporary directory (default: +Dir.tmpdir+)
0
     def self.options
0
       @options ||= {
0
         :preprocessor => 'latex',
0
         :preprocess => false,
0
         :processor => 'pdflatex',
0
- # Option redirection for shell output (eg, set to '> /dev/null 2>&1' )
0
+ #
0
         :shell_redirect => nil,
0
         # Temporary Directory
0
         :tempdir => Dir.tmpdir
0
@@ -37,13 +42,15 @@ module RTeX
0
       end
0
     end
0
     
0
- def source(binding=nil)
0
+ # Get the source for the entire
0
+ def source(binding=nil) #:nodoc:
0
       @source ||= wrap_in_layout do
0
         filter @erb.result(binding)
0
       end
0
     end
0
     
0
- def filter(text)
0
+ # Process through defined filter
0
+ def filter(text) #:nodoc:
0
       return text unless @options[:filter]
0
       if (process = RTeX.filters[@options[:filter]])
0
         process[text]
0
@@ -52,7 +59,8 @@ module RTeX
0
       end
0
     end
0
     
0
- def wrap_in_layout
0
+ # Wrap content in optional layout
0
+ def wrap_in_layout #:nodoc:
0
       if @options[:layout]
0
         ERB.new(@options[:layout]).result(binding)
0
       else
0
@@ -60,19 +68,23 @@ module RTeX
0
       end
0
     end
0
     
0
+ # Generate PDF from
0
+ # call-seq:
0
+ # to_pdf # => PDF in a String
0
+ # to_pdf { |filename| ... }
0
     def to_pdf(binding=nil, &file_handler)
0
       process_pdf_from(source(binding), &file_handler)
0
     end
0
     
0
- def processor
0
+ def processor #:nodoc:
0
       @processor ||= check_path_for @options[:processor]
0
     end
0
     
0
- def preprocessor
0
+ def preprocessor #:nodoc:
0
       @preprocessor ||= check_path_for @options[:preprocessor]
0
     end
0
     
0
- def system_path
0
+ def system_path #:nodoc:
0
       ENV['PATH']
0
     end
0
         
0
@@ -80,6 +92,7 @@ module RTeX
0
     private
0
     #######
0
     
0
+ # Verify existence of executable in search path
0
     def check_path_for(command)
0
       unless FileTest.executable?(command) || system_path.split(":").any?{ |path| FileTest.executable?(File.join(path, command))}
0
         raise ExecutableNotFoundError, command
0
@@ -87,6 +100,7 @@ module RTeX
0
       command
0
     end
0
     
0
+ # Basic processing
0
     def process_pdf_from(input, &file_handler)
0
       Tempdir.open(@options[:tempdir]) do |tempdir|
0
         prepare input
0
@@ -103,7 +117,7 @@ module RTeX
0
       end
0
     end
0
     
0
- def process! #:nodoc:
0
+ def process!
0
       unless `#{processor} --interaction=nonstopmode '#{source_file}' #{@options[:shell_redirect]}`
0
         raise GenerationError, "Could not generate PDF using #{processor}"
0
       end
...
2
3
4
 
5
6
7
8
9
10
 
11
12
13
...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
@@ -2,12 +2,14 @@ module RTeX
0
   
0
   module Escaping
0
     
0
+ # Escape text using +replacements+
0
     def escape(text)
0
       replacements.inject(text) do |corpus, (pattern, replacement)|
0
         corpus.gsub(pattern, replacement)
0
       end
0
     end
0
     
0
+ # List of replacements
0
     def replacements
0
       @replacements ||= [
0
         [/([{}])/, '\\\1'],
...
1
2
3
 
4
5
 
6
7
8
...
1
2
 
3
4
 
5
6
7
8
0
@@ -1,8 +1,8 @@
0
 module RTeX
0
   
0
- module Framework
0
+ module Framework #:nodoc:
0
     
0
- module Merb
0
+ module Merb #:nodoc:
0
       
0
       # TODO
0
       
...
1
2
3
4
5
 
 
6
7
8
...
1
2
3
 
 
4
5
6
7
8
0
@@ -1,8 +1,8 @@
0
 require 'tempfile'
0
 
0
 module RTeX
0
- module Framework
0
- module Rails
0
+ module Framework #:nodoc:
0
+ module Rails #:nodoc:
0
       
0
       def self.setup
0
         RTeX::Document.options[:tempdir] = File.expand_path(File.join(RAILS_ROOT, 'tmp'))
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@ require 'fileutils'
0
 
0
 module RTeX
0
   
0
- class Tempdir
0
+ class Tempdir #:nodoc:
0
         
0
     def self.open(parent_path=RTeX::Document.options[:tempdir])
0
       tempdir = new(parent_path)
...
63
64
65
66
67
 
 
68
69
70
71
72
73
74
...
63
64
65
 
 
66
67
68
69
 
 
70
71
72
0
@@ -63,12 +63,10 @@ module RTeX
0
       [@major, @minor, @tiny]
0
     end
0
 
0
- MAJOR = 1
0
- MINOR = 99
0
+ MAJOR = 2
0
+ MINOR = 0
0
     TINY = 0
0
     
0
- DESCRIPTION = '2.0 Preview 1'
0
-
0
     # The current version as a Version instance
0
     CURRENT = new(MAJOR, MINOR, TINY)
0
     # The current version as a String
...
68
69
70
71
 
72
73
74
...
68
69
70
 
71
72
73
74
0
@@ -68,7 +68,7 @@ pre.dawn span.EmbeddedSource {
0
 
0
 #content dl dt { font-weight: normal; background: #e6e6e6; padding: 4px; margin-top: 0.5em; margin-bottom: 0.25em; }
0
 
0
-<% %w(contact contribute download faq manual roadmap).each do |type| %>
0
+<% %w(contact contribute download faq manual roadmap api).each do |type| %>
0
 .<%= type %> { background: url(/images/icons/<%= type %>.png) center left no-repeat; }
0
 <% end %>
0
 
...
9
10
11
12
13
14
15
...
9
10
11
 
12
13
14
0
@@ -9,7 +9,6 @@ filter:
0
 Here are some basic guidelines on the list of features and target releases.
0
 
0
 | *Feature* | *Target Release* |
0
-| _API documentation_ | 2.0 |
0
 | Loading of custom filters by @rtex@ executable | 2.1 |
0
 | Access to LaTeX filters from plugins | 2.1 |
0
 | "Merb":http://merbivore.com plugin support | 2.2 |
...
52
53
54
 
55
56
57
...
52
53
54
55
56
57
58
0
@@ -52,6 +52,7 @@ filter: erb
0
      <li class='download'><a href='/download'>Download</a></li>
0
      <li class='manual'><a href='/manual'>Manual</a></li>
0
      <li class='roadmap'><a href='/roadmap'>Development Roadmap</a></li>
0
+ <li class='api'><a href='/api'>API Docs</a></li>
0
      <li class='contribute'><a href='/contribute'>Contribute!</a></li>
0
      <li class='contact'><a href='/contact'>Contact</a></li>
0
    </ul>

Comments

    No one has commented yet.