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
dev:citation_styles:citeproc-node [2012/04/14 03:46] fbennettdev:citation_styles:citeproc-node [2017/11/27 04:21] (current) – Remove Zotero 5 warning bwiernik
Line 1: Line 1:
 +
 ====== Setting up the standalone citeproc-node server ====== ====== Setting up the standalone citeproc-node server ======
  
-1. Get citeproc-node+== Step ==
  
-<code bash>git clone https://github.com/fcheslack/citeproc-node</code> +Get citeproc-node
-<code bash>cd citeproc-node</code>+
  
-2. Get CSL 1.0 citation styles +<code bash>git clone https://github.com/zotero/citeproc-node.git 
-<code bash>git clone https://github.com/citation-style-language/styles.git</code>+cd citeproc-node</code>
  
-3. Move CSL styles to where citeproc-node can find them +-----
-<code bash>mv styles csl1.0</code>+
  
-4. Get citeproc-js +== Step 2 ==
-<code bash>hg clone https://bitbucket.org/fbennett/citeproc-js</code>+
  
-5Get sample data from citeproc-js +Fetch CSL 1.0 citation styles to where citeproc-node will find them 
-<code bash>mv citeproc-js/demo/sampledata.html .</code>+<code bash>git clone https://github.com/citation-style-language/styles.git csl</code>
  
-6. Remove citeproc-js directory +-----
-<code bash>rm -rf citeproc-js</code>+
  
-7. Get node-o3-xml processing library +== Step 3 ==
-<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: +Get CSL locale files
-<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 csl-locales</code>
-<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 Your directory listing is now
-<code bash>benchServer.js       COPYING        loadcitesnode.js  testciteproc.js +<code bash>citeprocmodule.js     csl                  sampledata.json 
-citeprocmodule.js    csl1.0         node-o3-xml       zoteronode.js +citeprocnode.js       cslFetcher.js        test 
-citeprocnode.js      cslFetcher.js  sampledata.html +citeprocnode-repl.js  csl-locales          testciteproc.js 
-citeServerConf.json  csl-locales    stdNodeTest.js +citeServerConf.json   csl_nodejs.js        zoteronode.js 
-citeServer.js        csl_nodejs.js  step.js</code>+citeServer.js         csl_nodejs_jsdom.js 
 +COPYING               node_modules</code>
  
-(csl1.0node-o3-xml, and csl-locales are all directories)+(cslcsl-localesnode_modules and test are all directories)
  
-10. Change configured path to xml library +-----
-<code bash>open config file:  vi citeServerConf.json</code>+
  
-change the line: +== Step 4 ==
- "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): +An attempt to start the server may yield this error (the command syntax shown below assumes the node binary  
-<code bash>node citeServer.js</code>+is in your path, of course):
  
-If all is well, you will see:+<code bash>node ./lib/citeServer.js 
 +... 
 +ErrorUnable to load shared library /blah/blah/contextify.node 
 +...</code>
  
-<code>debug log file :./citeServerLog.log +If so, follow the instructions at the top of the error message, which on a Linux system might read something like this:
-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 bash>To rebuild, go to the Contextify root folder and run  
 +'node-waf distclean && node-waf configure build'.</code>
  
-<code>engine created +So we do this:
-zcite.cacheSaveEngine +
-http://www.zotero.org/styles/chicago-author-date:en-US +
-saving engine +
-turn precache flag off +
-last Step</code>+
  
--------- +<code bash>cd node_modules/jsdom/node_modules/contextify/ 
-Now to test the server. Open another window and cd into your citeproc-node directory.+node-waf distclean &&  node-waf configure build</code>
  
-1. Edit the sampledata.html document to the expected JSON format to POST: +If the command gives an error the first time, try it again
-<code bash>vi sampledata.html</code> +If that does not help, try this while you are still in the contextify directory:
-get rid of the HTML markup at the top & bottom of the file+
  
-delete:+<code bash> 
 +cd .. && rm -r contextify 
 +git clone https://github.com/brianmcd/contextify.git 
 +cd contextify && npm rebuild</code>
  
-<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>; +== Step 5 ==
-</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:+Return to the top of the citeproc-node directory and attempt to run the server (again assuming that the node binary is in your path):
  
-<code>{ "items" :</code>+<code bash>node ./lib/citeServer.js</code>
  
-andof course, this as a last line:+If all is wellyou will see:
  
-<code>}</code>+<code>debug log file :./citeServerLog.log 
 +precaching CSL engines 
 +Server running at http://127.0.0.1:8085/ 
 +</code>
  
-3. Save this file as "sampledata.json"+-----
  
-4. Try posting it to your server (which you should still have running):+== Step 6 ==
  
