labrat 1.2.1 → 1.2.3
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/.github/workflows/main.yml +27 -0
- data/.github/workflows/ruby.yml +38 -0
- data/.rubocop.yml +177 -2
- data/Gemfile +11 -5
- data/Gemfile.lock +108 -70
- data/README.org +52 -39
- data/Rakefile +1 -1
- data/bin/labrat +0 -1
- data/labrat.gemspec +5 -13
- data/lib/config_files/labeldb.yml +17 -0
- data/lib/labrat/arg_parser.rb +202 -96
- data/lib/labrat/config.rb +32 -12
- data/lib/labrat/hash.rb +2 -8
- data/lib/labrat/label.rb +28 -12
- data/lib/labrat/label_db.rb +2 -2
- data/lib/labrat/options.rb +48 -22
- data/lib/labrat/read_files.rb +3 -2
- data/lib/labrat/version.rb +1 -1
- data/lib/labrat.rb +1 -0
- data/texlabels/sample.pdf +0 -0
- data/texlabels/sample.tex +9 -5
- metadata +17 -116
- data/texlabels/sample.synctex.gz +0 -0
data/README.org
CHANGED
@@ -5,10 +5,15 @@ This is for markdown output:
|
|
5
5
|
[](https://travis-ci.org/ddoherty03/labrat)
|
6
6
|
|
7
7
|
The following is for org.
|
8
|
-
#+END_COMMENT
|
9
8
|
|
10
|
-
|
9
|
+
NOTE: in order to get the README to render the tilde character properly as
|
10
|
+
"code" in org syntax, I used a unicode character, ˜ called TILDE OPERATOR,
|
11
|
+
inside regular tildes, like this ~∼∼~. Though it looks like four tildes in a
|
12
|
+
row, its actually tilde - TILDE OPERATOR - TILDE OPERATOR - tilde, which
|
13
|
+
renders nicely on Github.
|
14
|
+
#+END_COMMENT
|
11
15
|
|
16
|
+
[[https://github.com/ddoherty03/labrat/actions/workflows/main.yml/badge.svg]]
|
12
17
|
|
13
18
|
* Table of Contents :toc_4:
|
14
19
|
- [[#labrat][Labrat]]
|
@@ -38,7 +43,7 @@ The following is for org.
|
|
38
43
|
- [[#standard-input][Standard input]]
|
39
44
|
- [[#template-exception][Template exception]]
|
40
45
|
- [[#printing-or-viewing][Printing or viewing]]
|
41
|
-
- [[#shell-commands][
|
46
|
+
- [[#printing-and-viewing-shell-commands][Printing and viewing shell commands]]
|
42
47
|
- [[#aids-to-testing-label-layouts][Aids to testing label layouts]]
|
43
48
|
- [[#page-grid-1][Page Grid]]
|
44
49
|
- [[#page-template][Page Template]]
|
@@ -107,8 +112,8 @@ in any buffer and get it generated with very little ceremony.
|
|
107
112
|
As mentioned, one of my main motivations for writing =labrat= was the need to
|
108
113
|
easily create file-folder labels. I got into creating files after reading
|
109
114
|
/Getting Things Done/ by David Allen. One of his recommendations for keeping
|
110
|
-
organized is having a
|
111
|
-
retrieved.
|
115
|
+
organized is having a filing system so that documents can be easily archived
|
116
|
+
and retrieved.
|
112
117
|
|
113
118
|
I have long used Dymo's 30327 label, which is just the right size for file
|
114
119
|
folders. But after several years of use, I started to notice something
|
@@ -139,28 +144,31 @@ install =labrat= with:
|
|
139
144
|
$ gem install labrat
|
140
145
|
#+end_SRC
|
141
146
|
|
142
|
-
After installation, you should install the user and system
|
147
|
+
After installation, you should install the user and system (if you have sudo
|
148
|
+
privileges) configuration files
|
143
149
|
with:
|
144
150
|
|
145
151
|
#+begin_SRC sh
|
146
152
|
$ labrat-install
|
147
153
|
#+end_SRC
|
148
154
|
|
149
|
-
This will install an annotated system-wide
|
150
|
-
=/etc/xdg/labrat/config.yml= and a system-wide label database
|
151
|
-
=/etc/xdg/labrat/labeldb.yml=.
|
155
|
+
This will, assuming you have sudo privileges, install an annotated system-wide
|
156
|
+
config file in =/etc/xdg/labrat/config.yml= and a system-wide label database
|
157
|
+
in =/etc/xdg/labrat/labeldb.yml=.
|
152
158
|
|
153
159
|
It will also install an annotated sample user config file in
|
154
|
-
=~/.config/labrat/labrat.
|
160
|
+
=~/.config/labrat/labrat.yml= and a sample user-level label database in
|
155
161
|
=~/.config/labrat/labeldb.yml=.
|
156
162
|
|
157
163
|
For the benefit of Emacs users, it also installs the =labrat.el= elisp library
|
158
|
-
in =~/.config/labrat= as well
|
159
|
-
|
164
|
+
in =~/.config/labrat= as well. You may want to add this directory to your
|
165
|
+
~load-path~ or copy, move, or link it to a directory already in your
|
166
|
+
~load-path~.
|
160
167
|
|
161
168
|
If you invoke =labrat-install= multiple times, it will refuse to overwrite any
|
162
169
|
existing config or database files that you may have already installed. If you
|
163
|
-
want to re-install them you have to
|
170
|
+
want to re-install them you have to remove the existing files or move them out
|
171
|
+
of the way.
|
164
172
|
|
165
173
|
** Setting options
|
166
174
|
You can control how =labrat= composes a label completely from the
|
@@ -206,7 +214,7 @@ configuration files, string values need not be quoted.
|
|
206
214
|
Labrat can handle multi-label pages such as Avery-style label sheets. These
|
207
215
|
options deal with the page-level dimensions of the, potentially, multi-label
|
208
216
|
page. By contrast, the dimensions of individual labels are dealt with by the
|
209
|
-
label setup options described in the next section.
|
217
|
+
label setup options described in the [[* Label Setup Options][next]] section.
|
210
218
|
|
211
219
|
*** Orientation
|
212
220
|
- ~-L~, ~--[no-]landscape~ :: Orient the label grid and the printing direction
|
@@ -272,12 +280,17 @@ taking the page orientation into account
|
|
272
280
|
- ~--column-gap=DIM~ :: The distance between columns of labels on a page
|
273
281
|
|
274
282
|
** Label Setup Options
|
275
|
-
These options determine the layout of individual labels within the page
|
276
|
-
than the page as a whole. Note that the dimensions of a single
|
277
|
-
not specified, but is implicitly determined by
|
278
|
-
|
279
|
-
|
280
|
-
|
283
|
+
These options determine the layout of individual labels within the page grid
|
284
|
+
rather than the page grid as a whole. Note that the dimensions of a single
|
285
|
+
whole label is not specified, but is implicitly determined by:
|
286
|
+
|
287
|
+
1. the page width and height,
|
288
|
+
2. the page margins
|
289
|
+
3. the number of rows and columns per page, and
|
290
|
+
4. the row and column gaps.
|
291
|
+
|
292
|
+
The remaining space on the page is divided into a grid of identically-sized
|
293
|
+
labels, which determines the size of each label.
|
281
294
|
|
282
295
|
*** Padding
|
283
296
|
Within each label, the following options allow you to set the margins on each
|
@@ -302,7 +315,7 @@ label, but the following options allow you to alter that.
|
|
302
315
|
label (default center)
|
303
316
|
|
304
317
|
*** Fonts and styling
|
305
|
-
=labrat= provides a few simple
|
318
|
+
=labrat= provides a few simple means for styling the label text. Note that all
|
306
319
|
of these apply to the whole label text: there is no provision yet for doing
|
307
320
|
in-line changes of font styles.
|
308
321
|
|
@@ -346,18 +359,18 @@ later pages always start on the first label position.
|
|
346
359
|
|
347
360
|
*** New line marker
|
348
361
|
You can embed a special text-sequence in the label text to indicate where a
|
349
|
-
line-break should occur. By default it is the sequence
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
362
|
+
line-break should occur. By default it is the sequence =∼∼=. This means that
|
363
|
+
=labrat= will translate all occurrences of =∼∼= in the text into a line-break,
|
364
|
+
even consecutive occurrences. There is no way to escape this in the text, so
|
365
|
+
if you want labels that use =∼∼= as part of the text, you are going to have
|
366
|
+
difficulty printing. But you can change the marker to something else with
|
367
|
+
~--nlsep~. This is especially helpful when you are using the command-line to
|
368
|
+
supply the label text since specifying line-breaks on a shell command can be
|
369
|
+
difficult. However note that this substitution takes place even when reading
|
370
|
+
label texts from a file or standard input.
|
358
371
|
|
359
372
|
- ~-n~, ~--nlsep=SEPARATOR~ :: Specify text to be translated into a line-break
|
360
|
-
(default '
|
373
|
+
(default ' =∼∼= ')
|
361
374
|
|
362
375
|
*** Label separator
|
363
376
|
The only way to print more than one label from the command-line is to indicate
|
@@ -449,7 +462,7 @@ disregarding comments.
|
|
449
462
|
|
450
463
|
**** Template exception
|
451
464
|
Notwithstanding all of the above, if the ~-T~ (~--template~) option is given
|
452
|
-
(see below at [[*
|
465
|
+
(see below at [[* Aids to testing label layouts]]), all label texts from the
|
453
466
|
command-line, an ~in-file~, or standard input are ignored and a template is
|
454
467
|
generated.
|
455
468
|
|
@@ -461,7 +474,7 @@ command from ~--view-command~ to view the generated PDF file instead.
|
|
461
474
|
|
462
475
|
- ~-V~, ~--[no-]view~ :: View rather than print
|
463
476
|
|
464
|
-
***
|
477
|
+
*** Printing and viewing shell commands
|
465
478
|
By default, =labrat= uses the shell command:
|
466
479
|
#+begin_example
|
467
480
|
lpr -P %p %o
|
@@ -502,8 +515,7 @@ setting the ~--delta-x~ or ~--delta-y~ values for your setup.
|
|
502
515
|
|
503
516
|
Normally, =labrat= does not print an outline for the labels, but if you are
|
504
517
|
testing things out on plain paper, it helps to know where =labrat= thinks the
|
505
|
-
boundaries of the labels are.
|
506
|
-
provide.
|
518
|
+
boundaries of the labels are. The ~--grid~ or ~-g~ options provide this.
|
507
519
|
|
508
520
|
- ~-g~, ~--[no-]grid~ :: Add grid lines to output
|
509
521
|
|
@@ -511,7 +523,7 @@ provide.
|
|
511
523
|
When trying to define a new label layout, it also helps to just see what a
|
512
524
|
single sheet of labels would look like. That is what the ~--template~ (or
|
513
525
|
~-T~) option gives you: it just prints an outline of where labels would be
|
514
|
-
printed but ignores any label text.
|
526
|
+
printed and numbers the labels, but it ignores any label text.
|
515
527
|
|
516
528
|
- ~-T~, ~--[no-]template~ :: Print a template of a page of labels and ignore
|
517
529
|
any content
|
@@ -519,7 +531,8 @@ printed but ignores any label text.
|
|
519
531
|
**** Verbose Reporting
|
520
532
|
Finally, =labrat= will print a lot of information about what it's doing with
|
521
533
|
the ~--verbose~ or ~-v~ option. The information is printed to the standard
|
522
|
-
error output stream.
|
534
|
+
error output stream. This is particularly helpful in determining how the
|
535
|
+
final configuration was constructed from the various config files.
|
523
536
|
|
524
537
|
- ~-v~, ~--[no-]verbose~ :: Run verbosely, that is, print out lots of
|
525
538
|
information about what =labrat= is doing as it processes the job.
|
@@ -527,7 +540,7 @@ error output stream.
|
|
527
540
|
** The Label Database and the label option
|
528
541
|
One of the nice things about =labrat= is that it comes with a database of
|
529
542
|
pre-defined label configurations for many standard labels, especially Avery
|
530
|
-
labels since they
|
543
|
+
labels since they were good enough to publish PDF templates for all their
|
531
544
|
products at [[https://www.avery.com/templates]].
|
532
545
|
|
533
546
|
*** Listing labels
|
@@ -583,7 +596,7 @@ avery8986:
|
|
583
596
|
label: avery8987
|
584
597
|
#+end_example
|
585
598
|
In other words, it defines the ~avery8986~ label with a nested ~--label~
|
586
|
-
option that simply
|
599
|
+
option that simply incorporates the ~avery8987~ entry settings.
|
587
600
|
|
588
601
|
*** Label database entries as configuration sets
|
589
602
|
This ability to use a label database definition as an alias for a whole set of
|
data/Rakefile
CHANGED
data/bin/labrat
CHANGED
data/labrat.gemspec
CHANGED
@@ -24,9 +24,9 @@ Gem::Specification.new do |spec|
|
|
24
24
|
For Emacs users, labrat includes elisp code for invoking labrat from within a
|
25
25
|
buffer, providing a quick way to print labels.
|
26
26
|
|
27
|
-
DESC
|
27
|
+
DESC
|
28
28
|
|
29
|
-
spec.homepage
|
29
|
+
spec.homepage = "http://github.com/ddoherty03/labrat"
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
31
31
|
|
32
32
|
spec.metadata["homepage_uri"] = spec.homepage
|
@@ -42,17 +42,9 @@ DESC
|
|
42
42
|
spec.executables = spec.files.grep(%r{\Abin/labrat}) { |f| File.basename(f) }
|
43
43
|
spec.require_paths = ["lib"]
|
44
44
|
spec.post_install_message = 'To install config and label database files, run labrat-install.'
|
45
|
-
spec.add_dependency "matrix"
|
46
|
-
spec.add_dependency "prawn", "~> 2.0"
|
47
45
|
spec.add_dependency "activesupport"
|
46
|
+
spec.add_dependency "fat_config", '>=0.4.2'
|
48
47
|
spec.add_dependency "fat_core"
|
49
|
-
|
50
|
-
spec.
|
51
|
-
spec.add_development_dependency 'rspec'
|
52
|
-
spec.add_development_dependency 'pry'
|
53
|
-
spec.add_development_dependency 'simplecov'
|
54
|
-
spec.add_development_dependency 'debug', '>= 1.0.0'
|
55
|
-
spec.add_development_dependency 'rubocop-performance'
|
56
|
-
spec.add_development_dependency 'rubocop-shopify'
|
57
|
-
spec.add_development_dependency 'rubocop-rspec'
|
48
|
+
spec.add_dependency "matrix"
|
49
|
+
spec.add_dependency "prawn", "~> 2.0"
|
58
50
|
end
|
@@ -1009,3 +1009,20 @@ avery88662:
|
|
1009
1009
|
|
1010
1010
|
avery95662:
|
1011
1011
|
label: avery18662
|
1012
|
+
|
1013
|
+
# Divider Tabs
|
1014
|
+
# 07708, 07712, 07714, 07720, 11110, 11113, 11121, 11122, 11160, 11178, 11185,
|
1015
|
+
# 11220, 11221, 11227, 11273, 11835, 11900, 11902, 11906, 11908, 11956, 11982,
|
1016
|
+
# 11988, 23280, 23281, 71109, 71900, 71906, 81310
|
1017
|
+
avery11109:
|
1018
|
+
page-width: 8.5in
|
1019
|
+
page-height: 11in
|
1020
|
+
rows: 20
|
1021
|
+
columns: 2
|
1022
|
+
top-page-margin: 13mm
|
1023
|
+
bottom-page-margin: 13mm
|
1024
|
+
left-page-margin: 70mm
|
1025
|
+
right-page-margin: 70mm
|
1026
|
+
row-gap: 0mm
|
1027
|
+
column-gap: 0mm
|
1028
|
+
landscape: false
|