From ac8132903355f0ffd057893cde1efe15dfd0cb13 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 3 Jan 2022 14:08:23 -0500 Subject: Generate RFC bibliographic blocks from JSON --- doc/rfc/Makefile | 4 ++-- doc/rfc/rfc.1 | 9 ++++++++- doc/rfc/rfc.in | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) (limited to 'doc/rfc') diff --git a/doc/rfc/Makefile b/doc/rfc/Makefile index 31e238a0..3078dcd3 100644 --- a/doc/rfc/Makefile +++ b/doc/rfc/Makefile @@ -1,8 +1,8 @@ PREFIX ?= ~/.local MANDIR ?= ${PREFIX}/share/man -MODULE = ftp.rfc-editor.org::rfcs-text-only -RFCS = ${MODULE}/rfc-index.txt ${MODULE}/'rfc[1-9]*.txt' +MODULE = ftp.rfc-editor.org::rfcs +RFCS = ${MODULE}/rfc-index.txt ${MODULE}/'rfc[1-9]*.txt' ${MODULE}/'rfc*.json' all: rfc rfctags diff --git a/doc/rfc/rfc.1 b/doc/rfc/rfc.1 index ece5a901..da393e8b 100644 --- a/doc/rfc/rfc.1 +++ b/doc/rfc/rfc.1 @@ -1,4 +1,4 @@ -.Dd January 18, 2021 +.Dd January 3, 2022 .Dt RFC 1 .Os . @@ -10,6 +10,8 @@ .Sh SYNOPSIS .Nm rfc .Op Ar number +.Nm rfc +.Fl b Ar number .Nm rfctags .Op Ar . @@ -23,6 +25,11 @@ The RFC is displayed in the .Ev PAGER with a tags file generated by .Nm rfctags . +The +.Fl b +option outputs an +.Xr mdoc 7 +bibliographic block. . .Pp The diff --git a/doc/rfc/rfc.in b/doc/rfc/rfc.in index 16081c83..abeb293f 100644 --- a/doc/rfc/rfc.in +++ b/doc/rfc/rfc.in @@ -4,6 +4,28 @@ set -eu mktemp='mktemp -t rfc' [ "$(uname)" = 'OpenBSD' ] && mktemp="${mktemp}.XXXXXXXXXX" +bib= +while getopts 'b:' opt; do + case $opt in + (b) bib=$OPTARG;; + (?) exit 1;; + esac +done +shift $((OPTIND - 1)) + +if test -n "${bib}"; then + exec jq -r ' + ".Rs", + (.authors[] | ".%A \(.)"), + ".%T \(.title | ltrimstr(" "))", + ".%I IETF", + ".%R \(.doc_id)", + ".%U https://tools.ietf.org/html/\(.doc_id | ascii_downcase)", + ".%D \(.pub_date)", + ".Re" + ' %%PREFIX%%/share/rfc/"rfc${bib}.json" +fi + rfc=%%PREFIX%%/share/rfc/"rfc${1:--index}.txt" tags=$($mktemp) trap 'rm "${tags}"' EXIT -- cgit 1.4.1 alue='range'>range
path: root/tests/filters (unfollow)
Commit message (Expand)Author
2015-08-14cgit: use cgit_print_error_page() where appropriateJohn Keeping
2015-08-14ui-shared: add cgit_print_error_page() functionJohn Keeping
2015-08-14ui-patch: make sure to send http headersChristian Hesse
2015-08-13Makefile: make "git/config.mak.uname" inclusion optionalJohn Keeping
2015-08-13ui-shared: show full date in tooltip if longer ago than max_relativeJohn Keeping
2015-08-13ui-shared: use common function in print_rel_date()John Keeping
2015-08-13ui-shared: extract date formatting to a functionJohn Keeping
2015-08-13filter: don't use dlsym unnecessarilyJohn Keeping
2015-08-13ui-tree: use "sane" isgraph()John Keeping
2015-08-13cgit.h: move stdbool.h from ui-shared.hJohn Keeping
2015-08-13cache.c: fix header orderJohn Keeping
2015-08-13configfile.c: don't include system headers directlyJohn Keeping
2015-08-13Remove redundant includesJohn Keeping
2015-08-13Makefile: include Git's config.mak.unameJohn Keeping
2015-08-13tests: allow shell to be overriddenJohn Keeping
2015-08-13redirect: cleanlinessJason A. Donenfeld
2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld
2015-08-12ui-log: fix double countingJohn Keeping
2015-08-12log: allow users to follow a fileJohn Keeping
2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping
2015-08-12t0110: Chain together using &&Jason A. Donenfeld
2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld
2015-08-12filters: apply HTML escapingLazaros Koromilas
2015-08-12git: update to v2.5.0Christian Hesse
2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt