mo2tex 1.0.0 → 1.0.2
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 +4 -4
- data/README.md +26 -3
- data/Rakefile +6 -0
- data/config/templates/pic/{header.pic → header.pic.erb} +1 -2
- data/exe/m2c +1 -1
- data/exe/m2l +1 -1
- data/exe/m2p +1 -1
- data/lib/mo2tex/pic.rb +25 -5
- data/lib/mo2tex/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c715fef710c9144154aceaa77a10137751823c1820de13f0f72aedeb1167c71e
|
4
|
+
data.tar.gz: e4f860857f59181d7d2b58342915a7d7bfc2f6392fd5eb11283c51baa3fe0d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26f07223a6bad0b70004475bf6fb84822e5861232f80c26c9220205833e6b77d2af4c4d4cbe4cdc4c7b397e84abf968e624a5a731dcac6bd0d32bb300f6a39ff
|
7
|
+
data.tar.gz: 3f6ec6ec2bed786f976313e01be027615c0f9e011a6ccd5843093ed3421b77bf10098a4ebe992190ade255da66286d7fb82422ab6666cea6e8196ae9fa55e10a
|
data/README.md
CHANGED
@@ -1,22 +1,45 @@
|
|
1
|
-
# `mo2tex` - A pure `ruby` monteore-to-`latex` table generator
|
1
|
+
# `mo2tex` - A pure `ruby` monteore-to-`latex`, `ical` and `pic` table generator
|
2
2
|
|
3
3
|
](https://gitlab.com/SMELAT/mo2tex/badges/master/pipeline.svg)
|
4
4
|
|
5
|
-
`mo2tex` is a pure `ruby` monteore-to-`latex` table generator
|
5
|
+
`mo2tex` is a pure `ruby` monteore-to-`latex`, `ical` and `pic` table generator
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Install the gem and add to the application's Gemfile by executing:
|
10
10
|
|
11
|
+
```sh
|
11
12
|
$ bundle add mo2tex
|
13
|
+
```
|
12
14
|
|
13
15
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
16
|
|
17
|
+
```sh
|
15
18
|
$ gem install mo2tex
|
19
|
+
```
|
20
|
+
|
21
|
+
## Configuration
|
22
|
+
|
23
|
+
You will have to write a `yaml` configuration file before using `mo2tex`.
|
24
|
+
Please check the [example provided](./config/courses.yml) for a sample configuration file.
|
16
25
|
|
17
26
|
## Usage
|
18
27
|
|
19
|
-
|
28
|
+
After installation, you should be able to run:
|
29
|
+
|
30
|
+
```sh
|
31
|
+
$ m2l <config file> # this should create a latex file on standard out with your monteore listing
|
32
|
+
```
|
33
|
+
|
34
|
+
Please check the [example provided](./config/courses.yml) for a configuration file.
|
35
|
+
|
36
|
+
```sh
|
37
|
+
$ m2c <config file> > <ical calendar file> # this should create an ical file on standard out which you can upload anywhere fitting
|
38
|
+
```
|
39
|
+
|
40
|
+
```sh
|
41
|
+
$ m2p <config file> | groff -p -mpic -Tpdf -P-pa4 # this should create a pdf file on standard out with a table of the lessons
|
42
|
+
```
|
20
43
|
|
21
44
|
## Development
|
22
45
|
|
data/Rakefile
CHANGED
data/exe/m2c
CHANGED
data/exe/m2l
CHANGED
data/exe/m2p
CHANGED
data/lib/mo2tex/pic.rb
CHANGED
@@ -114,11 +114,26 @@ module Mo2tex
|
|
114
114
|
def pic_time
|
115
115
|
return sprintf("%s-%s", self.slot.dtstart.hm_to_s, self.slot.dtend.hm_to_s)
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
def pic_title
|
119
|
-
|
119
|
+
result = self.slot.class == Event ? make_pic_title : self.slot.title
|
120
|
+
return result
|
120
121
|
end
|
121
|
-
|
122
|
+
|
123
|
+
alias_method :title, :pic_title
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
TITLE_RANGE = 2..4 # the title is in this range
|
128
|
+
ANN_RANGE = 5..-1
|
129
|
+
|
130
|
+
def make_pic_title
|
131
|
+
sep = self.slot.title.gsub(/_+/, ' ').split(/ /)
|
132
|
+
acro = sep[TITLE_RANGE].map { |w| w[0] }.join
|
133
|
+
ann = sep[ANN_RANGE].join(' ')
|
134
|
+
return sprintf("%s (%s)", ann, acro)
|
135
|
+
end
|
136
|
+
|
122
137
|
end
|
123
138
|
|
124
139
|
class Container < Base
|
@@ -200,12 +215,16 @@ module Mo2tex
|
|
200
215
|
result = ''
|
201
216
|
self.pages.each do
|
202
217
|
|page|
|
203
|
-
|
218
|
+
result += self.header.result(binding)
|
204
219
|
result += self.body.result(binding)
|
205
220
|
result += self.trailer.result(binding)
|
206
221
|
end
|
207
222
|
return result
|
208
223
|
end
|
224
|
+
|
225
|
+
def absolute_pic_objects_include_path
|
226
|
+
return File.expand_path(File.join(['..'] * 3, 'config', 'templates', 'pic', 'objects.pic'), __FILE__)
|
227
|
+
end
|
209
228
|
|
210
229
|
DAYS_PER_PAGE = 12
|
211
230
|
DAYS_PER_ROW = 4
|
@@ -273,7 +292,8 @@ module Mo2tex
|
|
273
292
|
end
|
274
293
|
|
275
294
|
def read_header
|
276
|
-
|
295
|
+
template = read('header.pic.erb')
|
296
|
+
return ERB.new(template, trim_mode: '-')
|
277
297
|
end
|
278
298
|
|
279
299
|
def read_trailer
|
data/lib/mo2tex/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mo2tex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicola Bernardini
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 2025-01-10 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rdoc
|
@@ -65,7 +65,8 @@ dependencies:
|
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
|
-
description: mo2tex transforms a Monte Ore calendar into a
|
68
|
+
description: mo2tex transforms a Monte Ore calendar into a LaTex table, or an ical
|
69
|
+
file, or a pic table
|
69
70
|
email:
|
70
71
|
- nicola.bernardini.rome@gmail.com
|
71
72
|
executables:
|
@@ -86,7 +87,7 @@ files:
|
|
86
87
|
- config/templates/latex/header.tex
|
87
88
|
- config/templates/latex/trailer.tex
|
88
89
|
- config/templates/pic/body.pic.erb
|
89
|
-
- config/templates/pic/header.pic
|
90
|
+
- config/templates/pic/header.pic.erb
|
90
91
|
- config/templates/pic/objects.pic
|
91
92
|
- config/templates/pic/trailer.pic.erb
|
92
93
|
- exe/m2c
|
@@ -132,5 +133,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
133
|
requirements: []
|
133
134
|
rubygems_version: 3.6.0.dev
|
134
135
|
specification_version: 4
|
135
|
-
summary: mo2tex transforms a Monte Ore calendar into a
|
136
|
+
summary: mo2tex transforms a Monte Ore calendar into a LaTex table, or an ical file,
|
137
|
+
or a pic table
|
136
138
|
test_files: []
|