From: Matt Price <moptop99@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Some projects
Date: Wed, 28 Oct 2015 11:31:20 -0400 [thread overview]
Message-ID: <CAN_Dec9xUwJ72NBC41Q+nyK2a-wov0949awBo+cWFt7boRniuw@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec8=tR03Z-f7Xg7WzGqNJ3GPoYKmVOFoLHsXsAPvv0hDZg@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1106 bytes --]
On Wed, Oct 28, 2015 at 10:36 AM, Matt Price <moptop99@gmail.com> wrote:
>
> That does seem to be an issue, but I bet it wouldn't be too hard to fix.
> Currently outputformat is hardcoded on line 94 of lib/citeServer.js; I'm a
> little slow at reading JS but I think replacing line 259 with a switch
> statement analogous to the one for responseformat at line 291 would allow
> one to use the full capacities of citeproc.js. I think the best route
> would probably be to submit a patch to citeproc.js adding an org-mode
> output format, propagating that up to citeproc-node, submitting a second
> patch to citeproc-node, and then writing the org-internal functions
> properly. We might also want to add an additional responseformat option.
>
>> Matt
>>
>
>
here is a very half-assed aproach that adds an org-mode outputformat to
citeproc. it's incomplete but does much of wha it ought to. some of the
elements I left in html b/c I'm not sure how they oughtto be handled in
org. e.g., how do we handle smallcaps?
(this is a patch to citeproc-node, so requires installing the repo from
github first).
[-- Attachment #1.2: Type: text/html, Size: 1753 bytes --]
[-- Attachment #2: add-org.patch --]
[-- Type: text/x-patch, Size: 4778 bytes --]
diff --git a/lib/citeServer.js b/lib/citeServer.js
index 691ca78..a5d82c7 100644
--- a/lib/citeServer.js
+++ b/lib/citeServer.js
@@ -91,7 +91,7 @@ var defaultCiteserverConfig = {
var defaultRequestConfig = {
bibliography: '1',
citations: '0',
- outputformat: 'html',
+ outputformat: 'org',
responseformat: 'json',
locale: 'en-US',
style: 'chicago-author-date',
diff --git a/lib/citeproc.js b/lib/citeproc.js
index 08a8008..8622533 100644
--- a/lib/citeproc.js
+++ b/lib/citeproc.js
@@ -13140,6 +13140,106 @@ CSL.Output.Formats.prototype.html = {
return "<a href=\"http://dx.doi.org/" + str + "\">" + str + "</a>";
}
};
+
+CSL.Output.Formats.prototype.org = {
+ "text_escape": function (text) {
+ if (!text) {
+ text = "";
+ }
+ return text.replace(/&/g, "&")
+ .replace(/</g, "<")
+ .replace(/>/g, ">")
+ .replace(" ", "  ", "g")
+ .replace(CSL.SUPERSCRIPTS_REGEXP,
+ function(aChar) {
+ return "<sup>" + CSL.SUPERSCRIPTS[aChar] + "</sup>";
+ });
+ },
+ "bibstart": "* Bibliography\n",
+ "bibend": "\n",
+ "@font-style/italic": "/%%STRING%%/",
+ "@font-style/oblique": "/%%STRING%%/",
+ "@font-style/normal": "%%STRING%%",
+ "@font-variant/small-caps": "<span style=\"font-variant:small-caps;\">%%STRING%%</span>",
+ "@passthrough/true": CSL.Output.Formatters.passthrough,
+ "@font-variant/normal": false,
+ "@font-weight/bold": "*%%STRING%%*",
+ "@font-weight/normal": false,
+ "@font-weight/light": false,
+ "@text-decoration/none": false,
+ "@text-decoration/underline": "_%%STRING%%_",
+ "@vertical-align/sup": "^{%%STRING%%}",
+ "@vertical-align/sub": "_{%%STRING%%}",
+ "@vertical-align/baseline": false,
+ "@strip-periods/true": CSL.Output.Formatters.passthrough,
+ "@strip-periods/false": CSL.Output.Formatters.passthrough,
+ "@quotes/true": function (state, str) {
+ if ("undefined" === typeof str) {
+ return state.getTerm("open-quote");
+ }
+ return state.getTerm("open-quote") + str + state.getTerm("close-quote");
+ },
+ "@quotes/inner": function (state, str) {
+ if ("undefined" === typeof str) {
+ return "\u2019";
+ }
+ return state.getTerm("open-inner-quote") + str + state.getTerm("close-inner-quote");
+ },
+ "@quotes/false": false,
+ "@cite/entry": function (state, str) {
+ return state.sys.wrapCitationEntry(str, this.item_id, this.locator_txt, this.suffix_txt);
+ },
+ "@bibliography/entry": function (state, str) {
+ var insert = "";
+ if (state.sys.embedBibliographyEntry) {
+ insert = state.sys.embedBibliographyEntry(this.item_id) + "\n";
+ }
+ return " \n" + str + "\n" + insert;
+ },
+ "@display/block": function (state, str) {
+ return "\n\n <div class=\"csl-block\">" + str + "</div>\n";
+ },
+ "@display/left-margin": function (state, str) {
+ return "\n <div class=\"csl-left-margin\">" + str + "</div>";
+ },
+ "@display/right-inline": function (state, str) {
+ return "<div class=\"csl-right-inline\">" + str + "</div>\n ";
+ },
+ "@display/indent": function (state, str) {
+ return "<div class=\"csl-indent\">" + str + "</div>\n ";
+ },
+ "@showid/true": function (state, str, cslid) {
+ if (!state.tmp.just_looking && ! state.tmp.suppress_decorations) {
+ if (cslid) {
+ return "<span class=\"" + state.opt.nodenames[cslid] + "\" cslid=\"" + cslid + "\">" + str + "</span>";
+ } else if ("string" === typeof str) {
+ var prePunct = "";
+ if (str) {
+ var m = str.match(CSL.VARIABLE_WRAPPER_PREPUNCT_REX);
+ prePunct = m[1];
+ str = m[2];
+ }
+ var postPunct = "";
+ if (str && CSL.SWAPPING_PUNCTUATION.indexOf(str.slice(-1)) > -1) {
+ postPunct = str.slice(-1);
+ str = str.slice(0,-1);
+ }
+ return state.sys.variableWrapper(this.params, prePunct, str, postPunct);
+ } else {
+ return str;
+ }
+ } else {
+ return str;
+ }
+ },
+ "@URL/true": function (state, str) {
+ return "<a href=\"" + str + "\">" + str + "</a>";
+ },
+ "@DOI/true": function (state, str) {
+ return "<a href=\"http://dx.doi.org/" + str + "\">" + str + "</a>";
+ }
+};
+
CSL.Output.Formats.prototype.text = {
"text_escape": function (text) {
if (!text) {
next prev parent reply other threads:[~2015-10-28 15:31 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-25 13:08 Some projects Nicolas Goaziou
2015-10-25 14:43 ` Marcin Borkowski
2015-10-25 16:11 ` Nicolas Goaziou
2015-10-25 15:45 ` Eric S Fraga
2015-10-25 16:16 ` Nicolas Goaziou
2015-10-25 16:18 ` Marcin Borkowski
2015-10-25 16:37 ` Nicolas Goaziou
2015-10-25 18:13 ` Marcin Borkowski
2015-10-25 18:24 ` Nicolas Goaziou
2015-10-25 17:57 ` Thomas S. Dye
2015-10-25 18:00 ` Fabrice Popineau
2015-10-25 18:12 ` Nicolas Goaziou
2015-10-25 18:22 ` Eric S Fraga
2015-10-25 19:12 ` Marcin Borkowski
2015-10-25 19:11 ` Marcin Borkowski
2015-10-25 21:18 ` Anders Johansson
2015-10-25 21:29 ` Anders Johansson
2015-10-25 19:33 ` Thomas S. Dye
2015-10-25 20:00 ` Nicolas Goaziou
2015-10-25 20:17 ` Thomas S. Dye
2015-10-25 20:03 ` Nicolas Goaziou
2015-10-25 19:02 ` Rasmus
2015-10-25 19:20 ` Marcin Borkowski
2015-10-26 2:23 ` Matt Price
2015-10-25 20:24 ` Samuel Wales
2015-10-25 20:25 ` Samuel Wales
2015-10-25 23:03 ` Aaron Ecay
2015-10-26 8:13 ` Marcin Borkowski
2015-10-26 9:20 ` Rasmus
2015-10-26 16:39 ` Richard Lawrence
2015-10-26 18:17 ` Nicolas Goaziou
2015-10-26 22:23 ` Richard Lawrence
2015-10-27 0:03 ` Matt Price
2015-10-27 12:01 ` Aaron Ecay
2015-10-27 12:34 ` Rasmus
2015-10-27 13:03 ` Aaron Ecay
2015-10-27 13:51 ` Rasmus
2015-10-28 1:05 ` Matt Price
2015-10-28 3:28 ` Aldric Giacomoni
2015-10-28 3:31 ` Matt Lundin
2015-10-28 14:36 ` Matt Price
2015-10-28 15:31 ` Matt Price [this message]
2015-10-28 1:05 ` Matt Price
2015-10-27 13:19 ` Rainer M Krug
2015-10-27 13:42 ` Rasmus
2015-10-27 14:49 ` Ista Zahn
2015-10-27 15:09 ` Rasmus Pank Roulund
2015-10-27 15:25 ` Ista Zahn
2015-10-27 15:36 ` Rainer M Krug
2015-10-28 2:52 ` Matt Lundin
2015-10-27 13:22 ` Richard Lawrence
2015-10-28 1:57 ` Matt Lundin
2015-10-28 8:56 ` Rasmus
2015-10-28 9:07 ` Rasmus
2015-10-26 17:20 ` Eric Abrahamsen
2015-10-27 8:30 ` Nicolas Goaziou
2015-10-27 18:53 ` Eric Abrahamsen
2015-10-27 19:23 ` Rasmus
2015-10-27 20:28 ` Eric Abrahamsen
2015-10-27 20:01 ` Marcin Borkowski
2015-10-27 21:53 ` Nicolas Goaziou
2015-10-26 18:20 ` Kaushal Modi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN_Dec9xUwJ72NBC41Q+nyK2a-wov0949awBo+cWFt7boRniuw@mail.gmail.com \
--to=moptop99@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).