labrat 1.4.0 → 1.4.1
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/CHANGELOG.md +20 -20
- data/CHANGELOG.org +2 -2
- data/Gemfile.lock +2 -2
- data/README.md +117 -119
- data/README.org +3 -3
- data/lib/config_files/config.yml +1 -1
- data/lib/labrat/arg_parser.rb +1 -1
- data/lib/labrat/read_files.rb +5 -5
- data/lib/labrat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d5dccd86fad67c08b3e39f77bc6fe062142f869343ab3e4947d611e06a7943e
|
|
4
|
+
data.tar.gz: f3937d493d2f9ec504874e96c1f0fb6a882b3ffb1f9a57f095005657936821c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 630dcc80e27810cf4865673f520506548bf75dbbc60b7ddbf3193860ab51d1fd4fff0396e1d948cce318f80bfa70c40df12012eff0f773f5a5856fded1fc8f5d
|
|
7
|
+
data.tar.gz: 4ab61f63efb8875ff8ca5591bc5ebf695f865bc0ef38abe0018a1b9cec051877d2d7f10d8f7e23eb47102aa0c31dbc5ce9214ee5337c16ed06ad7655340ca2c1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
- [Version 1.4.
|
|
2
|
-
- [Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>](#
|
|
3
|
-
- [Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>](#
|
|
4
|
-
- [Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>](#
|
|
5
|
-
- [Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>](#
|
|
6
|
-
- [Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>](#
|
|
7
|
-
- [Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>](#
|
|
8
|
-
- [Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>](#
|
|
9
|
-
- [Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>](#
|
|
1
|
+
- [Version 1.4.1 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-28 Sun]</span></span>](#orgd8249d2)
|
|
2
|
+
- [Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>](#org107aabd)
|
|
3
|
+
- [Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>](#org99dae2d)
|
|
4
|
+
- [Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>](#org9958d5d)
|
|
5
|
+
- [Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>](#org69020a9)
|
|
6
|
+
- [Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>](#org8b0bc88)
|
|
7
|
+
- [Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>](#orgccb7d5f)
|
|
8
|
+
- [Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>](#org1ddf800)
|
|
9
|
+
- [Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>](#org3b34d02)
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
<a id="
|
|
12
|
+
<a id="orgd8249d2"></a>
|
|
13
13
|
|
|
14
|
-
# Version 1.4.
|
|
14
|
+
# Version 1.4.1 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-28 Sun]</span></span>
|
|
15
15
|
|
|
16
16
|
- Added a `vim` plugin to allow printing or viewing labels from within a vim buffer as was possible in Emacs with `labrat.el`.
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
<a id="
|
|
19
|
+
<a id="org107aabd"></a>
|
|
20
20
|
|
|
21
21
|
# Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>
|
|
22
22
|
|
|
@@ -24,37 +24,37 @@
|
|
|
24
24
|
- Output file can still be overridden with the `-o` or `--out-file` option
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
<a id="
|
|
27
|
+
<a id="org99dae2d"></a>
|
|
28
28
|
|
|
29
29
|
# Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>
|
|
30
30
|
|
|
31
31
|
- No user-visible changes
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
<a id="
|
|
34
|
+
<a id="org9958d5d"></a>
|
|
35
35
|
|
|
36
36
|
# Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>
|
|
37
37
|
|
|
38
38
|
- Used `fat_config` gem to read config files
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
<a id="
|
|
41
|
+
<a id="org69020a9"></a>
|
|
42
42
|
|
|
43
43
|
# Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>
|
|
44
44
|
|
|
45
45
|
- Fixed `labrat.el` view command
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
<a id="
|
|
48
|
+
<a id="org8b0bc88"></a>
|
|
49
49
|
|
|
50
50
|
# Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>
|
|
51
51
|
|
|
52
|
-
- Changed `
|
|
52
|
+
- Changed `nl-sep` to '~~'
|
|
53
53
|
- Changed `label-sep` to '@@'
|
|
54
54
|
- Minor bug fixes
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
<a id="
|
|
57
|
+
<a id="orgccb7d5f"></a>
|
|
58
58
|
|
|
59
59
|
# Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>
|
|
60
60
|
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
- Added label name to template output
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
<a id="
|
|
66
|
+
<a id="org1ddf800"></a>
|
|
67
67
|
|
|
68
68
|
# Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>
|
|
69
69
|
|
|
70
70
|
- Nothing important
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
<a id="
|
|
73
|
+
<a id="org3b34d02"></a>
|
|
74
74
|
|
|
75
75
|
# Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>
|
|
76
76
|
|
data/CHANGELOG.org
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
* Version 1.4.
|
|
2
|
+
* Version 1.4.1 [2025-12-28 Sun]
|
|
3
3
|
- Added a ~vim~ plugin to allow printing or viewing labels from within a vim
|
|
4
4
|
buffer as was possible in Emacs with ~labrat.el~.
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
- Fixed ~labrat.el~ view command
|
|
20
20
|
|
|
21
21
|
* Version 1.2.0 [2023-01-19 Thu]
|
|
22
|
-
- Changed =
|
|
22
|
+
- Changed =nl-sep= to '~~'
|
|
23
23
|
- Changed =label-sep= to '@@'
|
|
24
24
|
- Minor bug fixes
|
|
25
25
|
|
data/Gemfile.lock
CHANGED
|
@@ -12,7 +12,7 @@ GIT
|
|
|
12
12
|
PATH
|
|
13
13
|
remote: .
|
|
14
14
|
specs:
|
|
15
|
-
labrat (1.4.
|
|
15
|
+
labrat (1.4.1)
|
|
16
16
|
activesupport
|
|
17
17
|
fat_config (>= 0.4.2)
|
|
18
18
|
prawn (~> 2.0)
|
|
@@ -207,7 +207,7 @@ CHECKSUMS
|
|
|
207
207
|
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
|
|
208
208
|
irb (1.16.0) sha256=2abe56c9ac947cdcb2f150572904ba798c1e93c890c256f8429981a7675b0806
|
|
209
209
|
json (2.18.0) sha256=b10506aee4183f5cf49e0efc48073d7b75843ce3782c68dbeb763351c08fd505
|
|
210
|
-
labrat (1.4.
|
|
210
|
+
labrat (1.4.1)
|
|
211
211
|
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
212
212
|
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
213
213
|
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
data/README.md
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
- [Introduction](#
|
|
2
|
-
- [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- [Setting options](#
|
|
12
|
-
- [Dimensions and other values in options](#
|
|
13
|
-
- [Page Setup Options](#
|
|
14
|
-
- [Orientation](#
|
|
15
|
-
- [Page Dimensions](#
|
|
16
|
-
- [Page Grid](#
|
|
17
|
-
- [Label Setup Options](#
|
|
18
|
-
- [Padding](#
|
|
19
|
-
- [Alignment](#
|
|
20
|
-
- [Fonts and styling](#
|
|
21
|
-
- [Position Adjustment](#
|
|
22
|
-
- [Job Processing Options](#
|
|
23
|
-
- [Starting label](#
|
|
24
|
-
- [New line marker](#
|
|
25
|
-
- [Label separator](#
|
|
26
|
-
- [Number of copies](#
|
|
27
|
-
- [Input and output files](#
|
|
28
|
-
- [Printing or viewing](#
|
|
29
|
-
- [Printing and viewing shell commands](#
|
|
30
|
-
- [Aids to testing label layouts](#
|
|
31
|
-
- [The Label Database and the label option](#
|
|
32
|
-
- [Listing labels](#
|
|
33
|
-
- [System label database](#
|
|
34
|
-
- [Trying out a label definition](#
|
|
35
|
-
- [Nesting label definitions](#
|
|
36
|
-
- [Label database entries as configuration sets](#
|
|
37
|
-
- [A Caution about option order](#
|
|
38
|
-
- [Development](#
|
|
39
|
-
- [Contributing](#
|
|
1
|
+
- [Introduction](#org73b5965)
|
|
2
|
+
- [Motivation](#orgbc2f216)
|
|
3
|
+
- [Quick Start](#orgc6ae3c0)
|
|
4
|
+
- [Installation](#orgba29739)
|
|
5
|
+
- [Editor Integration](#org5254d08)
|
|
6
|
+
- [Emacs](#orgc20ef04)
|
|
7
|
+
- [Vim](#org56f5d71)
|
|
8
|
+
- [Installing the Libraries](#org38d07ba)
|
|
9
|
+
- [A Tip on Buying File Folder Labels](#orge05db22)
|
|
10
|
+
- [Usage](#orgfe955c0)
|
|
11
|
+
- [Setting options](#orgaaf8f48)
|
|
12
|
+
- [Dimensions and other values in options](#org73003a4)
|
|
13
|
+
- [Page Setup Options](#orgc698d7b)
|
|
14
|
+
- [Orientation](#org673748d)
|
|
15
|
+
- [Page Dimensions](#orga97a775)
|
|
16
|
+
- [Page Grid](#orge513fa5)
|
|
17
|
+
- [Label Setup Options](#orgb0d154a)
|
|
18
|
+
- [Padding](#org7405c33)
|
|
19
|
+
- [Alignment](#org2181c47)
|
|
20
|
+
- [Fonts and styling](#org34b3ec2)
|
|
21
|
+
- [Position Adjustment](#org3b0bd36)
|
|
22
|
+
- [Job Processing Options](#org687b5fe)
|
|
23
|
+
- [Starting label](#org9f88ae2)
|
|
24
|
+
- [New line marker](#org038b8d4)
|
|
25
|
+
- [Label separator](#orgabdfba3)
|
|
26
|
+
- [Number of copies](#org03365b1)
|
|
27
|
+
- [Input and output files](#orgab3df6b)
|
|
28
|
+
- [Printing or viewing](#orgc737bdb)
|
|
29
|
+
- [Printing and viewing shell commands](#org5fbf44a)
|
|
30
|
+
- [Aids to testing label layouts](#org5383ea7)
|
|
31
|
+
- [The Label Database and the label option](#org43755ad)
|
|
32
|
+
- [Listing labels](#org47479ac)
|
|
33
|
+
- [System label database](#orga53002b)
|
|
34
|
+
- [Trying out a label definition](#org1ee27db)
|
|
35
|
+
- [Nesting label definitions](#org3e9c72c)
|
|
36
|
+
- [Label database entries as configuration sets](#org9db78c7)
|
|
37
|
+
- [A Caution about option order](#orgba4a7ec)
|
|
38
|
+
- [Development](#org480b590)
|
|
39
|
+
- [Contributing](#orgf644906)
|
|
40
40
|
|
|
41
41
|
[](https://github.com/ddoherty03/labrat/actions/workflows/main.yml)
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
<a id="
|
|
44
|
+
<a id="org73b5965"></a>
|
|
45
45
|
|
|
46
46
|
# Introduction
|
|
47
47
|
|
|
@@ -56,69 +56,75 @@ Easy-to-print labels can make the process of creating file folders trivial, but
|
|
|
56
56
|
Buy your copy today while supplies last!
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
<a id="
|
|
59
|
+
<a id="orgbc2f216"></a>
|
|
60
60
|
|
|
61
|
-
#
|
|
61
|
+
# Motivation
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
I need to print labels. And in my case, mostly I need file folder labels. I typically want to print to a Dymo LabelWriter, of which I own several variants. The problem is that I work almost entirely in Linux, but the simple task of printing a file folder label has required opening a GUI application, such as the very fine [glabels](https://help.gnome.org/users/glabels/stable/), or worse, switching to a machine running Windows or to a Mac to run Dymo's proprietary GUI. The Dymo GUI is particularly irksome because it takes a long time to start up and demands that you register every time you open it.
|
|
64
64
|
|
|
65
|
-
```
|
|
66
|
-
$ labrat 'Income Taxes 2021 ~~ Example Maker, Inc.'
|
|
67
|
-
```
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
<a id="orgc6ae3c0"></a>
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Note that an outline was added to make the size of the label apparent and is not actually printed with the label by default.
|
|
68
|
+
# Quick Start
|
|
74
69
|
|
|
70
|
+
That's too much ceremony for generating simple labels. I wanted a way to print a file label from the command line, or even better, from within my editor, Emacs. After giving up looking for such a thing without success, I decided to write my own. Hence labrat. With it—after due configuration—printing a file folder label is as simple as:
|
|
75
71
|
|
|
76
|
-
|
|
72
|
+
```sh
|
|
73
|
+
$ labrat 'First Line of Label ~~ And the Second Line'
|
|
74
|
+
```
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
Or, you can preview the label in your previewer of choice (mine is qpdfview) by adding the -V flag:
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
```sh
|
|
79
|
+
$ labrat -V 'First Line of Label ~~ And the Second Line'
|
|
80
|
+
```
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
<a id="
|
|
83
|
+
<a id="orgba29739"></a>
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
# Installation
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
Since `labrat` is distributed as a Ruby gem, you have to have a ruby installation. Look [here](https://www.ruby-lang.org/en/documentation/installation/) for ruby installation instructions. You can then install `labrat` with:
|
|
88
88
|
|
|
89
89
|
```sh
|
|
90
|
-
$
|
|
90
|
+
$ gem install labrat
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
After installation, you should install the user and system (if you have sudo privileges) configuration files with:
|
|
94
94
|
|
|
95
95
|
```sh
|
|
96
|
-
$ labrat
|
|
96
|
+
$ labrat-install
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
This will, assuming you have sudo privileges, install an annotated system-wide config file in `/etc/xdg/labrat/config.yml` and a system-wide label database in `/etc/xdg/labrat/labeldb.yml`.
|
|
100
|
+
|
|
101
|
+
It will also install an annotated sample user config file in `~/.config/labrat/labrat.yml` and a sample user-level label database in `~/.config/labrat/labeldb.yml`.
|
|
102
|
+
|
|
103
|
+
If you invoke `labrat-install` multiple times, it will refuse to overwrite any existing config or database files that you may have already installed. If you want to re-install them you have to remove the existing files or move them out of the way.
|
|
104
|
+
|
|
99
105
|
|
|
100
|
-
<a id="
|
|
106
|
+
<a id="org5254d08"></a>
|
|
101
107
|
|
|
102
|
-
|
|
108
|
+
# Editor Integration
|
|
103
109
|
|
|
104
110
|
|
|
105
|
-
<a id="
|
|
111
|
+
<a id="orgc20ef04"></a>
|
|
106
112
|
|
|
107
|
-
|
|
113
|
+
## Emacs
|
|
108
114
|
|
|
109
|
-
|
|
115
|
+
Included with `labrat` is an elisp file (`labrat.el`) that will invoke `labrat` to form a label with the text of the paragraph at or before point. So within Emacs, you can bind keys to the commands, `labrat-print` and `labrat-view` to print or view the current or prior paragraph as your default label. Thus, in Emacs, I have `C-z C-l C-l` bound to `labrat-print` and `C-z C-l C-v` to `labrat-view`, and I can type a label in any buffer and get it generated with very little ceremony.
|
|
110
116
|
|
|
111
117
|
|
|
112
|
-
<a id="
|
|
118
|
+
<a id="org56f5d71"></a>
|
|
113
119
|
|
|
114
|
-
|
|
120
|
+
## Vim
|
|
115
121
|
|
|
116
122
|
There is also a vim plugin that you can copy to you `~.vim/plugins/labrat.vim` directory to invoke `labrat` from within `vim`. Suggested keybindings are included for copying to `~/.vim/after/plugin/labrat.vim` that bind `<leader>lp` and `<leader>lv` to invoke `labrat` in normal and visual modes.
|
|
117
123
|
|
|
118
124
|
|
|
119
|
-
<a id="
|
|
125
|
+
<a id="org38d07ba"></a>
|
|
120
126
|
|
|
121
|
-
|
|
127
|
+
## Installing the Libraries
|
|
122
128
|
|
|
123
129
|
After running `labrat-install` both the emacs and vim libraries will be copied to `~/.config/labrat`. It's up to you to copy them from there to you Emacs load-path or vim `plugin` and `after/plugin` directories respectively.
|
|
124
130
|
|
|
@@ -144,9 +150,9 @@ $ ln -s ~/.config/labrat/vim/after/plugin/labrat.vim labrat.vim
|
|
|
144
150
|
```
|
|
145
151
|
|
|
146
152
|
|
|
147
|
-
<a id="
|
|
153
|
+
<a id="orge05db22"></a>
|
|
148
154
|
|
|
149
|
-
|
|
155
|
+
# A Tip on Buying File Folder Labels
|
|
150
156
|
|
|
151
157
|
As mentioned, one of my main motivations for writing `labrat` was the need to easily create file-folder labels. I got into creating files after reading *Getting Things Done* by David Allen. One of his recommendations for keeping organized is having a filing system so that documents can be easily archived and retrieved.
|
|
152
158
|
|
|
@@ -157,32 +163,24 @@ After looking for alternative printers, I found the solution, not in a new print
|
|
|
157
163
|
Thermal labels may be fine for ephemeral applications like name tags or shipping labels, but are terrible for long-term applications like file folders, marking cables, marking electrical breakers, or any other number of applications where long-term readability is essential.
|
|
158
164
|
|
|
159
165
|
|
|
160
|
-
<a id="
|
|
166
|
+
<a id="orgfe955c0"></a>
|
|
161
167
|
|
|
162
|
-
|
|
168
|
+
# Usage
|
|
163
169
|
|
|
164
|
-
|
|
170
|
+
`labrat` is a linux command-line program for quickly printing labels. It uses the [Prawn gem](https://github.com/prawnpdf/prawn) to generate PDF files with label formatting in mind. With `labrat` properly configured, printing a label is as simple as:
|
|
165
171
|
|
|
166
|
-
```sh
|
|
167
|
-
$ gem install labrat
|
|
168
172
|
```
|
|
169
|
-
|
|
170
|
-
After installation, you should install the user and system (if you have sudo privileges) configuration files with:
|
|
171
|
-
|
|
172
|
-
```sh
|
|
173
|
-
$ labrat-install
|
|
173
|
+
$ labrat 'Income Taxes 2021 ~~ Example Maker, Inc.'
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
It will also install an annotated sample user config file in `~/.config/labrat/labrat.yml` and a sample user-level label database in `~/.config/labrat/labeldb.yml`.
|
|
176
|
+
And you will get a two-line file-folder label printed that looks like this:
|
|
179
177
|
|
|
180
|
-
|
|
178
|
+

|
|
181
179
|
|
|
182
|
-
|
|
180
|
+
Note that an outline was added to make the size of the label apparent and is not actually printed with the label by default.
|
|
183
181
|
|
|
184
182
|
|
|
185
|
-
<a id="
|
|
183
|
+
<a id="orgaaf8f48"></a>
|
|
186
184
|
|
|
187
185
|
## Setting options
|
|
188
186
|
|
|
@@ -195,7 +193,7 @@ Labrat reads options from the following locations, with the locations listed fro
|
|
|
195
193
|
3. Finally, it reads options from the command-line, where, of course, the leading hyphens are mandatory.
|
|
196
194
|
|
|
197
195
|
|
|
198
|
-
<a id="
|
|
196
|
+
<a id="org73003a4"></a>
|
|
199
197
|
|
|
200
198
|
## Dimensions and other values in options
|
|
201
199
|
|
|
@@ -212,14 +210,14 @@ Many of the options deal with specifying some sort of distance. Those are design
|
|
|
212
210
|
Most other options are strings, which need to be quoted on the command-line if they contain any spaces or other characters special to your shell. In the configuration files, string values need not be quoted.
|
|
213
211
|
|
|
214
212
|
|
|
215
|
-
<a id="
|
|
213
|
+
<a id="orgc698d7b"></a>
|
|
216
214
|
|
|
217
215
|
## Page Setup Options
|
|
218
216
|
|
|
219
|
-
`Labrat` can handle multi-label pages such as Avery-style label sheets. These options deal with the page-level dimensions of the, potentially, multi-label page. By contrast, the dimensions of individual labels are dealt with by the label setup options described in the [next](#
|
|
217
|
+
`Labrat` can handle multi-label pages such as Avery-style label sheets. These options deal with the page-level dimensions of the, potentially, multi-label page. By contrast, the dimensions of individual labels are dealt with by the label setup options described in the [next](#orgb0d154a) section.
|
|
220
218
|
|
|
221
219
|
|
|
222
|
-
<a id="
|
|
220
|
+
<a id="org673748d"></a>
|
|
223
221
|
|
|
224
222
|
### Orientation
|
|
225
223
|
|
|
@@ -227,7 +225,7 @@ Most other options are strings, which need to be quoted on the command-line if t
|
|
|
227
225
|
- **`-P`, `--[no-]portrait`:** This is simply a convenience switch meaning `--no-landscape` and is the default.
|
|
228
226
|
|
|
229
227
|
|
|
230
|
-
<a id="
|
|
228
|
+
<a id="orga97a775"></a>
|
|
231
229
|
|
|
232
230
|
### Page Dimensions
|
|
233
231
|
|
|
@@ -246,7 +244,7 @@ With that in mind, specifying the page dimensions is just a matter of getting ou
|
|
|
246
244
|
- **`--page-margin=DIM`:** Distance from all sides of page (in portrait) to the print area; short for `--top-page-margin`, `--bottom-page-margin`, `--left-page-margin` and `--right-page-margin`
|
|
247
245
|
|
|
248
246
|
|
|
249
|
-
<a id="
|
|
247
|
+
<a id="orge513fa5"></a>
|
|
250
248
|
|
|
251
249
|
### Page Grid
|
|
252
250
|
|
|
@@ -258,7 +256,7 @@ By default, `labrat` considers a page of labels to contain only one row and one
|
|
|
258
256
|
- **`--column-gap=DIM`:** The distance between columns of labels on a page
|
|
259
257
|
|
|
260
258
|
|
|
261
|
-
<a id="
|
|
259
|
+
<a id="orgb0d154a"></a>
|
|
262
260
|
|
|
263
261
|
## Label Setup Options
|
|
264
262
|
|
|
@@ -272,7 +270,7 @@ These options determine the layout of individual labels within the page grid rat
|
|
|
272
270
|
The remaining space on the page is divided into a grid of identically-sized labels, which determines the size of each label.
|
|
273
271
|
|
|
274
272
|
|
|
275
|
-
<a id="
|
|
273
|
+
<a id="org7405c33"></a>
|
|
276
274
|
|
|
277
275
|
### Padding
|
|
278
276
|
|
|
@@ -287,7 +285,7 @@ Within each label, the following options allow you to set the margins on each si
|
|
|
287
285
|
- **`--pad=DIM`:** Short for `--top-pad=DIM`, `--bottom-pad=DIM`, `--left-pad=DIM` and `--right-pad=DIM`
|
|
288
286
|
|
|
289
287
|
|
|
290
|
-
<a id="
|
|
288
|
+
<a id="org2181c47"></a>
|
|
291
289
|
|
|
292
290
|
### Alignment
|
|
293
291
|
|
|
@@ -297,7 +295,7 @@ By default the label text is centered horizontally and vertically within the lab
|
|
|
297
295
|
- **`--v-align=[top|center|bottom]`:** Vertical alignment of text within the label (default center)
|
|
298
296
|
|
|
299
297
|
|
|
300
|
-
<a id="
|
|
298
|
+
<a id="org34b3ec2"></a>
|
|
301
299
|
|
|
302
300
|
### Fonts and styling
|
|
303
301
|
|
|
@@ -308,7 +306,7 @@ By default the label text is centered horizontally and vertically within the lab
|
|
|
308
306
|
- **`--font-style=[normal|bold|italic|bold-italic]`:** Style of font to use for text (default normal)
|
|
309
307
|
|
|
310
308
|
|
|
311
|
-
<a id="
|
|
309
|
+
<a id="org3b0bd36"></a>
|
|
312
310
|
|
|
313
311
|
### Position Adjustment
|
|
314
312
|
|
|
@@ -318,14 +316,14 @@ Despite our best efforts, the vagaries of printer hardware, print drivers, and c
|
|
|
318
316
|
- **`-y, --delta-y=DIM`:** Up-down adjustment (positive moves up, negative down) of label text within the label print area.
|
|
319
317
|
|
|
320
318
|
|
|
321
|
-
<a id="
|
|
319
|
+
<a id="org687b5fe"></a>
|
|
322
320
|
|
|
323
321
|
## Job Processing Options
|
|
324
322
|
|
|
325
323
|
The following options control the processing of labels by `labrat`.
|
|
326
324
|
|
|
327
325
|
|
|
328
|
-
<a id="
|
|
326
|
+
<a id="org9f88ae2"></a>
|
|
329
327
|
|
|
330
328
|
### Starting label
|
|
331
329
|
|
|
@@ -336,16 +334,16 @@ When printing onto a multi-label page, some of the labels may have already been
|
|
|
336
334
|
This only affects the placement of the first label on the first page. Any later pages always start on the first label position.
|
|
337
335
|
|
|
338
336
|
|
|
339
|
-
<a id="
|
|
337
|
+
<a id="org038b8d4"></a>
|
|
340
338
|
|
|
341
339
|
### New line marker
|
|
342
340
|
|
|
343
|
-
You can embed a special text-sequence in the label text to indicate where a line-break should occur. By default it is the sequence `∼∼`. This means that `labrat` will translate all occurrences of `∼∼` in the text into a line-break, even consecutive occurrences. There is no way to escape this in the text, so if you want labels that use `∼∼` as part of the text, you are going to have difficulty printing. But you can change the marker to something else with `--
|
|
341
|
+
You can embed a special text-sequence in the label text to indicate where a line-break should occur. By default it is the sequence `∼∼`. This means that `labrat` will translate all occurrences of `∼∼` in the text into a line-break, even consecutive occurrences. There is no way to escape this in the text, so if you want labels that use `∼∼` as part of the text, you are going to have difficulty printing. But you can change the marker to something else with `--nl-sep`. This is especially helpful when you are using the command-line to supply the label text since specifying line-breaks on a shell command can be difficult. However note that this substitution takes place even when reading label texts from a file or standard input.
|
|
344
342
|
|
|
345
|
-
- **`-n`, `--
|
|
343
|
+
- **`-n`, `--nl-sep=SEPARATOR`:** Specify text to be translated into a line-break (default ' `∼∼` ')
|
|
346
344
|
|
|
347
345
|
|
|
348
|
-
<a id="
|
|
346
|
+
<a id="orgabdfba3"></a>
|
|
349
347
|
|
|
350
348
|
### Label separator
|
|
351
349
|
|
|
@@ -354,7 +352,7 @@ The only way to print more than one label from the command-line is to indicate w
|
|
|
354
352
|
- **`--label-sep=SEPARATOR`:** Specify text that indicates the start of a new label (default '@@')
|
|
355
353
|
|
|
356
354
|
|
|
357
|
-
<a id="
|
|
355
|
+
<a id="org03365b1"></a>
|
|
358
356
|
|
|
359
357
|
### Number of copies
|
|
360
358
|
|
|
@@ -363,7 +361,7 @@ This option causes `labrat` to generate multiple copies of each label with all t
|
|
|
363
361
|
- **`-c NUM`, `--copies=NUM`:** Number of copies of each label to generate.
|
|
364
362
|
|
|
365
363
|
|
|
366
|
-
<a id="
|
|
364
|
+
<a id="orgab3df6b"></a>
|
|
367
365
|
|
|
368
366
|
### Input and output files
|
|
369
367
|
|
|
@@ -421,7 +419,7 @@ This option causes `labrat` to generate multiple copies of each label with all t
|
|
|
421
419
|
|
|
422
420
|
Rather than get the text from the non-option arguments on the command line, you can use the `--in-file` option to specify that label texts are to be read from the given file instead.
|
|
423
421
|
|
|
424
|
-
Each paragraph in the file constitutes a separate label. Line breaks within the paragraphs are respected, though the `--
|
|
422
|
+
Each paragraph in the file constitutes a separate label. Line breaks within the paragraphs are respected, though the `--nl-sep` marker is still replaced with additional line breaks. Any line starting with a `#` character is considered a comment and is not included in the text of any label.
|
|
425
423
|
|
|
426
424
|
- **`-f`, `--in-file=FILENAME`:** Read labels from given file instead of command-line
|
|
427
425
|
|
|
@@ -431,10 +429,10 @@ This option causes `labrat` to generate multiple copies of each label with all t
|
|
|
431
429
|
|
|
432
430
|
5. Template exception
|
|
433
431
|
|
|
434
|
-
Notwithstanding all of the above, if the `-T` (`--template`) option is given (see below at [
|
|
432
|
+
Notwithstanding all of the above, if the `-T` (`--template`) option is given (see below at [7.5.8](#org5383ea7)), all label texts from the command-line, an `in-file`, or standard input are ignored and a template is generated.
|
|
435
433
|
|
|
436
434
|
|
|
437
|
-
<a id="
|
|
435
|
+
<a id="orgc737bdb"></a>
|
|
438
436
|
|
|
439
437
|
### Printing or viewing
|
|
440
438
|
|
|
@@ -443,7 +441,7 @@ By default, `labrat` prints the generated output file to the printer named with
|
|
|
443
441
|
- **`-V`, `--[no-]view`:** View rather than print
|
|
444
442
|
|
|
445
443
|
|
|
446
|
-
<a id="
|
|
444
|
+
<a id="org5fbf44a"></a>
|
|
447
445
|
|
|
448
446
|
### Printing and viewing shell commands
|
|
449
447
|
|
|
@@ -469,7 +467,7 @@ to launch the previewer when the `--view` or `-V` options are given. It also '%o
|
|
|
469
467
|
- **`-:`, `--view-command=VIEWCMD`:** Command to use for viewing with %o for label file name (the \`:\` is meant to remind you of a pair of eyes looking at the purdy label)
|
|
470
468
|
|
|
471
469
|
|
|
472
|
-
<a id="
|
|
470
|
+
<a id="org5383ea7"></a>
|
|
473
471
|
|
|
474
472
|
### Aids to testing label layouts
|
|
475
473
|
|
|
@@ -494,14 +492,14 @@ to launch the previewer when the `--view` or `-V` options are given. It also '%o
|
|
|
494
492
|
- **`-v`, `--[no-]verbose`:** Run verbosely, that is, print out lots of information about what `labrat` is doing as it processes the job.
|
|
495
493
|
|
|
496
494
|
|
|
497
|
-
<a id="
|
|
495
|
+
<a id="org43755ad"></a>
|
|
498
496
|
|
|
499
497
|
## The Label Database and the label option
|
|
500
498
|
|
|
501
499
|
One of the nice things about `labrat` is that it comes with a database of pre-defined label configurations for many standard labels, especially Avery labels since they were good enough to publish PDF templates for all their products at <https://www.avery.com/templates>.
|
|
502
500
|
|
|
503
501
|
|
|
504
|
-
<a id="
|
|
502
|
+
<a id="org47479ac"></a>
|
|
505
503
|
|
|
506
504
|
### Listing labels
|
|
507
505
|
|
|
@@ -514,7 +512,7 @@ $ labrat --list-labels
|
|
|
514
512
|
Any users who create useful label definitions can propose them for inclusion with `labrat's` distributed label database by filing a pull request at this git repository.
|
|
515
513
|
|
|
516
514
|
|
|
517
|
-
<a id="
|
|
515
|
+
<a id="orga53002b"></a>
|
|
518
516
|
|
|
519
517
|
### System label database
|
|
520
518
|
|
|
@@ -538,7 +536,7 @@ avery8987:
|
|
|
538
536
|
Note that it restricts itself to page-level settings. It would be inappropriate to, for example, include something like `font-style` in a system-wide label definition, though such things can be useful in a user's private label configuration.
|
|
539
537
|
|
|
540
538
|
|
|
541
|
-
<a id="
|
|
539
|
+
<a id="org1ee27db"></a>
|
|
542
540
|
|
|
543
541
|
### Trying out a label definition
|
|
544
542
|
|
|
@@ -555,7 +553,7 @@ $ labrat -V -c30 --label=avery8987 'Four score and seven years ago ~~ Our father
|
|
|
555
553
|
```
|
|
556
554
|
|
|
557
555
|
|
|
558
|
-
<a id="
|
|
556
|
+
<a id="org3e9c72c"></a>
|
|
559
557
|
|
|
560
558
|
### Nesting label definitions
|
|
561
559
|
|
|
@@ -569,7 +567,7 @@ avery8986:
|
|
|
569
567
|
In other words, it defines the `avery8986` label with a nested `--label` option that simply incorporates the `avery8987` entry settings.
|
|
570
568
|
|
|
571
569
|
|
|
572
|
-
<a id="
|
|
570
|
+
<a id="org9db78c7"></a>
|
|
573
571
|
|
|
574
572
|
### Label database entries as configuration sets
|
|
575
573
|
|
|
@@ -615,7 +613,7 @@ $ labrat -V -c14 --label=badge 'Daniel E. Doherty ~~ (Amateur Programmer)'
|
|
|
615
613
|
```
|
|
616
614
|
|
|
617
615
|
|
|
618
|
-
<a id="
|
|
616
|
+
<a id="orgba4a7ec"></a>
|
|
619
617
|
|
|
620
618
|
### A Caution about option order
|
|
621
619
|
|
|
@@ -634,7 +632,7 @@ $ labrat --label=ff --font-style=italic 'Four score and seven years ago ~~ Our f
|
|
|
634
632
|
```
|
|
635
633
|
|
|
636
634
|
|
|
637
|
-
<a id="
|
|
635
|
+
<a id="org480b590"></a>
|
|
638
636
|
|
|
639
637
|
# Development
|
|
640
638
|
|
|
@@ -643,7 +641,7 @@ After checking out the repo, run \`bin/setup\` to install dependencies. Then, ru
|
|
|
643
641
|
To install this gem onto your local machine, run \`bundle exec rake install\`.
|
|
644
642
|
|
|
645
643
|
|
|
646
|
-
<a id="
|
|
644
|
+
<a id="orgf644906"></a>
|
|
647
645
|
|
|
648
646
|
# Contributing
|
|
649
647
|
|
data/README.org
CHANGED
|
@@ -421,12 +421,12 @@ line-break should occur. By default it is the sequence =∼∼=. This means th
|
|
|
421
421
|
even consecutive occurrences. There is no way to escape this in the text, so
|
|
422
422
|
if you want labels that use =∼∼= as part of the text, you are going to have
|
|
423
423
|
difficulty printing. But you can change the marker to something else with
|
|
424
|
-
~--
|
|
424
|
+
~--nl-sep~. This is especially helpful when you are using the command-line to
|
|
425
425
|
supply the label text since specifying line-breaks on a shell command can be
|
|
426
426
|
difficult. However note that this substitution takes place even when reading
|
|
427
427
|
label texts from a file or standard input.
|
|
428
428
|
|
|
429
|
-
- ~-n~, ~--
|
|
429
|
+
- ~-n~, ~--nl-sep=SEPARATOR~ :: Specify text to be translated into a line-break
|
|
430
430
|
(default ' =∼∼= ')
|
|
431
431
|
|
|
432
432
|
*** Label separator
|
|
@@ -513,7 +513,7 @@ you can use the ~--in-file~ option to specify that label texts are to be read
|
|
|
513
513
|
from the given file instead.
|
|
514
514
|
|
|
515
515
|
Each paragraph in the file constitutes a separate label. Line breaks within
|
|
516
|
-
the paragraphs are respected, though the ~--
|
|
516
|
+
the paragraphs are respected, though the ~--nl-sep~ marker is still replaced
|
|
517
517
|
with additional line breaks. Any line starting with a ~#~ character is
|
|
518
518
|
considered a comment and is not included in the text of any label.
|
|
519
519
|
|
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
|
-
#
|
|
96
|
+
# nl-sep: '~~'
|
|
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 ('~~' by default, see --
|
|
51
|
+
parser.separator "marker ('~~' by default, see --nl-sep) 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."
|
data/lib/labrat/read_files.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Labrat
|
|
4
|
-
def self.read_label_texts(fname,
|
|
4
|
+
def self.read_label_texts(fname, nl_sep)
|
|
5
5
|
file =
|
|
6
6
|
if fname
|
|
7
7
|
ofname = fname
|
|
@@ -22,20 +22,20 @@ module Labrat
|
|
|
22
22
|
|
|
23
23
|
if /\A\s*\z/.match?(line)
|
|
24
24
|
# At blank line record any accumulated label into texts, but remove
|
|
25
|
-
# the
|
|
25
|
+
# the nl_sep from the end.
|
|
26
26
|
if label
|
|
27
|
-
texts << label.sub(/#{Regexp.quote(
|
|
27
|
+
texts << label.sub(/#{Regexp.quote(nl_sep)}\z/, '')
|
|
28
28
|
label = nil
|
|
29
29
|
end
|
|
30
30
|
else
|
|
31
31
|
# Append a non-blank line to the current label, creating it if
|
|
32
32
|
# necessary.
|
|
33
33
|
label ||= +''
|
|
34
|
-
label << line.chomp +
|
|
34
|
+
label << line.chomp + nl_sep
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
# Last label in the file.
|
|
38
|
-
texts << label.sub(/#{Regexp.quote(
|
|
38
|
+
texts << label.sub(/#{Regexp.quote(nl_sep)}\z/, '') if label
|
|
39
39
|
texts
|
|
40
40
|
end
|
|
41
41
|
end
|
data/lib/labrat/version.rb
CHANGED