diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2026-06-06 12:26:27 -0400 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2026-06-06 12:26:27 -0400 |
| commit | b56c273d8198ae6cee69bbc9fe5a6a61da4074e4 (patch) | |
| tree | f75b89299fe2783354ba0ab7e3ace088fa60245a /lib/bib-select.awk | |
| parent | 4aec9800fca665713b0eba19f10af927b483332e (diff) | |
| download | bibutils-b56c273d8198ae6cee69bbc9fe5a6a61da4074e4.tar.gz | |
Code cleanup
Diffstat (limited to 'lib/bib-select.awk')
| -rw-r--r-- | lib/bib-select.awk | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/bib-select.awk b/lib/bib-select.awk index 1900390..9aa5a37 100644 --- a/lib/bib-select.awk +++ b/lib/bib-select.awk @@ -1,7 +1,8 @@ # bib-select.awk - emit entries selected by key, canonically # # Requires bib-parse.awk and bib-canon.awk. Variables (set with -v): -# keys - comma-separated list of entry keys +# keys - comma-separated list of entry keys; a key of "*" selects +# every entry (as produced by \nocite{*}) # invert - 0: emit entries whose key is in the list # 1: emit entries whose key is NOT in the list # @@ -10,20 +11,22 @@ BEGIN { bib_sel_n = split(keys, bib_sel_k, ",") - for (bib_sel_i = 1; bib_sel_i <= bib_sel_n; bib_sel_i++) - BIB_SEL[bib_sel_k[bib_sel_i]] = 1 + for (bib_sel_i = 1; bib_sel_i <= bib_sel_n; bib_sel_i++) { + if (bib_sel_k[bib_sel_i] == "*") + BIB_SEL_ALL = 1 + else + BIB_SEL[bib_sel_k[bib_sel_i]] = 1 + } } function bib_pass(raw) { - if (bib_out_n++) - print "" + bib_sep() print raw } function bib_entry(type, key) { - if ((key in BIB_SEL) != invert + 0) { - if (bib_out_n++) - print "" + if (BIB_SEL_ALL || (key in BIB_SEL) != invert + 0) { + bib_sep() bib_emit(type, key) } } |