condom 1.0.0 → 1.0.1
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 +3 -3
- data/bin/condom +2 -2
- data/lib/condom.rb +1 -1
- data/lib/condom/base.rb +4 -1
- data/lib/condom/document.rb +3 -2
- data/lib/condom/presentation.rb +1 -1
- data/lib/views/{main.tex.erb → document.tex.erb} +25 -23
- data/lib/views/letter.tex.erb +1 -1
- data/lib/views/{lst-conf.tex.erb → listings.tex.erb} +0 -0
- data/lib/views/packages.tex.erb +16 -16
- data/lib/views/presentation.tex.erb +1 -1
- metadata +5 -8
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.0.1
|
2
|
+
|
3
|
+
* Added fixes for 1.9.* Ruby versions:
|
4
|
+
* Added a workaround for instance_variables method (see set_options in base.rb)
|
5
|
+
* Used RUBY_PLATFORM instead of PLATFORM (removed in 1.9.1)
|
6
|
+
* Renamed main.tex.erb to document.tex.erb
|
7
|
+
* Renamed lst-conf.tex.erb to listings.tex.erb
|
8
|
+
* Cleaned generated LaTeX code indentation
|
9
|
+
|
1
10
|
== 1.0.0
|
2
11
|
|
3
12
|
* Rewrote the executable, it is now simpler and allow user to change every fields (see the README).
|
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Condom
|
2
2
|
|
3
|
-
A Ruby lib to
|
3
|
+
== A Ruby lib to prepare the skeleton of a LaTeX document
|
4
4
|
|
5
5
|
This lib requires that you know the LaTeX language.
|
6
6
|
|
@@ -121,7 +121,7 @@ may result the creation of these folders/files:
|
|
121
121
|
├── inc
|
122
122
|
│ ├── colors.tex
|
123
123
|
│ ├── commands.tex
|
124
|
-
│ ├──
|
124
|
+
│ ├── listings.tex
|
125
125
|
│ └── packages.tex
|
126
126
|
├── main.tex
|
127
127
|
├── Makefile
|
@@ -134,7 +134,7 @@ This is the folder where you should put your images.
|
|
134
134
|
This folder has all configuration tex files:
|
135
135
|
* colors.tex - customized colors
|
136
136
|
* commands.tex - customized commands
|
137
|
-
*
|
137
|
+
* listings.tex - configuration file for the listings package
|
138
138
|
* packages - all needed packages
|
139
139
|
|
140
140
|
=== main.tex
|
data/bin/condom
CHANGED
@@ -26,7 +26,7 @@ ARGV.options do |o|
|
|
26
26
|
o.on("-p", "--package=PACKAGE", String, "Add another package") { |v| ops[:other_packages].push v }
|
27
27
|
o.on("-o", "--directory=DIRECTORY", String, "Define the output directory") { |v| ops[:directory] = v }
|
28
28
|
o.on("-q", "--quiet", "Don't ask any question") { quiet = true }
|
29
|
-
o.on("-v", "--version", "Print Condom version") { puts "Condom
|
29
|
+
o.on("-v", "--version", "Print Condom version") { puts "Condom: version #{Condom::VERSION}" ; exit }
|
30
30
|
end
|
31
31
|
|
32
32
|
begin
|
@@ -57,7 +57,7 @@ begin
|
|
57
57
|
puts "Enter the new value, or press ENTER for the default"
|
58
58
|
|
59
59
|
doc_type = doc.class.to_s.split('::').last.downcase
|
60
|
-
printf "
|
60
|
+
printf " %-17s [%s]: ", "type", doc_type
|
61
61
|
type = STDIN.gets.strip
|
62
62
|
doc = case type
|
63
63
|
when 'document' then Condom::Document.new(ops)
|
data/lib/condom.rb
CHANGED
data/lib/condom/base.rb
CHANGED
@@ -55,7 +55,10 @@ module Condom
|
|
55
55
|
def set_options(hash)
|
56
56
|
hash.keys.each do |key|
|
57
57
|
var = '@' << key.to_s
|
58
|
-
|
58
|
+
# = 1.9.* Fix
|
59
|
+
# The map method applied on instance_variables is used to force elements to be String
|
60
|
+
# because on 1.9.* Ruby versions, these elements are Symbol (i.e. :@directory).
|
61
|
+
raise("Key #{key} not supported.") unless instance_variables.map {|v| v.to_s}.include? var
|
59
62
|
instance_variable_set(var, hash[key])
|
60
63
|
end
|
61
64
|
end
|
data/lib/condom/document.rb
CHANGED
@@ -37,7 +37,8 @@ module Condom
|
|
37
37
|
def create
|
38
38
|
in_directory do
|
39
39
|
# Create files
|
40
|
-
build "
|
40
|
+
build "document.tex"
|
41
|
+
File.rename("document.tex", "main.tex")
|
41
42
|
build "Makefile"
|
42
43
|
if @graphics
|
43
44
|
build "fig.tex"
|
@@ -49,7 +50,7 @@ module Condom
|
|
49
50
|
build "packages.tex"
|
50
51
|
build "commands.tex"
|
51
52
|
build "colors.tex"
|
52
|
-
build "
|
53
|
+
build "listings.tex" if @listings
|
53
54
|
build "flyleaf.tex" if @document_class == "report"
|
54
55
|
end
|
55
56
|
end
|
data/lib/condom/presentation.rb
CHANGED
@@ -14,27 +14,27 @@
|
|
14
14
|
\input{inc/colors}
|
15
15
|
\input{inc/commands}
|
16
16
|
<% if @listings %>
|
17
|
-
|
17
|
+
\input{inc/listings} % fichier de config du paquet listings
|
18
18
|
<% end %>
|
19
19
|
|
20
20
|
\geometry{top=2.5cm, bottom=2.5cm, left=2cm, right=2cm}
|
21
21
|
<% if @graphics %>
|
22
|
-
|
22
|
+
\graphicspath{{fig/}} % chemins vers les images
|
23
23
|
<% end %>
|
24
24
|
|
25
25
|
% informations du document
|
26
26
|
\author{<%= @author %>}
|
27
|
-
\date{
|
27
|
+
\date{<%= @date %>}
|
28
28
|
\title{<%= @title %>}
|
29
29
|
|
30
30
|
<% if @document_class == "report" %>
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
%\input{inc/flyleaf.tex} % page de garde personnalisee
|
32
|
+
%\location{}
|
33
|
+
%\blurb{}
|
34
34
|
<% end %>
|
35
35
|
|
36
36
|
<% if @pdf %>
|
37
|
-
|
37
|
+
\hypersetup{%
|
38
38
|
pdftitle = {<%= @title %>},
|
39
39
|
pdfauthor = {<%= @author %>}
|
40
40
|
pdfcreator = {Texlive},
|
@@ -43,28 +43,28 @@
|
|
43
43
|
linkcolor = black,
|
44
44
|
citecolor = black,
|
45
45
|
urlcolor = black
|
46
|
-
|
46
|
+
} % informations du pdf
|
47
47
|
<% end %>
|
48
48
|
|
49
49
|
<% if @fancyhdr %>
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
\pagestyle{fancy}
|
51
|
+
\lhead{<%= @title %>}
|
52
|
+
\chead{}
|
53
|
+
\rhead{\thepage/\pageref{LastPage}}
|
54
|
+
\lfoot{}
|
55
|
+
\cfoot{}
|
56
|
+
\rfoot{\footnotesize <%= @author %>}
|
57
|
+
%\renewcommand{\headrulewidth}{0pt}
|
58
|
+
%\renewcommand{\footrulewidth}{0.4pt}
|
59
|
+
\fancypagestyle{plain}{% % style des pages de titres
|
60
60
|
\fancyhf{}
|
61
61
|
\renewcommand{\headrulewidth}{0pt}
|
62
62
|
\renewcommand{\footrulewidth}{0pt}
|
63
|
-
|
63
|
+
}
|
64
64
|
<% end %>
|
65
65
|
|
66
66
|
<% if @document_class == "report" %>
|
67
|
-
|
67
|
+
\renewcommand{\thesection}{\Roman{part}.\arabic{section}} % redefinir la numerotation des sections (ex: I.2)
|
68
68
|
<% end %>
|
69
69
|
|
70
70
|
\makeatletter
|
@@ -83,20 +83,22 @@
|
|
83
83
|
|
84
84
|
\maketitle % afficher le titre
|
85
85
|
|
86
|
+
<% unless @document_class == "book" %>
|
86
87
|
% resume
|
87
88
|
\begin{abstract}
|
88
89
|
\end{abstract}
|
90
|
+
<% end %>
|
89
91
|
|
90
92
|
\tableofcontents % table des matieres
|
91
93
|
|
92
94
|
<% if @listings %>
|
93
|
-
|
95
|
+
\lstlistoflistings % tables des listings
|
94
96
|
<% end %>
|
95
97
|
|
96
98
|
<% if @document_class == "article" %>
|
97
|
-
|
99
|
+
\newpage
|
98
100
|
<% elsif @document_class == "report" %>
|
99
|
-
|
101
|
+
\unnumpart{Introduction}
|
100
102
|
<% end %>
|
101
103
|
|
102
104
|
\end{document} % fin du document
|
data/lib/views/letter.tex.erb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
\documentclass[11pt]{letter}
|
8
8
|
\usepackage[<%= @language %>]{babel} % langue
|
9
|
-
\usepackage[<%= (
|
9
|
+
\usepackage[<%= (RUBY_PLATFORM.include? 'linux') ? 'utf8' : 'latin1' %>]{inputenc}
|
10
10
|
\usepackage{graphicx}
|
11
11
|
\usepackage{geometry}
|
12
12
|
|
File without changes
|
data/lib/views/packages.tex.erb
CHANGED
@@ -6,44 +6,44 @@
|
|
6
6
|
|
7
7
|
\usepackage[T1]{fontenc} % codage des caracteres
|
8
8
|
|
9
|
-
\usepackage[<%= (
|
9
|
+
\usepackage[<%= (RUBY_PLATFORM.include? 'linux') ? 'utf8' : 'latin1' %>]{inputenc} % encodage du fichier (utf8 ou latin1)
|
10
10
|
\usepackage[<%= @language %>]{babel} % langue
|
11
11
|
\usepackage{mathpazo} % selection de la police
|
12
12
|
\usepackage{geometry} % mise en page
|
13
13
|
\usepackage{xcolor} % pour colorer des elements
|
14
14
|
|
15
15
|
<% if @graphics %>
|
16
|
-
|
16
|
+
\usepackage{graphicx} % pour inserer des images
|
17
17
|
<% end %>
|
18
18
|
|
19
19
|
<% if @math %>
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
% math
|
21
|
+
\usepackage{amssymb} % symboles mathematiques
|
22
|
+
%\usepackage{amsmath} % commandes mathematiques
|
23
23
|
<% end %>
|
24
24
|
|
25
25
|
<% if @pdf %>
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
% pdf
|
27
|
+
\usepackage{url} % permet l'insertion d'url
|
28
|
+
\usepackage[pdftex]{hyperref} % permet l'hypertexte (rend les liens cliquables)
|
29
29
|
<% end %>
|
30
30
|
|
31
31
|
<% if @listings %>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
% listings
|
33
|
+
\usepackage{listings} % permet d'inserer du code (multi-langage)
|
34
|
+
\usepackage{courier}
|
35
|
+
\usepackage{caption}
|
36
36
|
<% end %>
|
37
37
|
|
38
38
|
<% if @fancyhdr %>
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
% fancyhdr
|
40
|
+
\usepackage{lastpage} % derniere page
|
41
|
+
\usepackage{fancyhdr} % en-tete et pied de page
|
42
42
|
<% end %>
|
43
43
|
|
44
44
|
\usepackage{multicol}
|
45
45
|
|
46
46
|
<% for package in @other_packages do %>
|
47
|
-
|
47
|
+
\usepackage{<%= package %>}
|
48
48
|
<% end %>
|
49
49
|
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: condom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 23
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Vivien Didelot
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-20 00:00:00 +10:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -29,10 +28,10 @@ extra_rdoc_files: []
|
|
29
28
|
|
30
29
|
files:
|
31
30
|
- lib/views/flyleaf.tex.erb
|
32
|
-
- lib/views/
|
33
|
-
- lib/views/lst-conf.tex.erb
|
31
|
+
- lib/views/document.tex.erb
|
34
32
|
- lib/views/presentation.tex.erb
|
35
33
|
- lib/views/packages.tex.erb
|
34
|
+
- lib/views/listings.tex.erb
|
36
35
|
- lib/views/fig.tex.erb
|
37
36
|
- lib/views/letter.tex.erb
|
38
37
|
- lib/views/colors.tex.erb
|
@@ -60,7 +59,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
59
|
requirements:
|
61
60
|
- - ">="
|
62
61
|
- !ruby/object:Gem::Version
|
63
|
-
hash: 3
|
64
62
|
segments:
|
65
63
|
- 0
|
66
64
|
version: "0"
|
@@ -69,7 +67,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
67
|
requirements:
|
70
68
|
- - ">="
|
71
69
|
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
70
|
segments:
|
74
71
|
- 0
|
75
72
|
version: "0"
|