-<code>curl --header "Content-type: application/json" --data @sampledata.json -X POST http://127.0.0.1:8085?responseformat=html\&style=mla</code>+Now to test the server using the sampledata.json file provided in the citeproc-node sources. Try posting it to your server (which you should still have running): 
 + 
 +<code>curl --header "Expect:nothing" --header "Content-type: application/json" --data @sampledata.json -X POST http://127.0.0.1:8085?responseformat=html\&style=modern-language-association</code> 
 + 
 +----- 
 + 
 +== Step 7 ==
  
 You should see this response appear on your screen: You should see this response appear on your screen:
  
 <code html><div class="csl-bib-body"> <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 acidscurrent status and challenges.” <i>FEMS Yeast Research</i> 9.8 (2009): 1123-1136.</div> +  <div class="csl-entry">Abbott, Derek A. et al. “Metabolic Engineering of <i>Saccharomyces Cerevisiae</ifor Production of Carboxylic AcidsCurrent Status and Challenges.” <i>FEMS Yeast Research</i> 9.8 (2009): 11231136. Print.</div> 
-  <div class="csl-entry">Beck v. Beck.” <i>ME</i> 1999: 110.</div> +  <div class="csl-entry"><i>Beck V. Beck</i>. Vol. 1999. 1999. Print.</div> 
-  <div class="csl-entry">---. <i>A.2d</i> 1999: 981.</div> +  <div class="csl-entry">---. Vol. 733. 1999. Print.</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">Bennett, Frank G., Jr. “Getting Property Right: ‘Informal’ Mortgages in the Japanese Courts.” <i>Pacific Rim Law &#38; Policy Journal</i> 18 (2009): 463509. Print.</div> 
-  <div class="csl-entry">British Columbia Elec. Ry. v. Loach.” <i>AppCas.</i> 1915: 719.</div> +  <div class="csl-entry"><i>British Columbia Elec. Ry. V. Loach</i>Vol. 1916. 1915. Print.</div> 
-  <div class="csl-entry">“Clayton Act.” <i>ch.</i> 1914.</div> +  <div class="csl-entry"><i>Clayton Act</i>1914. Print.</div> 
-  <div class="csl-entry">---. <i>Stat.</i> 1914: 730.</div> +  <div class="csl-entry">---. Vol. 38. 1914. Print.</div> 
-  <div class="csl-entry">Donoghue v. Stevenson.” <i>AppCas.</i> 1932: 562.</div> +  <div class="csl-entry"><i>Donoghue V. Stevenson</i>Vol. 1932. 1932. Print.</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">DArcus, Bruce. <i>Boundaries of Dissent: Protest and State Power in the Media Age</i>New York: Routledge, 2006. Print.</div> 
-  <div class="csl-entry">FTC Credit Practices Rule.” <i>C.F.R.</i> 1999.</div> +  <div class="csl-entry"><i>FTC Credit Practices Rule</i>Vol. 16. 1999Print.</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">Malone, Kemp. <i>Chapters on Chaucer</i>. Baltimore: Johns Hopkins Press, 1951. Print.</div> 
-  <div class="csl-entry">People v. Taylor.” <i>N.Y.2d</i> 1989: 683.</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>New York: Routledge, 2001. Print.</div> 
-  <div class="csl-entry">---. <i>N.E.2d</i> 1989: 386.</div> +  <div class="csl-entry"><i>People V. Taylor</i>Vol. 73. 1989. Print.</div> 
-  <div class="csl-entry">---. <i>N.Y.S.2d</i> 1989: 357.</div> +  <div class="csl-entry">---. Vol541. 1989. Print.</div> 
-  <div class="csl-entry">Razlogova, Elena. “Radio and Astonishment: The Emergence of Radio Sound, 1920-1926.” May 2002.</div> +  <div class="csl-entry">---. Vol5431989Print.</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. “Radio and Astonishment: The Emergence of Radio Sound, 1920-1926.” Society for Cinema Studies Annual Meeting. 2002.</div> 
-  <div class="csl-entry">Razlogova, Elena, and Lisa Lynch. “The Guantanamobile Project.” <i>Vectors</i> 1 (2005).</div> +  <div class="csl-entry">---. “True Crime Radio and Listener Disenchantment with Network Broadcasting, 1935-1946.” <i>American Quarterly</i> 58 (2006): 137158. Print.</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">Razlogova, Elena, and Lisa Lynch. “The Guantanamobile Project.” <i>Vectors</i> 1 (2005): n. pag. Print.</div> 
-  <div class="csl-entry">梶田将司 et al. “高等教育機関における次世代教育学習支援プラットフォームの構築に向けて.” <i>日本教育工学会論文誌</i> Dec. 2007: 297-305.</div> +  <div class="csl-entry">Zelle, Rintze M. et al. “Key Process Conditions for Production of C<sub>4</subDicarboxylic Acids in Bioreactor Batch Cultures of an Engineered <i>Saccharomyces Cerevisiae</iStrain.” <i>Applied and Environmental Microbiology</i> 76.3 (2010): 744750.</div> 
-  <div class="csl-entry">民法.</div>+  <div class="csl-entry">梶田将司 et al. “高等教育機関における次世代教育学習支援プラットフォームの構築に向けて.” <i>日本教育工学会論文誌</i> 31.3 (2007): 297305. Print.</div> 
 +  <div class="csl-entry"><i>民法</i>. Print.</div>
 </div></code> </div></code>
 +
 +-----
 +
 +== Step 8 ==
 +
 +And ... er ... //that's it//!
 +
dev/citation_styles/citeproc-node.1334389619.txt.gz · Last modified: 2012/04/14 03:46 by fbennett