diff options
author | Karl Berry <karl@freefriends.org> | 2016-06-09 22:56:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-06-09 22:56:07 +0000 |
commit | ec9a9c4a9a54e51cf11e52bf50e7514b86fe79da (patch) | |
tree | 464b266fc09cdc9fd15e95354ca87acacb09a7b1 /Master/texmf-dist | |
parent | 29b2df230459512a0f73e5769a1cfc16e4125510 (diff) |
ietfbibs (8jun16)
git-svn-id: svn://tug.org/texlive/trunk@41332 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/bibtex/ietfbibs/CHANGELOG.md | 11 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/ietfbibs/LICENSE.md | 19 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/ietfbibs/Makefile | 20 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/ietfbibs/README.md | 9 | ||||
-rwxr-xr-x | Master/texmf-dist/doc/bibtex/ietfbibs/id2bib | 30 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/ietfbibs/id2bib.awk | 96 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/ietfbibs/ids.tex | 16 | ||||
-rwxr-xr-x | Master/texmf-dist/doc/bibtex/ietfbibs/rfc2bib | 30 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/ietfbibs/rfc2bib.awk | 117 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/ietfbibs/rfcs.tex | 16 |
10 files changed, 364 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/CHANGELOG.md b/Master/texmf-dist/doc/bibtex/ietfbibs/CHANGELOG.md new file mode 100644 index 00000000000..c34e7926476 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/CHANGELOG.md @@ -0,0 +1,11 @@ +## [v1.0.0](https://github.com/mor1/ietfbibs/tree/v1.0.0) (2016-06-08) +[Full Changelog](https://github.com/mor1/ietfbibs/compare/v0.0.1...v1.0.0) + ++ Update RFC and Internet Draft parsers ++ Provide script harnesses ++ Provide PDF generation via LaTeX + + +## [v1.0.0](https://github.com/mor1/ietfbibs/tree/v0.0.1) + +First import to GitHub. diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/LICENSE.md b/Master/texmf-dist/doc/bibtex/ietfbibs/LICENSE.md new file mode 100644 index 00000000000..b32a9b991eb --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (c) 2000-2016 Richard Mortier <mort@cantab.net> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/Makefile b/Master/texmf-dist/doc/bibtex/ietfbibs/Makefile new file mode 100644 index 00000000000..c6f7b0b561a --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/Makefile @@ -0,0 +1,20 @@ +.PHONY = all clean + +LATEX = latexmk -xelatex + +all: rfcs.pdf ids.pdf + +clean: + $(LATEX) -C + $(RM) rfcs.bib rfcs.bbl rfcs.run.xml + $(RM) ids.bib ids.bbl ids.run.xml + $(RM) -r auto + +rfcs.bib: + ./rfc2bib >| rfcs.bib + +ids.bib: + ./id2bib >| ids.bib + +%.pdf: %.tex %.bib + $(LATEX) $* diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/README.md b/Master/texmf-dist/doc/bibtex/ietfbibs/README.md new file mode 100644 index 00000000000..16780407d00 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/README.md @@ -0,0 +1,9 @@ +IETF BibTeX Creation +==================== + +This project is licensed under the MIT license. + +These are some [gawk](https://www.gnu.org/software/gawk/) scripts for processing +various IETF index files to produce BibTeX. As regex based parsers they're quite +brittle and rely on consistent formatting of the input. Also included are some +shell scripts to drive them. diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/id2bib b/Master/texmf-dist/doc/bibtex/ietfbibs/id2bib new file mode 100755 index 00000000000..56e017897d5 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/id2bib @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (c) 2000-2016 Richard Mortier <mort@cantab.net> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +INDEX=id-abstract.txt +DIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'id2bib') + +curl http://www.ietf.org/download/$INDEX >| $DIR/$INDEX +gawk -f id2bib.awk -- $DIR/$INDEX + +rm $DIR/$INDEX +rmdir $DIR diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/id2bib.awk b/Master/texmf-dist/doc/bibtex/ietfbibs/id2bib.awk new file mode 100644 index 00000000000..9a999611d04 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/id2bib.awk @@ -0,0 +1,96 @@ +# Copyright(c) 2000-2016 Richard Mortier <mort@cantab.net> +# Copyright(c) 2010 Paul Jakma <paul@jakma.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +BEGIN { + FS="[\"<>]"; + RS="(\n[A-Za-z0-9].*\n[^ ]+\n)* \""; + + # banner + printf("% This file auto-generated from id-index.txt by id2bib.awk\n"); + printf("% by Richard Mortier <mort@cantab.net>.\n"); + printf("%\n"); + printf("% Date: %s\n", strftime()); + printf("\n"); + printf("@string{ietf=\"{IETF}\"}\n\n"); +} + +function get_authors(field, i, first) { + first = 1; + authors = ""; + + for (i = field; i <= NF; i++) { + if (length($i) == 0) continue; + if ($i ~ /[0-9]{1,2}[-/][[:alpha:]]{3}[-/][0-9]{2}/) + break; + if ($i ~ /(19|20)[0-9]{2}-[0-9]{2}-[0-9]{2}/) + break; + + if (first) first = 0; + else authors = authors " and "; + authors = authors $i; + } + return i; +} + +NF > 1 { + # guard '$', '_', '#' from BibTeX/LaTeX in all fields + gsub(/\$/, "\\$", $0 ); # "); + gsub(/_/, "\\_", $0 ); # "); + gsub(/#/, "\\" "#", $0 ); # "); + + for (i = 1; i <= NF; i++) { + gsub(/[ \n\t]+/, " ", $i); + sub(/^[ ]+/,"",$i); + } + + title = gensub(/([A-Z])/, "{\\1}", "g", $1); + idstr = $3; + abstract = $4; + + authors = ""; + n=split($2, authors_date, ","); + for (i=0; i<n-1; i++) + { + a = authors_date[i]; + gsub(/[ \n\t]+/, " ", a); + sub(/^[ ]+/, "", a); + + if(a == "") continue; + else if(authors == "") authors = a + else authors = authors " and " a; + } + date = authors_date[n-1]; + split(date, ymd, "-"); + year = ymd[1]; + month = ymd[2]; + day = ymd[3]; + + printf("@Misc{id:%s,\n", idstr) ; + printf(" author = {%s},\n", authors) ; + printf(" title = {%s},\n", title) ; + printf(" howpublished = {Internet Draft},\n") ; + printf(" month = %s,\n", month) ; + printf(" year = %s,\n", year) ; + printf(" note = {%s},\n", "<" idstr ".txt>") ; + printf(" abstract = {%s},\n", abstract) ; + printf(" url = {{http://tools.ietf.org/html/%s}},\n", idstr); + printf("}\n\n") ; +} diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/ids.tex b/Master/texmf-dist/doc/bibtex/ietfbibs/ids.tex new file mode 100644 index 00000000000..32b25731d39 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/ids.tex @@ -0,0 +1,16 @@ +\documentclass{book} + +\usepackage{showkeys} +\usepackage[ + backend=biber, + natbib=true, + style=numeric, + sorting=none + ]{biblatex} + +\bibliography{ids} + +\begin{document} +\nocite{*} +\printbibliography +\end{document} diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/rfc2bib b/Master/texmf-dist/doc/bibtex/ietfbibs/rfc2bib new file mode 100755 index 00000000000..74044634450 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/rfc2bib @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Copyright (c) 2000-2016 Richard Mortier <mort@cantab.net> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +INDEX=rfc-index.txt +DIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'rfc2bib') + +curl -Ss http://www.ietf.org/download/$INDEX >| $DIR/$INDEX +gawk -f rfc2bib.awk -- $DIR/$INDEX + +rm $DIR/$INDEX +rmdir $DIR diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/rfc2bib.awk b/Master/texmf-dist/doc/bibtex/ietfbibs/rfc2bib.awk new file mode 100644 index 00000000000..093788a0180 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/rfc2bib.awk @@ -0,0 +1,117 @@ +# Copyright(c) 2000-2016 Richard Mortier <mort@cantab.net> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files(the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +BEGIN { + FS="[.] "; RS="\n\n"; + + printf("% This file auto-generated from rfc-index.txt by rfc2bib.awk\n"); + printf("% by Richard Mortier <mort@cantab.net>.\n"); + printf("%\n"); + printf("% Date: %s\n", strftime()); + printf("\n"); + printf("@string{ietf=\"{IETF}\"}\n\n"); +} + +/^[0-9][0-9][0-9][0-9] Not Issued./ { + number = substr($1, 0, 4); + gsub(/^0+/, "", number); + + printf("@TechReport{rfc:%s,\n", number); + printf(" key = {RFC%s},\n", number); + printf(" author = {N/A},\n"); + printf(" title = {{Not Issued}},\n"); + printf(" institution = ietf,\n"); + printf(" type = {{RFC}},\n"); + printf(" year = {N/A},\n"); + printf("}\n\n"); + next; +} + +/^[0-9][0-9][0-9][0-9] /{ + gsub(/[\n]/, "", $0); + gsub(/[ ]+/, " ", $0); + + # guard '$', '_', '#' from BibTeX/LaTeX in all fields + gsub(/\$/, "\\$", $0 ); # "); + gsub(/_/, "\\_", $0 ); # "); + gsub(/#/, "\\" "#", $0 ); # "); + + number = substr($1, 0, 4); + gsub(/^0+/, "", number); + printf("@TechReport{rfc:%s,\n", number); + printf(" key = {RFC%s},\n", number); + + # authors are all the fields "in the middle"; can be separated by + # commas or ampersands + authors = $2; + for(i=3; i < NF-1; i++) + { + if(length( $(i) ) > 1) + { + authors =( authors ".~" $(i) ); + } + else + { + authors =( authors "." $(i) ); + } + } + gsub(/,| &/, " and", authors); + gsub(/^ /, "", authors); + if(length(authors) == 0) + { + authors = "author list not available"; + } + printf(" author = {%s},\n", authors ); + + # guard capitals and '&' in the title + tmp = substr($1, 6); + title = gensub(/([A-Z])/, "{\\1}", "g", tmp); + gsub(/&/, "\\" "\\&", title ); # "); + gsub(/ - /, " -- ", title ); # "); + printf(" title = {%s},\n", title); + + # just let the institution be the IETF for now + printf(" institution = ietf,\n"); + + y_fld = $(NF-1); + y_pos = length(y_fld) - 3; + year = substr(y_fld, y_pos, 4); + if(length(year) == 0) + { + year = "{year not available}"; + } + printf(" year = %s,\n", year); + + printf(" type = {RFC},\n"); + printf(" number = %s,\n", number); + + # early RFCs: mmm-dd-yyyy; later RFCs: month yyyy + m_fld = $(NF-1); + gsub(/-| |\n|[0-9]/, "", m_fld); + month = substr(tolower(m_fld), 0, 3); + if(length(month) == 0) + { + month = "{month not available}"; + } + printf(" month = %s,\n", month); + + printf(" annote = {%s},\n", $NF); + printf("}\n\n"); +} diff --git a/Master/texmf-dist/doc/bibtex/ietfbibs/rfcs.tex b/Master/texmf-dist/doc/bibtex/ietfbibs/rfcs.tex new file mode 100644 index 00000000000..6878b612ba5 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/ietfbibs/rfcs.tex @@ -0,0 +1,16 @@ +\documentclass{book} + +\usepackage{showkeys} +\usepackage[ + backend=biber, + natbib=true, + style=numeric, + sorting=none + ]{biblatex} + +\bibliography{rfcs} + +\begin{document} +\nocite{*} +\printbibliography +\end{document} |