aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-20 11:17:54 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-21 11:19:55 +0200
commitbe73d0ac483980072964bc351a8c542cb2c75328 (patch)
tree9d67917f84609d62de105526d8b04e9a48f87fc1
parentcfb5a3a464ddb1d8aa9a1bbcb1a08db3a38ad619 (diff)
downloadfref-be73d0ac483980072964bc351a8c542cb2c75328.tar.gz
Add fref.1
-rw-r--r--Makefile4
-rw-r--r--example.t22
-rw-r--r--fref.1142
3 files changed, 157 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index a84614a..1bd8fb8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
fref: fref.lex
lex fref.lex
cc -std=c89 -O2 -o fref lex.yy.c -lfl
+
+install:
+ install fref /usr/local/bin
+ install -m 644 fref.1 /usr/local/man/man1
diff --git a/example.t b/example.t
index 1993af6..9c77766 100644
--- a/example.t
+++ b/example.t
@@ -3,18 +3,7 @@
.SH
References
.XP
-%la Bogorodickij (1887)
-%au Богородицкий, В. А.
-%da 1887
-%ti Курс грамматики русского языка. Часть 1-ая: Фонетика
-%ci Варшава
-%pu Типография Михаила Земкевича
-%pp 110-123
-%hr http://www.example.com/b1887.pdf
-%ad 2020-04-27
-.XP
%au Baudouin de Courtenay, J.
-%au Author, Fake Extra
%da 1972
%ti The Difference between Phonetics and Psychophonetics
%bo A Baudouin de Courtenay Anthology
@@ -24,7 +13,18 @@ References
%pu Indiana University Press
%xx Extra information
.XP
+%la Bogorodickij (1887)
+%au Богородицкий, В. А.
+%da 1887
+%ti Курс грамматики русского языка. Часть 1-ая: Фонетика
+%ci Варшава
+%pu Типография Михаила Земкевича
+%pp 110-123
+%hr http://www.example.com/b1887.pdf
+%ad 2020-04-27
+.XP
%au Lesk, M. E.
+%au Author, F. E.
%ti Some Applications of Inverted Indexes on the UNIX System
%bo UNIX Programmer's Manual
%vo 2b
diff --git a/fref.1 b/fref.1
new file mode 100644
index 0000000..5fe69d7
--- /dev/null
+++ b/fref.1
@@ -0,0 +1,142 @@
+.Dd July 20, 2021
+.Dt FREF 1
+.Os
+.Sh NAME
+.Nm fref
+.Nd format references
+.
+.Sh SYNOPSIS
+.Nm
+.
+.Sh DESCRIPTION
+.Pp
+.Nm
+is a
+.Xr troff 1
+preprocessor that formats reference lists in Harvard style.
+It does not handle inline citations.
+.Pp
+Unlike
+.Xr refer 1 ,
+.Nm
+does not re-arrange references.
+They are inserted in the places they are specified in the
+.Xr troff 1
+source code.
+.Pp
+.Pa fref.lex
+contains a number of hardcoded strings
+that should be manually changed
+depending on the desired output language:
+.Bl -tag -width AVAIL -offset indent
+.It AND
+.Dq and :
+Inserted between next to last and last author.
+.It AVAIL
+.Dq available :
+Inserted before a hypertext reference.
+.It ED
+.Dq editor :
+Inserted before the name of the editor.
+.It P
+.Dq page :
+Inserted before a single page.
+.It PP
+.Dq pages :
+Inserted before multiple pages.
+.It TR
+.Dq translator :
+Inserted before the name of the translator.
+.It VOL
+.Dq volume :
+Inserted before the volume number.
+.El
+.
+.Sh SYNTAX
+.Pp
+Lines beginning with
+.Ql %
+(percent) are treated as reference fields.
+The percent sign is followed by a two-letter identifier,
+signifying the type of field.
+The field identifier is followed by a space or tab
+and the contents of the field, spanning the rest of the line.
+.Pp
+The following fields are available:
+.Bl -tag -width xxx -offset indent
+.It Sy %ad
+Access date.
+.It Sy %bo
+Book.
+.It Sy %ci
+City.
+.It Sy %da
+Date (year).
+.It Sy %ed
+Editor.
+.It Sy %hr
+Hypertext reference.
+.It Sy %jo
+Journal.
+.It Sy %la
+Label.
+.It Sy %no
+TODO: Issue number.
+.It Sy %pp
+Pages.
+.It Sy %pu
+Publisher.
+.It Sy %se
+TODO: Series.
+.It Sy %ti
+Title.
+.It Sy %tr
+Translator.
+.It Sy %vo
+Volume.
+.It Sy %xx
+Extra information.
+.El
+.
+.Sh EXAMPLES
+.Pp
+The following
+.Xr troff 1
+source code
+.Bd -literal -offset indent
+\&.SH
+References
+\&.XP
+%au Baudouin de Courtenay, J.
+%da 1972
+%ti The Difference between Phonetics and Psychophonetics
+%bo A Baudouin de Courtenay Anthology
+%ed T. A. Sebeok et al.
+%tr Edward Stankiewicz
+%ci Bloomington
+%pu Indiana University Press
+%xx Extra information
+.Ed
+.Pp
+results in the following output:
+.Bd -literal -offset indent
+\&.SH
+References
+\&.XP
+Baudouin de Courtenay, J. (1972).
+The Difference between Phonetics and Psychophonetics.
+\\fIA Baudouin de Courtenay Anthology\\fP (red. T. A. Sebeok et al.).
+Övers. Edward Stankiewicz.
+Bloomington: Indiana University Press.
+Extra information.
+.Ed
+.
+.Sh SEE ALSO
+.Pp
+.Xr refer 1
+.
+.Sh AUTHORS
+.Pp
+.Nm
+is written by John Ankarström
+.Aq Mt "john (at) ankarstrom.se" .