Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
dev:citeproc-node [2011/04/01 11:22] rmzelledev:citeproc-node [2011/04/19 11:59] rmzelle
Line 1: Line 1:
-====== Setting up the standalone citeproc-node server ====== +See [[dev/citation_styles/citeproc-node]].
- +
-1. Get citeproc-node +
- +
-<code bash>svn co https://www.zotero.org/svn/citeproc-node/trunk citeproc-node</code> +
-<code bash>cd citeproc-node</code> +
- +
-2Get CSL 1.0 citation styles +
-<code bash>git clone https://github.com/citation-style-language/styles.git</code> +
- +
-3. Move CSL styles to where citeproc-node can find them +
-<code bash>mv styles csl1.0</code> +
- +
-4. Get citeproc-js +
-<code bash>hg clone https://bitbucket.org/fbennett/citeproc-js</code> +
- +
-5. Get sample data from citeproc-js +
-<code bash>mv citeproc-js/demo/sampledata.html .</code> +
- +
-6. Remove citeproc-js directory +
-<code bash>rm -rf citeproc-js</code> +
- +
-7. Get node-o3-xml processing library +
-<code bash>git clone https://github.com/ajaxorg/node-o3-xml.git</code> +
- +
-If no prebuild of node-o3-xml is available for your platform (e.g. 32-bit Mac OS X), you can built it yourself: +
-<code bash>git clone https://github.com/ajaxorg/o3.git +
-cd o3 +
-./tools/node_modules_build +
-cp build/default/o3.node ../node-o3-xml/lib/o3-xml/</code> +
- +
-8. Get CSL locale files +
-<code bash>git clone https://github.com/citation-style-language/locales.git</code> +
- +
-9. Move CSL locale files to where citeproc-node can find them +
-<code bash>mv locales csl-locales</code> +
- +
-Your directory listing is now +
-<code bash>benchServer.js       COPYING        loadcitesnode.js  testciteproc.js +
-citeprocmodule.js    csl1.0         node-o3-xml       zoteronode.js +
-citeprocnode.js      cslFetcher.js  sampledata.html +
-citeServerConf.json  csl-locales    stdNodeTest.js +
-citeServer.js        csl_nodejs.js  step.js</code> +
- +
-(csl1.0, node-o3-xml, and csl-locales are all directories) +
- +
-10. Change configured path to xml library +
-<code bash>open config file:  vi citeServerConf.json</code> +
- +
-change the line: +
- "parserPath" : "../nodejs/node-o3-xml/lib/o3-xml", +
-to: +
- "parserPath" : "./node-o3-xml/lib/o3-xml", +
- +
-11. Start the server (assuming node binary is in your path): +
-<code bash>node citeServer.js</code> +
- +
-If all is well, you will see: +
- +
-<code>debug log file :./citeServerLog.log +
-precaching CSL engines +
-processStyleIdentifier +
-short name only +
-Server running at http://127.0.0.1:8085/ +
-zcite.createEngine +
-cpSys created +
-en-US</code> +
- +
-and in 20 or 30 seconds also: +
- +
-<code>engine created +
-zcite.cacheSaveEngine +
-http://www.zotero.org/styles/chicago-author-date:en-US +
-saving engine +
-turn precache flag off +
-last Step</code> +
- +
--------- +
-Now to test the server. Open another window and cd into your citeproc-node directory. +
- +
-1. Edit the sampledata.html document to the expected JSON format to POST: +
-<code bash>vi sampledata.html</code> +
-get rid of the HTML markup at the top & bottom of the file +
- +
-delete: +
- +
-<code html><html> +
-<head> +
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +
-  <title>Sample data for CSL demo page</title> +
-</head> +
-<body> +
-<pre></code> +
- +
-and delete (note the semicolon -- I think that is a typo in the file, so make sure and delete it): +
- +
-<code html>; +
-</pre> +
-</html></code> +
- +
-2. Now you should have a valid JSON file, BUT the server expects to find an "items" object in the POST, so wrap this JSON but adding this as a first line: +
- +
-<code>{ "items" :</code> +
- +
-and, of course, this as a last line: +
- +
-<code>}</code> +
- +
-3. Save this file as "sampledata.json" +
- +
-4. Try posting it to your server (which you should still have running): +
- +
-<code>curl --header "Content-type: application/json" --data @sampledata.json -X POST http://127.0.0.1:8085?responseformat=html\&style=mla</code> +
- +
-You should see this response appear on your screen: +
- +
-<code html><div class="csl-bib-body"> +
-  <div class="csl-entry">Abbott, Derek A. et al. “Metabolic engineering of &amp;lt;i&amp;gt;Saccharomyces cerevisiae&amp;lt;/ i&amp;gt; for production of carboxylic acids: current status and challenges.” <i>FEMS Yeast Research</i> 9.8 (2009): 1123-1136.</div> +
-  <div class="csl-entry">“Beck v. Beck.” <i>ME</i> 1999: 110.</div> +
-  <div class="csl-entry">---. <i>A.2d</i> 1999: 981.</div> +
-  <div class="csl-entry">Bennett, Frank G., Jr. “Getting Property Right: ‘Informal’ Mortgages in the Japanese Courts.” <i>Pacific Rim Law &amp; Policy Journal</i> 18 (2009): 463-509.</div> +
-  <div class="csl-entry">“British Columbia Elec. Ry. v. Loach.” <i>App. Cas.</i> 1915: 719.</div> +
-  <div class="csl-entry">“Clayton Act.” <i>ch.</i> 1914.</div> +
-  <div class="csl-entry">---. <i>Stat.</i> 1914: 730.</div> +
-  <div class="csl-entry">“Donoghue v. Stevenson.” <i>App. Cas.</i> 1932: 562.</div> +
-  <div class="csl-entry">DʼArcus, Bruce. <i>Boundaries of Dissent: Protest and State Power in the Media Age</i>. Routledge, 2005.</div> +
-  <div class="csl-entry">“FTC Credit Practices Rule.” <i>C.F.R.</i> 1999.</div> +
-  <div class="csl-entry">Malone, Nolan J., U.S. Bureau of the Census. <i>Evaluating Components of International Migration: Consistency of 2000 Nativity Data</i>. Routledge, 2001.</div> +
-  <div class="csl-entry">“People v. Taylor.” <i>N.Y.2d</i> 1989: 683.</div> +
-  <div class="csl-entry">---. <i>N.E.2d</i> 1989: 386.</div> +
-  <div class="csl-entry">---. <i>N.Y.S.2d</i> 1989: 357.</div> +
-  <div class="csl-entry">Razlogova, Elena. “Radio and Astonishment: The Emergence of Radio Sound, 1920-1926.” May 2002.</div> +
-  <div class="csl-entry">---. “True Crime Radio and Listener Disenchantment with Network Broadcasting, 1935-1946.” <i>American Quarterly</i> 58 (2006): 137-158.</div> +
-  <div class="csl-entry">Razlogova, Elena, and Lisa Lynch. “The Guantanamobile Project.” <i>Vectors</i> 1 (2005).</div> +
-  <div class="csl-entry">Zelle, Rintze M. et al. “Key Process Conditions for Production of C&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt; Dicarboxylic Acids in Bioreactor Batch Cultures of an Engineered &amp;lt;i&amp;gt;Saccharomyces cerevisiae&amp;lt;/i&amp;gt; Strain.” <i>Applied and Environmental Microbiology</i> 76.3 (2010): 744-750.</div> +
-  <div class="csl-entry">梶田将司 et al. “高等教育機関における次世代教育学習支援プラットフォームの構築に向けて.” <i>日本教育工学会論文誌</i> Dec. 2007: 297-305.</div> +
-  <div class="csl-entry">“民法.”</div> +
-</div></code>+
dev/citeproc-node.txt · Last modified: 2017/11/12 19:53 by 127.0.0.1