labrat 1.1.0 → 1.2.0
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/Gemfile.lock +1 -1
- data/README.org +19 -19
- data/labrat.gemspec +1 -1
- data/lib/config_files/config.yml +1 -1
- data/lib/labrat/arg_parser.rb +3 -3
- data/lib/labrat/options.rb +2 -2
- data/lib/labrat/version.rb +1 -1
- data/lib/lisp/labrat.el +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33cfd23bc08f69e0f9147329ae77a91de45458ec613431c258608fc00a175e26
|
4
|
+
data.tar.gz: 92a47e9f6eb8e4f807591664ac1188a59856e000c5c0018bca901fb72ac08253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4e6e36bbc4d26531f5358f71f2e2ad43b10b67e692c9be1f7d5cd0a07f5a8ca9f02a714cd594e91bfe8703f84f68c37aa32f15765a861452a03ab6820675a1f
|
7
|
+
data.tar.gz: d43a0befaf67f7365d9aa7b049a555c4dacf75d2c7d5f0755047fd4adb828cb7c2781a0822d86b439ab35c34c1a9f4d7cf163545b9a1c028687dfb3c65bec360
|
data/Gemfile.lock
CHANGED
data/README.org
CHANGED
@@ -59,7 +59,7 @@ wonderful [[https://github.com/prawnpdf/prawn][Prawn gem]] to generate PDF files
|
|
59
59
|
=labrat= properly configured, printing a label is as simple as:
|
60
60
|
|
61
61
|
#+begin_example
|
62
|
-
$ labrat 'Income Taxes 2021
|
62
|
+
$ labrat 'Income Taxes 2021 ~~ Example Maker, Inc.'
|
63
63
|
#+end_example
|
64
64
|
|
65
65
|
And you will get a two-line file-folder label printed that looks like this:
|
@@ -85,14 +85,14 @@ without success, I decided to write my own. Hence labrat. With it---after
|
|
85
85
|
due configuration---printing a file folder label is as simple as:
|
86
86
|
|
87
87
|
#+begin_src sh
|
88
|
-
$ labrat 'First Line of Label
|
88
|
+
$ labrat 'First Line of Label ~~ And the Second Line'
|
89
89
|
#+end_src
|
90
90
|
|
91
91
|
Or, you can preview the label in your previewer of choice (mine is qpdfview)
|
92
92
|
by adding the -V flag:
|
93
93
|
|
94
94
|
#+begin_src sh
|
95
|
-
$ labrat -V 'First Line of Label
|
95
|
+
$ labrat -V 'First Line of Label ~~ And the Second Line'
|
96
96
|
#+end_src
|
97
97
|
|
98
98
|
Even better, I have included with =labrat= an elisp file (=labrat.el=) that
|
@@ -346,10 +346,10 @@ later pages always start on the first label position.
|
|
346
346
|
|
347
347
|
*** New line marker
|
348
348
|
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
|
-
that =labrat= will translate all occurrences of
|
349
|
+
line-break should occur. By default it is the sequence = ~~ =. This means
|
350
|
+
that =labrat= will translate all occurrences of = ~~ = in the text into a
|
351
351
|
line-break, even consecutive occurrences. There is no way to escape this in
|
352
|
-
the text, so if you want labels for that use '
|
352
|
+
the text, so if you want labels for that use ' ~~ ' as part of the text, you
|
353
353
|
are going to have difficulty printing a labels. But you can change the marker
|
354
354
|
to something else with ~--nlsep~. This is especially helpful when you are
|
355
355
|
using the command-line to supply the label text since specifying line-breaks
|
@@ -357,16 +357,16 @@ on a shell command can be difficult. However note that this substitution
|
|
357
357
|
takes place even when reading label texts from a file or standard input.
|
358
358
|
|
359
359
|
- ~-n~, ~--nlsep=SEPARATOR~ :: Specify text to be translated into a line-break
|
360
|
-
(default '
|
360
|
+
(default ' ~~ ')
|
361
361
|
|
362
362
|
*** Label separator
|
363
363
|
The only way to print more than one label from the command-line is to indicate
|
364
364
|
where one label ends and the next begins with a special marker in the
|
365
|
-
command-line arguments, by default the string '
|
365
|
+
command-line arguments, by default the string '@@'. The text used for this
|
366
366
|
can be customized with this option.
|
367
367
|
|
368
368
|
- ~--label-sep=SEPARATOR~ :: Specify text that indicates the start of a new
|
369
|
-
label (default '
|
369
|
+
label (default '@@')
|
370
370
|
|
371
371
|
*** Number of copies
|
372
372
|
This option causes =labrat= to generate multiple copies of each label with all
|
@@ -388,11 +388,11 @@ on the command-line. It combines all the non-option arguments and joins them
|
|
388
388
|
with a space between each argument. For example,
|
389
389
|
|
390
390
|
#+begin_example
|
391
|
-
$ labrat -c3 This is a 'single label' '
|
391
|
+
$ labrat -c3 This is a 'single label' ' ~~ composed of all this' text --font-style=italic
|
392
392
|
#+end_example
|
393
393
|
|
394
394
|
prints three copies of a single label in italics with two lines, breaking at
|
395
|
-
the '
|
395
|
+
the ' ~~ ' marker, resulting in something like this:
|
396
396
|
|
397
397
|
#+begin_example
|
398
398
|
This is a single label
|
@@ -401,12 +401,12 @@ composed of all this text
|
|
401
401
|
|
402
402
|
Note that when the label text is specified on the command-line, ~labrat~ just
|
403
403
|
prints a single label. The only ways to get multiple labels is by (1) marking
|
404
|
-
a separation between labels with the ~--label-sep~ marker ('
|
404
|
+
a separation between labels with the ~--label-sep~ marker ('@@' by default)
|
405
405
|
or (2) using the ~-c~ (~--copies~) argument to get multiple copies of the
|
406
406
|
label text. These options can be combined as well. For example,
|
407
407
|
|
408
408
|
#+begin_example
|
409
|
-
$ labrat -c3 This is the 'first label'
|
409
|
+
$ labrat -c3 This is the 'first label' @@ 'And the rest ~~ is the second' text --font-style=italic
|
410
410
|
#+end_example
|
411
411
|
|
412
412
|
will produce three copies of two separate labels:
|
@@ -572,7 +572,7 @@ $ labrat -T -V --label=avery8987
|
|
572
572
|
|
573
573
|
And if you want to see it with sample label text filled in, try the following:
|
574
574
|
#+begin_example
|
575
|
-
$ labrat -V -c30 --label=avery8987 'Four score and seven years ago
|
575
|
+
$ labrat -V -c30 --label=avery8987 'Four score and seven years ago ~~ Our fathers brought forth'
|
576
576
|
#+end_example
|
577
577
|
|
578
578
|
*** Nesting label definitions
|
@@ -608,7 +608,7 @@ badge:
|
|
608
608
|
|
609
609
|
With this, you can print a file folder label with:
|
610
610
|
#+begin_example
|
611
|
-
$ labrat --label=ff 'Four score and seven years ago
|
611
|
+
$ labrat --label=ff 'Four score and seven years ago ~~ Our fathers brought forth'
|
612
612
|
#+end_example
|
613
613
|
|
614
614
|
And, if you want this to be your default label type, you can add to your user-level
|
@@ -620,13 +620,13 @@ label:
|
|
620
620
|
|
621
621
|
Now you can print the label without the ~--label~ option on the command-line:
|
622
622
|
#+begin_example
|
623
|
-
$ labrat 'Four score and seven years ago
|
623
|
+
$ labrat 'Four score and seven years ago ~~ Our fathers brought forth'
|
624
624
|
#+end_example
|
625
625
|
|
626
626
|
If you want to print badges, you have to specify the ~--label~ option explicitly on
|
627
627
|
the command-line:
|
628
628
|
#+begin_example
|
629
|
-
$ labrat -V -c14 --label=badge 'Daniel E. Doherty
|
629
|
+
$ labrat -V -c14 --label=badge 'Daniel E. Doherty ~~ (Amateur Programmer)'
|
630
630
|
#+end_example
|
631
631
|
|
632
632
|
*** A Caution about option order
|
@@ -636,7 +636,7 @@ override earlier settings. For example, given the configuration above, where
|
|
636
636
|
~ff~ is your default label type, the following will not do what you expect:
|
637
637
|
|
638
638
|
#+begin_example
|
639
|
-
$ labrat --font-style=italic --label=ff 'Four score and seven years ago
|
639
|
+
$ labrat --font-style=italic --label=ff 'Four score and seven years ago ~~ Our fathers brought forth'
|
640
640
|
#+end_example
|
641
641
|
|
642
642
|
You expect the label to be printed in italic, but the ~--label=ff~ option in
|
@@ -647,7 +647,7 @@ namely ~--font-style=bold~ from the user-level label database.
|
|
647
647
|
To get this to work, you have to put the command-line setting after the
|
648
648
|
~--label=ff~ option in order for it to take effect:
|
649
649
|
#+begin_example
|
650
|
-
$ labrat --label=ff --font-style=italic 'Four score and seven years ago
|
650
|
+
$ labrat --label=ff --font-style=italic 'Four score and seven years ago ~~ Our fathers brought forth'
|
651
651
|
#+end_example
|
652
652
|
|
653
653
|
* Development
|
data/labrat.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
the wonderful Prawn gem to generate PDF files with label formatting in mind. With
|
16
16
|
labrat properly configured, printing a label is as simple as:
|
17
17
|
|
18
|
-
$ labrat 'Income Taxes 2021
|
18
|
+
$ labrat 'Income Taxes 2021 ~~ Example Maker, Inc.'
|
19
19
|
|
20
20
|
And you will get a two-line file-folder label with the text centered. It can
|
21
21
|
print on dymo label printer rolls or Avery sheet labels. It knows the layout of
|
data/lib/config_files/config.yml
CHANGED
@@ -93,7 +93,7 @@
|
|
93
93
|
# A string sequence that is interpreted as a line-break can be defined. Such
|
94
94
|
# a sequence is particularly helpful when you provide the label text on the
|
95
95
|
# command-line, though it will be applied to file-read label texts as well.
|
96
|
-
# nlsep: '
|
96
|
+
# nlsep: '~~'
|
97
97
|
|
98
98
|
# A string sequence that indicates the start of a new label. Such a sequence
|
99
99
|
# is particularly helpful when you provide the label text on the command-line,
|
data/lib/labrat/arg_parser.rb
CHANGED
@@ -48,7 +48,7 @@ module Labrat
|
|
48
48
|
parser.separator ""
|
49
49
|
parser.separator "Print or view (with -V) a label with the given <label-text>."
|
50
50
|
parser.separator "All non-option arguments are used for the label text with a special"
|
51
|
-
parser.separator "marker ('
|
51
|
+
parser.separator "marker ('~~' by default, see --nlsep) indicating a line-break."
|
52
52
|
parser.separator ""
|
53
53
|
parser.separator "Below, NUM indicates an integer, DIM, indicates a linear dimension,"
|
54
54
|
parser.separator "valid DIM units are: pt, mm, cm, dm, m, in, ft, yd."
|
@@ -361,11 +361,11 @@ module Labrat
|
|
361
361
|
|
362
362
|
# On a command-line, specifying where a line-break should occur is not
|
363
363
|
# convenient when shell interpretation and quoting rules are taken into
|
364
|
-
# account. This allows the user to use some distinctive marker ('
|
364
|
+
# account. This allows the user to use some distinctive marker ('~~' by
|
365
365
|
# default) to designate where a line break should occur.
|
366
366
|
def nl_sep_option
|
367
367
|
parser.on("-nSEP", "--nl-sep=SEPARATOR",
|
368
|
-
"Specify text to be translated into a line-break (default '
|
368
|
+
"Specify text to be translated into a line-break (default '~~')") do |nl|
|
369
369
|
options.nl_sep = nl
|
370
370
|
warn " ::nl-sep <- '#{nl}'::" if options.verbose
|
371
371
|
end
|
data/lib/labrat/options.rb
CHANGED
@@ -50,8 +50,8 @@ module Labrat
|
|
50
50
|
self.font_size = init[:font_size] || 12
|
51
51
|
# Input attributes
|
52
52
|
self.in_file = init[:in_file] || nil
|
53
|
-
self.nl_sep = init[:nl_sep] || '
|
54
|
-
self.label_sep = init[:label_sep] || '
|
53
|
+
self.nl_sep = init[:nl_sep] || '~~'
|
54
|
+
self.label_sep = init[:label_sep] || '@@'
|
55
55
|
self.copies = init[:copies] || 1
|
56
56
|
# Output attributes
|
57
57
|
self.printer = init[:printer] || ENV['LABRAT_PRINTER'] || ENV['PRINTER'] || 'dymo'
|
data/lib/labrat/version.rb
CHANGED
data/lib/lisp/labrat.el
CHANGED
@@ -22,7 +22,7 @@ e.g. ~/.rbenv/shims/labrat, for an rbenv ruby installation."
|
|
22
22
|
:type 'string
|
23
23
|
:group 'labrat)
|
24
24
|
|
25
|
-
(defcustom labrat-nl-sep "
|
25
|
+
(defcustom labrat-nl-sep "~~"
|
26
26
|
"String to mark newlines in label text.
|
27
27
|
|
28
28
|
If you change this, you need to make a corresponding change in your
|
@@ -30,7 +30,7 @@ labrat configuration at ~/.config/labrat/config.yml."
|
|
30
30
|
:type 'string
|
31
31
|
:group 'labrat)
|
32
32
|
|
33
|
-
(defcustom labrat-label-sep "
|
33
|
+
(defcustom labrat-label-sep "@@"
|
34
34
|
"String to mark the separation between labels on the labrat command-line.
|
35
35
|
|
36
36
|
If you change this, you need to make a corresponding change in your
|
@@ -88,7 +88,7 @@ returned"
|
|
88
88
|
This invokes the \"labrat -V\ <label>\" command with the
|
89
89
|
paragraph at or before point inserted in the <label> position,
|
90
90
|
but with each new-line replaced with the value of the variable
|
91
|
-
labrat-nl-sep, '
|
91
|
+
labrat-nl-sep, '~~' by default."
|
92
92
|
(interactive)
|
93
93
|
(call-process labrat-executable nil (get-buffer-create "*labrat*") nil
|
94
94
|
"-V" "-o ~/labrat.pdf""-V --out-file=~/labrat.pdf" (labrat/pars-in-region)))
|
@@ -99,7 +99,7 @@ labrat-nl-sep, '-->' by default."
|
|
99
99
|
This invokes the \"labrat -P <label>\" command with the paragraph
|
100
100
|
at or before point inserted in the <label> position, but with
|
101
101
|
each new-line replaced with the value of the variable
|
102
|
-
labrat-nl-sep, '
|
102
|
+
labrat-nl-sep, '~~' by default."
|
103
103
|
(interactive)
|
104
104
|
(call-process labrat-executable nil (buffer-name (get-buffer-create "*labrat*")) nil
|
105
105
|
"-o ~/labrat.pdf" (labrat/pars-in-region)))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: labrat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel E. Doherty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: matrix
|
@@ -184,7 +184,7 @@ description: |2+
|
|
184
184
|
the wonderful Prawn gem to generate PDF files with label formatting in mind. With
|
185
185
|
labrat properly configured, printing a label is as simple as:
|
186
186
|
|
187
|
-
$ labrat 'Income Taxes 2021
|
187
|
+
$ labrat 'Income Taxes 2021 ~~ Example Maker, Inc.'
|
188
188
|
|
189
189
|
And you will get a two-line file-folder label with the text centered. It can
|
190
190
|
print on dymo label printer rolls or Avery sheet labels. It knows the layout of
|
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
256
|
- !ruby/object:Gem::Version
|
257
257
|
version: '0'
|
258
258
|
requirements: []
|
259
|
-
rubygems_version: 3.4.
|
259
|
+
rubygems_version: 3.4.2
|
260
260
|
signing_key:
|
261
261
|
specification_version: 4
|
262
262
|
summary: Command-line and Emacs label print software.
|