condom 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +9 -0
- data/README.rdoc +62 -4
- data/bin/condom +14 -9
- data/lib/condom.rb +12 -117
- data/lib/condom/base.rb +97 -0
- data/lib/condom/document.rb +58 -0
- data/lib/condom/letter.rb +46 -0
- data/lib/condom/presentation.rb +59 -0
- data/lib/views/Makefile.erb +4 -2
- data/lib/views/colors.tex.erb +6 -0
- data/lib/views/commands.tex.erb +7 -1
- data/lib/views/fig.tex.erb +4 -2
- data/lib/views/flyleaf.tex.erb +4 -2
- data/lib/views/letter.tex.erb +48 -0
- data/lib/views/lst-conf.tex.erb +3 -1
- data/lib/views/main.tex.erb +4 -2
- data/lib/views/packages.tex.erb +24 -19
- data/lib/views/{main_beamer.tex.erb → presentation.tex.erb} +4 -2
- metadata +11 -6
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 0.2.0
|
2
|
+
|
3
|
+
* Changed files organisation: specific documents now extend a Base class.
|
4
|
+
* Added a Presentation class.
|
5
|
+
* Added a Letter class.
|
6
|
+
* Added a VERSION constant to the lib.
|
7
|
+
* Updated the executable.
|
8
|
+
* Cleaned the ouput LaTeX code.
|
9
|
+
|
1
10
|
== 0.1.1
|
2
11
|
|
3
12
|
Made the executable prettier (confirmation and help).
|
data/README.rdoc
CHANGED
@@ -2,18 +2,37 @@
|
|
2
2
|
|
3
3
|
A Ruby lib to create a skeleton for a LaTeX document.
|
4
4
|
|
5
|
+
This lib requires that you know the LaTeX language.
|
6
|
+
|
7
|
+
Its purpose is not to write a whole document for you,
|
8
|
+
but to facilitate the preparation of a LaTeX document,
|
9
|
+
that is to say to create a set of files to easily start it.
|
10
|
+
So you won't have to care about packages to import, configuration, etc.
|
11
|
+
The compilation, cleanup and interaction with the sources
|
12
|
+
are facilitated by the usage of a Makefile (see the Usage section below).
|
13
|
+
|
14
|
+
The document types supported for the moment are:
|
15
|
+
* Any classic type (article, report, book, ...)
|
16
|
+
* Presentation (i.e. a beamer document)
|
17
|
+
* Letter
|
18
|
+
|
5
19
|
== Installation
|
6
20
|
|
21
|
+
Condom is available on Rubygems.org[http://rubygems.org/gems/condom] and can be installed with:
|
22
|
+
|
7
23
|
$ gem install condom
|
8
24
|
|
25
|
+
This command needs Rubygems (rubygems package on Ubuntu).
|
26
|
+
|
9
27
|
== Usage
|
10
28
|
|
11
|
-
|
29
|
+
=== Executable
|
12
30
|
|
13
31
|
Condom gem provides a condom shell command.
|
14
32
|
|
15
33
|
$ condom --help
|
16
34
|
Usage: condom [options] [destination]
|
35
|
+
|
17
36
|
Available options:
|
18
37
|
-m, --math Math packages
|
19
38
|
-l, --listings Listings package
|
@@ -25,11 +44,10 @@ Condom gem provides a condom shell command.
|
|
25
44
|
-t, --title=TITLE Define the title
|
26
45
|
-d, --date=DATE Define the date
|
27
46
|
-c, --class=CLASS Define the document class
|
47
|
+
"beamer" for a presentation, "letter" for a letter
|
28
48
|
-L, --language=LANGUAGE Define the language
|
29
49
|
-P, --package=PACKAGE Add another package
|
30
|
-
-v, --version Print version
|
31
|
-
destination:
|
32
|
-
/home/v0n (current directory)
|
50
|
+
-v, --version Print Condom version
|
33
51
|
|
34
52
|
In generated files, there is a Makefile.
|
35
53
|
Just use your document (from the source folder) like below.
|
@@ -43,6 +61,46 @@ clean sources (remove .out, .toc, etc. files) with:
|
|
43
61
|
archive the whole document with:
|
44
62
|
$ make archive
|
45
63
|
|
64
|
+
=== Lib
|
65
|
+
|
66
|
+
You can use the lib to create your document (e.g. using IRB).
|
67
|
+
Here's a quick overview of its operation.
|
68
|
+
|
69
|
+
Create a document with:
|
70
|
+
|
71
|
+
doc = Condom::Document.new
|
72
|
+
|
73
|
+
or a presentation with:
|
74
|
+
|
75
|
+
doc = Condom::Presentation.new
|
76
|
+
|
77
|
+
or a letter with:
|
78
|
+
|
79
|
+
doc = Condom::Letter.new
|
80
|
+
|
81
|
+
All constructors of these classes will use default values, but also accept:
|
82
|
+
* no argument
|
83
|
+
* a String: will be the title of the document
|
84
|
+
* a Hash of options. Keys of the options hash should be symbols with the same name than the attributes of the class.
|
85
|
+
i.e.:
|
86
|
+
|
87
|
+
doc = Condom::Document.new(:document_class => "report", :math => true, :outputdir => "here")
|
88
|
+
|
89
|
+
You can get all options with:
|
90
|
+
|
91
|
+
doc.get_options
|
92
|
+
|
93
|
+
All attributes can be accessed by classic methods:
|
94
|
+
|
95
|
+
doc.title = "My Title"
|
96
|
+
doc.title # => "My Title"
|
97
|
+
|
98
|
+
Then, once your document is ready to be generated, create it with:
|
99
|
+
|
100
|
+
doc.create
|
101
|
+
|
102
|
+
This method will generate all files in the outputdir directory.
|
103
|
+
|
46
104
|
== Technique
|
47
105
|
|
48
106
|
The following command:
|
data/bin/condom
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
1
|
# Command line tool for Condom
|
2
|
+
# Author: Vivien 'v0n' Didelot.
|
3
3
|
|
4
4
|
# Add ../lib to the load path
|
5
5
|
#lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
|
@@ -7,9 +7,9 @@
|
|
7
7
|
|
8
8
|
require 'condom'
|
9
9
|
require 'optparse'
|
10
|
-
#require 'yaml'
|
11
10
|
|
12
|
-
|
11
|
+
doc = Condom::Base.new
|
12
|
+
ops = doc.get_options
|
13
13
|
|
14
14
|
ARGV.options do |o|
|
15
15
|
o.banner = "Usage: #{File.basename $0} [options] [destination]\n"
|
@@ -23,10 +23,11 @@ ARGV.options do |o|
|
|
23
23
|
o.on("-a", "--author=AUTHOR", String, "Define the author") { |v| ops[:author] = v }
|
24
24
|
o.on("-t", "--title=TITLE", String, "Define the title") { |v| ops[:title] = v }
|
25
25
|
o.on("-d", "--date=DATE", String, "Define the date") { |v| ops[:date] = v }
|
26
|
-
o.on("-c", "--class=CLASS", String, "Define the document class"
|
26
|
+
o.on("-c", "--class=CLASS", String, "Define the document class",
|
27
|
+
"\"beamer\" for a presentation, \"letter\" for a letter") { |v| ops[:document_class] = v }
|
27
28
|
o.on("-L", "--language=LANGUAGE", String, "Define the language") { |v| ops[:language] = v }
|
28
|
-
o.on("-P", "--package=PACKAGE", String, "Add another package") { |v| ops[:
|
29
|
-
|
29
|
+
o.on("-P", "--package=PACKAGE", String, "Add another package") { |v| ops[:other_packages].push v }
|
30
|
+
o.on("-v", "--version", "Print Condom version") { puts "Condom lib: version #{Condom::VERSION}" ; exit }
|
30
31
|
end
|
31
32
|
|
32
33
|
begin
|
@@ -58,10 +59,14 @@ begin
|
|
58
59
|
exit
|
59
60
|
end
|
60
61
|
|
61
|
-
doc =
|
62
|
+
doc = case ops[:document_class]
|
63
|
+
when 'beamer': Condom::Presentation.new
|
64
|
+
when 'letter': Condom::Letter.new
|
65
|
+
else Condom::Document.new
|
66
|
+
end
|
67
|
+
doc.set_options(ops)
|
62
68
|
doc.create
|
63
|
-
|
64
|
-
puts "Document created in #{doc.outputdir}."
|
69
|
+
puts "Files created in #{doc.outputdir}."
|
65
70
|
rescue => e
|
66
71
|
STDERR.puts "error: #{e}"
|
67
72
|
end
|
data/lib/condom.rb
CHANGED
@@ -1,131 +1,26 @@
|
|
1
|
-
|
1
|
+
require "condom/base"
|
2
|
+
require "condom/letter"
|
3
|
+
require "condom/document"
|
4
|
+
require "condom/presentation"
|
2
5
|
|
3
|
-
|
6
|
+
require "etc"
|
4
7
|
|
5
|
-
require 'etc'
|
6
|
-
require 'erb'
|
7
|
-
require 'fileutils'
|
8
|
-
|
9
|
-
# The Condom module
|
10
8
|
module Condom
|
9
|
+
# Lib version
|
10
|
+
VERSION = '0.2.0'
|
11
|
+
|
11
12
|
# Constant views directory
|
12
13
|
VIEWS_DIR = File.join(File.expand_path(File.dirname(__FILE__)), 'views')
|
13
14
|
|
15
|
+
module_function
|
16
|
+
|
14
17
|
# Function to get the name of the user.
|
15
|
-
# It will be the name in the /etc/passwd file (on Un*x
|
18
|
+
# It will be the name in the /etc/passwd file (on Un*x system)
|
16
19
|
# or the system user.
|
17
|
-
def
|
20
|
+
def get_user_name
|
18
21
|
user = Etc.getpwnam(Etc.getlogin)['gecos'].split(',').first
|
19
22
|
user = Etc.getlogin if user.nil?
|
20
23
|
|
21
24
|
return user
|
22
25
|
end
|
23
|
-
|
24
|
-
# The Document class.
|
25
|
-
# This is the main class of the condom lib.
|
26
|
-
class Document
|
27
|
-
attr_accessor :outputdir,
|
28
|
-
:listings, :fancyhdr, :graphics, :math, :pdf,
|
29
|
-
:filename, :author, :title, :date, :document_class, :language,
|
30
|
-
:packages
|
31
|
-
|
32
|
-
# The default options
|
33
|
-
DEFAULT_OPTIONS = {
|
34
|
-
:outputdir => Dir.getwd,
|
35
|
-
:listings => false,
|
36
|
-
:fancyhdr => false,
|
37
|
-
:graphics => false,
|
38
|
-
:math => false,
|
39
|
-
:pdf => true,
|
40
|
-
:filename => 'main',
|
41
|
-
:author => Condom.get_user_name,
|
42
|
-
:title => 'Document \LaTeX',
|
43
|
-
:date => '\today',
|
44
|
-
:document_class => 'article',
|
45
|
-
:language => 'francais',
|
46
|
-
:packages => Array.new
|
47
|
-
}
|
48
|
-
|
49
|
-
# The constructor.
|
50
|
-
# Argument could be nothing,
|
51
|
-
# the title of the document,
|
52
|
-
# a hash of options.
|
53
|
-
def initialize(*args)
|
54
|
-
# Need to initialize each variables else they won't exist in instance_variables.
|
55
|
-
@outputdir = @listings = @fancyhdr = @graphics = @math = @pdf = @filename = @author = @title = @date = @document_class = @language = @packages = nil
|
56
|
-
|
57
|
-
set_options DEFAULT_OPTIONS
|
58
|
-
|
59
|
-
arg = args.first
|
60
|
-
if arg.is_a? String
|
61
|
-
@title = arg
|
62
|
-
elsif arg.is_a? Hash
|
63
|
-
set_options arg
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# This method returns a hash of the options of the document.
|
68
|
-
def get_options
|
69
|
-
hash = Hash.new
|
70
|
-
instance_variables.each do |var|
|
71
|
-
hash[var[1..-1].to_sym] = instance_variable_get(var)
|
72
|
-
end
|
73
|
-
|
74
|
-
return hash
|
75
|
-
end
|
76
|
-
|
77
|
-
# This method sets options of the document given in a hash
|
78
|
-
def set_options(hash)
|
79
|
-
hash.keys.each do |key|
|
80
|
-
var = '@' << key.to_s
|
81
|
-
raise("Key #{key} not supported.") unless instance_variables.include? var
|
82
|
-
instance_variable_set(var, hash[key])
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
# This method creates the output directory (if needed)
|
87
|
-
# and write in it all files needed.
|
88
|
-
def create
|
89
|
-
# Verify output
|
90
|
-
FileUtils.makedirs @outputdir
|
91
|
-
Dir.chdir @outputdir do
|
92
|
-
raise("#{@outputdir}: it already exists a main.tex file") if File.exist? "main.tex"
|
93
|
-
raise("#{@outputdir}: it already exists a Makefile") if File.exist? "Makefile"
|
94
|
-
|
95
|
-
# Create files
|
96
|
-
if @document_class == "beamer"
|
97
|
-
build "main_beamer.tex"
|
98
|
-
else
|
99
|
-
build "main.tex"
|
100
|
-
end
|
101
|
-
build "Makefile"
|
102
|
-
if @graphics
|
103
|
-
build "fig.tex"
|
104
|
-
Dir.mkdir "fig"
|
105
|
-
end
|
106
|
-
Dir.mkdir "src" if @listings
|
107
|
-
Dir.mkdir "inc"
|
108
|
-
Dir.chdir "inc" do
|
109
|
-
build "packages.tex"
|
110
|
-
build "commands.tex"
|
111
|
-
build "colors.tex"
|
112
|
-
build "lst-conf.tex" if @listings
|
113
|
-
build "flyleaf.tex" if @document_class == "report"
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
private
|
119
|
-
|
120
|
-
# This fonction writes a file from its template
|
121
|
-
def build template
|
122
|
-
file = (template == "main_beamer.tex") ? "main.tex" : template
|
123
|
-
|
124
|
-
erb = File.read(File.join(VIEWS_DIR, template + ".erb"))
|
125
|
-
content = ERB.new(erb).result(binding)
|
126
|
-
File.open(file, 'w') do |f|
|
127
|
-
f.write content
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
26
|
end
|
data/lib/condom/base.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "erb"
|
3
|
+
|
4
|
+
#TODO Split author with space to get firstname and lastname?
|
5
|
+
|
6
|
+
# The Condom module
|
7
|
+
module Condom
|
8
|
+
# The Base class.
|
9
|
+
# This is the main class of the condom lib.
|
10
|
+
# It will contain all common attributes and methods to every LaTeX document.
|
11
|
+
class Base
|
12
|
+
attr_accessor :outputdir, :filename,
|
13
|
+
:author, :title, :date, :document_class, :language,
|
14
|
+
:other_packages
|
15
|
+
|
16
|
+
# The constructor.
|
17
|
+
# args could be:
|
18
|
+
# * nothing,
|
19
|
+
# * the title of the document,
|
20
|
+
# * a hash of options.
|
21
|
+
def initialize(args = nil)
|
22
|
+
# Need to initialize each variables else they won't exist in instance_variables.
|
23
|
+
@outputdir = @filename = @author = @title = @date = @document_class = @language = @other_packages = nil
|
24
|
+
|
25
|
+
# The default options
|
26
|
+
set_options({
|
27
|
+
:outputdir => Dir.getwd,
|
28
|
+
:filename => 'main',
|
29
|
+
:author => Condom.get_user_name,
|
30
|
+
:title => 'Document \LaTeX',
|
31
|
+
:date => '\today',
|
32
|
+
:document_class => 'article',
|
33
|
+
:language => 'francais',
|
34
|
+
:other_packages => Array.new
|
35
|
+
})
|
36
|
+
|
37
|
+
if args.is_a? String
|
38
|
+
@title = args
|
39
|
+
elsif args.is_a? Hash
|
40
|
+
set_options args
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# This method returns a hash of the options of the document.
|
45
|
+
def get_options
|
46
|
+
hash = Hash.new
|
47
|
+
instance_variables.each do |var|
|
48
|
+
hash[var[1..-1].to_sym] = instance_variable_get(var)
|
49
|
+
end
|
50
|
+
|
51
|
+
return hash
|
52
|
+
end
|
53
|
+
|
54
|
+
# This method sets options of the document given in a hash
|
55
|
+
def set_options(hash)
|
56
|
+
hash.keys.each do |key|
|
57
|
+
var = '@' << key.to_s
|
58
|
+
raise("Key #{key} not supported.") unless instance_variables.include? var
|
59
|
+
instance_variable_set(var, hash[key])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# This method will create in output directory all needed files.
|
64
|
+
def create
|
65
|
+
in_outputdir do
|
66
|
+
raise("Please use a specific Condom class, not Base.")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
# This method creates the output directory (if needed)
|
73
|
+
# and execute the block given in parameter.
|
74
|
+
def in_outputdir
|
75
|
+
# Verify output
|
76
|
+
FileUtils.makedirs @outputdir
|
77
|
+
raise(ArgumentError, "A block should be given") unless block_given?
|
78
|
+
|
79
|
+
Dir.chdir @outputdir do
|
80
|
+
raise("#{@outputdir}: it already exists a main.tex file") if File.exist? "main.tex"
|
81
|
+
raise("#{@outputdir}: it already exists a Makefile") if File.exist? "Makefile"
|
82
|
+
|
83
|
+
# Call the given instructions block
|
84
|
+
yield
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# This fonction writes a file from its template
|
89
|
+
def build template
|
90
|
+
erb = File.read(File.join(VIEWS_DIR, template + ".erb"))
|
91
|
+
content = ERB.new(erb).result(binding)
|
92
|
+
File.open(template, 'w') do |f|
|
93
|
+
f.write content.gsub(/\n\n\n+/, "\n\n")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# The Condom module
|
2
|
+
module Condom
|
3
|
+
# The Document class.
|
4
|
+
# This class is used to produce classic document such as article, report, etc.
|
5
|
+
class Document < Condom::Base
|
6
|
+
attr_accessor :listings, :fancyhdr, :graphics, :math, :pdf
|
7
|
+
|
8
|
+
# The constructor.
|
9
|
+
# Argument could be:
|
10
|
+
# * nothing,
|
11
|
+
# * the title of the document,
|
12
|
+
# * a hash of options.
|
13
|
+
def initialize(args = nil)
|
14
|
+
# Need to initialize each variables else they won't exist in instance_variables.
|
15
|
+
@listings = @fancyhdr = @graphics = @math = @pdf = nil
|
16
|
+
|
17
|
+
# The default options
|
18
|
+
options = {
|
19
|
+
:filename => 'document',
|
20
|
+
:listings => false,
|
21
|
+
:fancyhdr => false,
|
22
|
+
:graphics => false,
|
23
|
+
:math => false,
|
24
|
+
:pdf => true
|
25
|
+
}
|
26
|
+
|
27
|
+
if args.is_a? String
|
28
|
+
options[:title] = args
|
29
|
+
elsif args.is_a? Hash
|
30
|
+
options.merge! args
|
31
|
+
end
|
32
|
+
|
33
|
+
super(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
# This method will write in the output directory all needed files.
|
37
|
+
def create
|
38
|
+
in_outputdir do
|
39
|
+
# Create files
|
40
|
+
build "main.tex"
|
41
|
+
build "Makefile"
|
42
|
+
if @graphics
|
43
|
+
build "fig.tex"
|
44
|
+
Dir.mkdir "fig"
|
45
|
+
end
|
46
|
+
Dir.mkdir "src" if @listings
|
47
|
+
Dir.mkdir "inc"
|
48
|
+
Dir.chdir "inc" do
|
49
|
+
build "packages.tex"
|
50
|
+
build "commands.tex"
|
51
|
+
build "colors.tex"
|
52
|
+
build "lst-conf.tex" if @listings
|
53
|
+
build "flyleaf.tex" if @document_class == "report"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# The Condom module
|
2
|
+
module Condom
|
3
|
+
# The Letter class.
|
4
|
+
# This class is used to produce a letter.
|
5
|
+
class Letter < Condom::Base
|
6
|
+
attr_accessor :address, :recipient, :recipient_address
|
7
|
+
|
8
|
+
# The constructor.
|
9
|
+
# Argument could be:
|
10
|
+
# * nothing,
|
11
|
+
# * the title of the document,
|
12
|
+
# * a hash of options.
|
13
|
+
def initialize(args = nil)
|
14
|
+
# Need to initialize each variables else they won't exist in instance_variables.
|
15
|
+
@address = @recipient = @recipient_address = nil
|
16
|
+
|
17
|
+
# The default options
|
18
|
+
options = {
|
19
|
+
:document_class => 'letter',
|
20
|
+
:title => 'Lettre \LaTeX',
|
21
|
+
:filename => 'letter',
|
22
|
+
:address => '',
|
23
|
+
:recipient => 'Mr John Smith',
|
24
|
+
:recipient_address => ''
|
25
|
+
}
|
26
|
+
|
27
|
+
if args.is_a? String
|
28
|
+
options[:title] = args
|
29
|
+
elsif args.is_a? Hash
|
30
|
+
options.merge! args
|
31
|
+
end
|
32
|
+
|
33
|
+
super(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
# This method will write in the output directory all needed files.
|
37
|
+
def create
|
38
|
+
in_outputdir do
|
39
|
+
# Create files
|
40
|
+
build "letter.tex"
|
41
|
+
File.rename("letter.tex", "main.tex")
|
42
|
+
build "Makefile"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# The Condom module
|
2
|
+
module Condom
|
3
|
+
# The Presentation class.
|
4
|
+
# This class is used to produce Beamer presentation.
|
5
|
+
class Presentation < Condom::Base
|
6
|
+
attr_accessor :listings, :graphics, :math
|
7
|
+
|
8
|
+
# The constructor.
|
9
|
+
# Argument could be:
|
10
|
+
# * nothing,
|
11
|
+
# * the title of the document,
|
12
|
+
# * a hash of options.
|
13
|
+
def initialize(args = nil)
|
14
|
+
# Need to initialize each variables else they won't exist in instance_variables.
|
15
|
+
@listings = @graphics = @math = nil
|
16
|
+
|
17
|
+
# The default options
|
18
|
+
options = {
|
19
|
+
:document_class => 'beamer',
|
20
|
+
:title => 'Présentation \LaTeX',
|
21
|
+
:filename => 'presentation',
|
22
|
+
:listings => false,
|
23
|
+
:graphics => true,
|
24
|
+
:math => false
|
25
|
+
}
|
26
|
+
|
27
|
+
if args.is_a? String
|
28
|
+
options[:title] = args
|
29
|
+
elsif args.is_a? Hash
|
30
|
+
options.merge! args
|
31
|
+
end
|
32
|
+
|
33
|
+
super(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
# This method will write in the output directory all needed files.
|
37
|
+
def create
|
38
|
+
in_outputdir do
|
39
|
+
# Create files
|
40
|
+
build "presentation.tex"
|
41
|
+
File.rename("presentation.tex", "main.tex")
|
42
|
+
build "Makefile"
|
43
|
+
if @graphics
|
44
|
+
build "fig.tex"
|
45
|
+
Dir.mkdir "fig"
|
46
|
+
end
|
47
|
+
Dir.mkdir "src" if @listings
|
48
|
+
Dir.mkdir "inc"
|
49
|
+
Dir.chdir "inc" do
|
50
|
+
build "packages.tex"
|
51
|
+
build "commands.tex"
|
52
|
+
build "colors.tex"
|
53
|
+
build "lst-conf.tex" if @listings
|
54
|
+
build "flyleaf.tex" if @document_class == "report"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/views/Makefile.erb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Makefile
|
2
2
|
# generated on <%= Time.now %>
|
3
|
-
# by <%= @author %>
|
3
|
+
# by <%= @author %>
|
4
|
+
# With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
# See http://github.com/v0n/condom
|
4
6
|
|
5
7
|
FINAL_FILENAME=<%= @filename %>
|
6
8
|
FILENAME=main
|
@@ -24,7 +26,7 @@ view: all
|
|
24
26
|
|
25
27
|
clean:
|
26
28
|
@echo "cleaning..."
|
27
|
-
@rm -f *.aux *.log *.out *.toc *.lol<% if @listings %> *.lof<% end %><% if @document_class == "beamer" %> *.nav *.snm<% end %><% unless @document_class == "
|
29
|
+
@rm -f *.aux *.log *.out *.toc *.lol<% if @listings %> *.lof<% end %><% if @document_class == "beamer" %> *.nav *.snm<% end %><% unless @document_class == "letter" %>
|
28
30
|
@rm -f inc/*.aux<% end %>
|
29
31
|
@rm -f $(FINAL_FILENAME).tar
|
30
32
|
|
data/lib/views/colors.tex.erb
CHANGED
data/lib/views/commands.tex.erb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
-
%
|
1
|
+
% Personal commands
|
2
|
+
% generated on <%= Time.now %>
|
3
|
+
% by <%= @author %>
|
4
|
+
% With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
% See http://github.com/v0n/condom
|
6
|
+
|
2
7
|
<% if @language == "francais" %>
|
8
|
+
% raccourcis
|
3
9
|
\newcommand{\Cad}{C'est-à-dire~}
|
4
10
|
\newcommand{\cad}{c'est-à-dire~}
|
5
11
|
\newcommand{\pe}{peut-être~}
|
data/lib/views/fig.tex.erb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
%
|
1
|
+
% Tips to insert images in LaTeX
|
2
2
|
% generated on <%= Time.now %>
|
3
|
-
% by <%= @author %>
|
3
|
+
% by <%= @author %>
|
4
|
+
% With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
% See http://github.com/v0n/condom
|
4
6
|
|
5
7
|
% [!h] est facultatif, ca permet d'indiquer la position de la figure (si possible !)
|
6
8
|
% ! = forcer la position
|
data/lib/views/flyleaf.tex.erb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
%
|
1
|
+
% Custom flyleaf for reports
|
2
2
|
% generated on <%= Time.now %>
|
3
|
-
% by <%= @author %>
|
3
|
+
% by <%= @author %>
|
4
|
+
% With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
% See http://github.com/v0n/condom
|
4
6
|
|
5
7
|
% voir http://zoonek.free.fr/LaTeX/LaTeX_samples_title/0.html pour d'autres modeles
|
6
8
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
% LaTeX letter skeleton
|
2
|
+
% generated on <%= Time.now %>
|
3
|
+
% by <%= @author %>
|
4
|
+
% With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
% See http://github.com/v0n/condom
|
6
|
+
|
7
|
+
\documentclass[11pt]{letter}
|
8
|
+
\usepackage[<%= @language %>]{babel} % langue
|
9
|
+
\usepackage[<%= (PLATFORM.include? 'linux') ? 'utf8' : 'latin1' %>]{inputenc}
|
10
|
+
\usepackage{graphicx}
|
11
|
+
\usepackage{geometry}
|
12
|
+
|
13
|
+
\geometry{top=2.5cm, bottom=2.5cm, left=3cm, right=3cm}
|
14
|
+
|
15
|
+
\name{<%= @author %>}
|
16
|
+
\address{<%= @address.gsub("\n", "\\ ") %>}
|
17
|
+
\signature{%
|
18
|
+
<%= @author %>
|
19
|
+
% \includegraphics[height=2.5cm]{signature} % insert your handwritten signature here if you have one
|
20
|
+
}
|
21
|
+
\date{<%= @date %>}
|
22
|
+
|
23
|
+
\begin{document}
|
24
|
+
\begin{letter}{% recipient information goes here: name\\ address
|
25
|
+
<%= @recipient %>\\ <%= @recipient_address.gsub("\n", "\\ ") %>
|
26
|
+
}
|
27
|
+
\opening{\centering \textbf{<%= @title %>}}
|
28
|
+
|
29
|
+
\begin{flushleft}
|
30
|
+
<%= @recipient %>,
|
31
|
+
\end{flushleft}
|
32
|
+
|
33
|
+
\begin{minipage}{\textwidth} % justify text
|
34
|
+
% the body of the letter goes here
|
35
|
+
\end{minipage}
|
36
|
+
|
37
|
+
\closing{<%=
|
38
|
+
case @language
|
39
|
+
when 'francais' : "Veuillez agréer, l'expression de mes sincères salutations,"
|
40
|
+
else "Yours sincerely,"
|
41
|
+
end
|
42
|
+
%>}
|
43
|
+
%\ps{P.S. Here goes your ps}
|
44
|
+
%\cc{others recipients go here}
|
45
|
+
%\encl{Here goes what you have enclosed with the letter}
|
46
|
+
\end{letter}
|
47
|
+
\end{document}
|
48
|
+
|
data/lib/views/lst-conf.tex.erb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
% listings package config file
|
2
2
|
% generated on <%= Time.now %>
|
3
|
-
% by <%= @author %>
|
3
|
+
% by <%= @author %>
|
4
|
+
% With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
% See http://github.com/v0n/condom
|
4
6
|
|
5
7
|
% /!\ ne pas utiliser de caracteres accentues dans les sources (ne gere pas l'utf-8)
|
6
8
|
% pour remplacer les lettres accentues : sed -i -e "y/ÉÈÊÇÀÔéèçàôîêûùï/EEECAOeecaoieuui/" fichier
|
data/lib/views/main.tex.erb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
% LaTeX skeleton
|
1
|
+
% LaTeX document skeleton
|
2
2
|
% generated on <%= Time.now %>
|
3
|
-
% by <%= @author %>
|
3
|
+
% by <%= @author %>
|
4
|
+
% With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
% See http://github.com/v0n/condom
|
4
6
|
|
5
7
|
%%%%%%%%%%%%%
|
6
8
|
% PREAMBULE %
|
data/lib/views/packages.tex.erb
CHANGED
@@ -1,44 +1,49 @@
|
|
1
|
+
% LaTeX packages to import
|
2
|
+
% generated on <%= Time.now %>
|
3
|
+
% by <%= @author %>
|
4
|
+
% With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
% See http://github.com/v0n/condom
|
6
|
+
|
1
7
|
\usepackage[T1]{fontenc} % codage des caracteres
|
2
8
|
|
3
|
-
|
4
|
-
\usepackage[<%= enc %>]{inputenc} % encodage du fichier (utf8 ou latin1)
|
9
|
+
\usepackage[<%= (PLATFORM.include? 'linux') ? 'utf8' : 'latin1' %>]{inputenc} % encodage du fichier (utf8 ou latin1)
|
5
10
|
\usepackage[<%= @language %>]{babel} % langue
|
6
11
|
\usepackage{mathpazo} % selection de la police
|
7
12
|
\usepackage{geometry} % mise en page
|
8
13
|
\usepackage{xcolor} % pour colorer des elements
|
9
14
|
|
10
15
|
<% if @graphics %>
|
11
|
-
\usepackage{graphicx} % pour inserer des images
|
16
|
+
\usepackage{graphicx} % pour inserer des images
|
12
17
|
<% end %>
|
13
18
|
|
14
19
|
<% if @math %>
|
15
|
-
% math
|
16
|
-
\usepackage{amssymb} % symboles mathematiques
|
17
|
-
%\usepackage{amsmath} % commandes mathematiques
|
20
|
+
% math
|
21
|
+
\usepackage{amssymb} % symboles mathematiques
|
22
|
+
%\usepackage{amsmath} % commandes mathematiques
|
18
23
|
<% end %>
|
19
24
|
|
20
25
|
<% if @pdf %>
|
21
|
-
% pdf
|
22
|
-
\usepackage{url} % permet l'insertion d'url
|
23
|
-
\usepackage[pdftex]{hyperref} % permet l'hypertexte (rend les liens cliquables)
|
26
|
+
% pdf
|
27
|
+
\usepackage{url} % permet l'insertion d'url
|
28
|
+
\usepackage[pdftex]{hyperref} % permet l'hypertexte (rend les liens cliquables)
|
24
29
|
<% end %>
|
25
30
|
|
26
31
|
<% if @listings %>
|
27
|
-
% listings
|
28
|
-
\usepackage{listings} % permet d'inserer du code (multi-langage)
|
29
|
-
\usepackage{courier}
|
30
|
-
\usepackage{caption}
|
32
|
+
% listings
|
33
|
+
\usepackage{listings} % permet d'inserer du code (multi-langage)
|
34
|
+
\usepackage{courier}
|
35
|
+
\usepackage{caption}
|
31
36
|
<% end %>
|
32
37
|
|
33
38
|
<% if @fancyhdr %>
|
34
|
-
% fancyhdr
|
35
|
-
\usepackage{lastpage} % derniere page
|
36
|
-
\usepackage{fancyhdr} % en-tete et pied de page
|
39
|
+
% fancyhdr
|
40
|
+
\usepackage{lastpage} % derniere page
|
41
|
+
\usepackage{fancyhdr} % en-tete et pied de page
|
37
42
|
<% end %>
|
38
43
|
|
39
44
|
\usepackage{multicol}
|
40
45
|
|
41
|
-
<% for package in @
|
42
|
-
\usepackage{
|
46
|
+
<% for package in @other_packages do %>
|
47
|
+
\usepackage{<%= package %>}
|
43
48
|
<% end %>
|
44
|
-
|
49
|
+
|
@@ -1,6 +1,8 @@
|
|
1
|
-
% LaTeX skeleton
|
1
|
+
% LaTeX presentation skeleton
|
2
2
|
% generated on <%= Time.now %>
|
3
|
-
% by <%= @author %>
|
3
|
+
% by <%= @author %>
|
4
|
+
% With the Condom lib (version <%= Condom::VERSION %>)
|
5
|
+
% See http://github.com/v0n/condom
|
4
6
|
|
5
7
|
%%%%%%%%%%%%%
|
6
8
|
% PREAMBULE %
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: condom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Vivien Didelot
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-18 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -31,12 +31,17 @@ files:
|
|
31
31
|
- lib/views/flyleaf.tex.erb
|
32
32
|
- lib/views/main.tex.erb
|
33
33
|
- lib/views/lst-conf.tex.erb
|
34
|
+
- lib/views/presentation.tex.erb
|
34
35
|
- lib/views/packages.tex.erb
|
35
36
|
- lib/views/fig.tex.erb
|
36
|
-
- lib/views/
|
37
|
+
- lib/views/letter.tex.erb
|
37
38
|
- lib/views/colors.tex.erb
|
38
39
|
- lib/views/Makefile.erb
|
39
40
|
- lib/views/commands.tex.erb
|
41
|
+
- lib/condom/base.rb
|
42
|
+
- lib/condom/document.rb
|
43
|
+
- lib/condom/letter.rb
|
44
|
+
- lib/condom/presentation.rb
|
40
45
|
- lib/condom.rb
|
41
46
|
- README.rdoc
|
42
47
|
- CHANGELOG.rdoc
|