diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2019-12-29 16:11:20 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2019-12-29 16:11:20 +0000 |
| commit | b270c8501a14c5822c58750f2a60076c26f91eee (patch) | |
| tree | 9a2da3506baed05385c209587efd8c25c9863d0b | |
| parent | fix yieldable_gsub (diff) | |
| download | mmm-b270c8501a14c5822c58750f2a60076c26f91eee.tar.gz mmm-b270c8501a14c5822c58750f2a60076c26f91eee.zip | |
move to DOI references
| -rw-r--r-- | mmm/mmmfs/plugins/cites.moon | 23 | ||||
| -rw-r--r-- | mmm/mmmfs/plugins/init.moon | 6 | ||||
| -rw-r--r-- | root/articles/mmmfs/references/subtext/URL -> cite$acm | 1 | ||||
| -rw-r--r-- | root/articles/mmmfs/references/subtext/cite$doi | 1 | ||||
| -rw-r--r-- | root/articles/mmmfs/references/subtext/text$bibtex | 18 | ||||
| -rw-r--r-- | root/articles/mmmfs/references/unix/URL -> cite$acm | 1 | ||||
| -rw-r--r-- | root/articles/mmmfs/references/unix/text$bibtex | 7 | ||||
| -rw-r--r-- | root/articles/mmmfs/references/xerox-star/URL -> cite$acm | 1 | ||||
| -rw-r--r-- | root/articles/mmmfs/references/xerox-star/cite$doi | 1 | ||||
| -rw-r--r-- | root/articles/mmmfs/references/xerox-star/text$bibtex | 33 |
10 files changed, 57 insertions, 35 deletions
diff --git a/mmm/mmmfs/plugins/cites.moon b/mmm/mmmfs/plugins/cites.moon index 8578840..95a9f01 100644 --- a/mmm/mmmfs/plugins/cites.moon +++ b/mmm/mmmfs/plugins/cites.moon @@ -3,7 +3,10 @@ import div, span, sup, a, i, b from require 'mmm.dom' parse_bibtex = (src) -> type, key, kv = src\match '@(%w+){(.-),(.*)}' with info = { _type: type, _key: key } - for key, val in kv\gmatch '([a-z]-)%s*=%s*{(.-)}' + for key, val in kv\gmatch '([a-z]-)%s*=%s*(%b{})' + val\sub 2, -2 + info[key] = val\gsub '[{}]', '' + for key, val in kv\gmatch '([a-z]-)%s*=%s*(%d+)' info[key] = val title = () => @@ -17,6 +20,10 @@ title = () => format_full = () => tt = title @ dot, com = if @title\match '[.?!]$' then '', '' else '.', ',' + + -- @author = deandify @author if @author + -- @editor = deandify @editor if @editor + switch @_type when 'book', 'article' span with setmetatable {}, __index: table @@ -44,16 +51,12 @@ format_full = () => { converts: { { - inp: 'URL -> cite/acm' + inp: 'cite/doi' out: 'URL -> text/bibtex' - cost: 0.5 - transform: (url) => - id = assert (url\match '//dl%.acm%.org/citation%.cfm%?id=(%d+)'), "couldn't parse cite/acm URL: '#{url}'" - uri = "https://dl.acm.org/downformats.cfm?id=#{id}&parent_id=&expformat=bibtex" - if MODE == 'CLIENT' - "https://cors-anywhere.herokuapp.com/#{uri}" - else - uri + cost: 0.1 + transform: (doi) => + doi = doi\match '(10%.%d%d%d%d%d?%d?%d?%d?%d?/[%d%w%.%-_:;%(%)]+)' + "http://api.crossref.org/works/#{doi}/transform/application/x-bibtex" } { inp: 'text/bibtex' diff --git a/mmm/mmmfs/plugins/init.moon b/mmm/mmmfs/plugins/init.moon index 50bf01e..959f657 100644 --- a/mmm/mmmfs/plugins/init.moon +++ b/mmm/mmmfs/plugins/init.moon @@ -210,12 +210,6 @@ converts = { cost: 2 transform: single code } - -- this one needs a higher cost - -- { - -- inp: 'URL -> .+', - -- out: 'mmm/dom', - -- transform: single code - -- } { inp: 'URL -> (.+)', out: '%1', diff --git a/root/articles/mmmfs/references/subtext/URL -> cite$acm b/root/articles/mmmfs/references/subtext/URL -> cite$acm deleted file mode 100644 index 505b6ee..0000000 --- a/root/articles/mmmfs/references/subtext/URL -> cite$acm +++ /dev/null @@ -1 +0,0 @@ -https://dl.acm.org/citation.cfm?id=1094851 diff --git a/root/articles/mmmfs/references/subtext/cite$doi b/root/articles/mmmfs/references/subtext/cite$doi new file mode 100644 index 0000000..2ac65b5 --- /dev/null +++ b/root/articles/mmmfs/references/subtext/cite$doi @@ -0,0 +1 @@ +10.1145/1103845.1094851 diff --git a/root/articles/mmmfs/references/subtext/text$bibtex b/root/articles/mmmfs/references/subtext/text$bibtex new file mode 100644 index 0000000..7e9eb9d --- /dev/null +++ b/root/articles/mmmfs/references/subtext/text$bibtex @@ -0,0 +1,18 @@ +@article{10.1145/1103845.1094851, + author = {Edwards, Jonathan}, + title = {Subtext: Uncovering the Simplicity of Programming}, + year = {2005}, + issue_date = {October 2005}, + publisher = {Association for Computing Machinery}, + address = {New York, NY, USA}, + volume = {40}, + number = {10}, + issn = {0362-1340}, + url = {https://doi.org/10.1145/1103845.1094851}, + doi = {10.1145/1103845.1094851}, + journal = {SIGPLAN Not.}, + month = oct, + pages = {505–518}, + numpages = {14}, + keywords = {copying, non-textual programming, prototypes, visual programming}, +} diff --git a/root/articles/mmmfs/references/unix/URL -> cite$acm b/root/articles/mmmfs/references/unix/URL -> cite$acm deleted file mode 100644 index b4a8d90..0000000 --- a/root/articles/mmmfs/references/unix/URL -> cite$acm +++ /dev/null @@ -1 +0,0 @@ -https://dl.acm.org/citation.cfm?id=577766 diff --git a/root/articles/mmmfs/references/unix/text$bibtex b/root/articles/mmmfs/references/unix/text$bibtex new file mode 100644 index 0000000..561ebb8 --- /dev/null +++ b/root/articles/mmmfs/references/unix/text$bibtex @@ -0,0 +1,7 @@ +@book{10.5555/577766, + author = {Kernighan, Brian W. and Pike, Rob}, + title = {The UNIX Programming Environment}, + year = {1983}, + isbn = {0139376992}, + publisher = {Prentice Hall Professional Technical Reference} +} diff --git a/root/articles/mmmfs/references/xerox-star/URL -> cite$acm b/root/articles/mmmfs/references/xerox-star/URL -> cite$acm deleted file mode 100644 index 8b3d1a3..0000000 --- a/root/articles/mmmfs/references/xerox-star/URL -> cite$acm +++ /dev/null @@ -1 +0,0 @@ -https://dl.acm.org/citation.cfm?id=66894 diff --git a/root/articles/mmmfs/references/xerox-star/cite$doi b/root/articles/mmmfs/references/xerox-star/cite$doi new file mode 100644 index 0000000..b849172 --- /dev/null +++ b/root/articles/mmmfs/references/xerox-star/cite$doi @@ -0,0 +1 @@ +10.1109/2.35211 diff --git a/root/articles/mmmfs/references/xerox-star/text$bibtex b/root/articles/mmmfs/references/xerox-star/text$bibtex index a75cc3e..870eed4 100644 --- a/root/articles/mmmfs/references/xerox-star/text$bibtex +++ b/root/articles/mmmfs/references/xerox-star/text$bibtex @@ -1,17 +1,18 @@ -@article{xerox:star, - author = {Johnson, Jeff et. al}, - title = {The Xerox Star: A Retrospective}, - journal = {Computer}, - issue_date = {September 1989}, - volume = {22}, - number = {9}, - month = sep, - year = {1989}, - issn = {0018-9162}, - pages = {11-26, 28-29}, - url = {http://dx.doi.org/10.1109/2.35211}, - doi = {10.1109/2.35211}, - acmid = {66894}, - publisher = {IEEE Computer Society Press}, - address = {Los Alamitos, CA, USA}, +@article{10.1109/2.35211, + oldauthor = {Johnson, Jeff and Roberts, Teresa L. and Verplank, William and Smith, David C. and Irby, Charles H. and Beard, Marian and Mackey, Kevin}, + author = {Johnson, Jeff et al.}, + title = {The Xerox Star: A Retrospective}, + year = {1989}, + issue_date = {September 1989}, + publisher = {IEEE Computer Society Press}, + address = {Washington, DC, USA}, + volume = {22}, + number = {9}, + issn = {0018-9162}, + url = {https://doi.org/10.1109/2.35211}, + doi = {10.1109/2.35211}, + journal = {Computer}, + month = sep, + pages = {11–26, 28–29}, + numpages = {1}, } |
