explore-services/sample-components/sampleComponent-2/src/app/home/home.component.ts

109 lines
42 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {Component} from '@angular/core';
import {Router} from '@angular/router';
import {Observable} from 'rxjs/Observable';
import {Location} from '@angular/common';
declare var Cite:CiteType;
declare var fs:any;
declare var module:any;
declare var child_process:any;
declare var simpleSys:Function;
interface CiteType {
set:Function;
get:Function;
setOptions:Function;
}
@Component({
selector: 'home',
templateUrl: 'home.component.html',
})
export class HomeComponent {
styles:string[]=["bibtex","chicago","ieee","science","apa","cell","harvard","mla","nature","acm"];
selectedStyle:string = "bibtex";
citation:string="";
constructor ( private _router: Router, private location: Location) {
// var fs = require('fs');
// if(typeof document !== undefined) {
// var citeproc = require("citeproc-js-node");
//
// var sys = citeproc.simpleSys();
// // Wherever your locale and style files are. None are included with the package.
// var enUS = '<?xml version="1.0" encoding="utf-8"?> <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="en-US"> <info> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> <updated>2015-10-10T23:31:02+00:00</updated> </info> <style-options punctuation-in-quote="true"/> <date form="text"> <date-part name="month" suffix=" "/> <date-part name="day" suffix=", "/> <date-part name="year"/> </date> <date form="numeric"> <date-part name="month" form="numeric-leading-zeros" suffix="/"/> <date-part name="day" form="numeric-leading-zeros" suffix="/"/> <date-part name="year"/> </date> <terms> <term name="accessed">accessed</term> <term name="and">and</term> <term name="and others">and others</term> <term name="anonymous">anonymous</term> <term name="anonymous" form="short">anon.</term> <term name="at">at</term> <term name="available at">available at</term> <term name="by">by</term> <term name="circa">circa</term> <term name="circa" form="short">c.</term> <term name="cited">cited</term> <term name="edition"> <single>edition</single> <multiple>editions</multiple> </term> <term name="edition" form="short">ed.</term> <term name="et-al">et al.</term> <term name="forthcoming">forthcoming</term> <term name="from">from</term> <term name="ibid">ibid.</term> <term name="in">in</term> <term name="in press">in press</term> <term name="internet">internet</term> <term name="interview">interview</term> <term name="letter">letter</term> <term name="no date">no date</term> <term name="no date" form="short">n.d.</term> <term name="online">online</term> <term name="presented at">presented at the</term> <term name="reference"> <single>reference</single> <multiple>references</multiple> </term> <term name="reference" form="short"> <single>ref.</single> <multiple>refs.</multiple> </term> <term name="retrieved">retrieved</term> <term name="scale">scale</term> <term name="version">version</term> <!-- ANNO DOMINI; BEFORE CHRIST --> <term name="ad">AD</term> <term name="bc">BC</term> <!-- PUNCTUATION --> <term name="open-quote">“</term> <term name="close-quote">”</term> <term name="open-inner-quote"></term> <term name="close-inner-quote"></term> <term name="page-range-delimiter"></term> <!-- ORDINALS --> <term name="ordinal">th</term> <term name="ordinal-01">st</term> <term name="ordinal-02">nd</term> <term name="ordinal-03">rd</term> <term name="ordinal-11">th</term> <term name="ordinal-12">th</term> <term name="ordinal-13">th</term> <!-- LONG ORDINALS --> <term name="long-ordinal-01">first</term> <term name="long-ordinal-02">second</term> <term name="long-ordinal-03">third</term> <term name="long-ordinal-04">fourth</term> <term name="long-ordinal-05">fifth</term> <term name="long-ordinal-06">sixth</term> <term name="long-ordinal-07">seventh</term> <term name="long-ordinal-08">eighth</term> <term name="long-ordinal-09">ninth</term> <term name="long-ordinal-10">tenth</term> <!-- LONG LOCATOR FORMS --> <term name="book"> <single>book</single> <multiple>books</multiple> </term> <term name="chapter"> <single>chapter</single> <multiple>chapters</multiple> </term> <term name="column"> <single>column</single> <multiple>columns</multiple> </term> <term name="figure"> <single>figure</single> <multiple>figures</multiple> </term> <term name="folio"> <single>folio</single> <multiple>folios</multiple> </term> <term name="issue"> <single>number</single> <multiple>numbers</multiple> </term> <term name="line"> <single>line</single> <multiple>lines</multiple> </term> <term name="note"> <single>note</single> <multiple>notes</multiple> </term> <term name="opus"> <single>opus</single> <multiple>opera</multiple> </term> <term name="page"> <single>page</single> <multiple>pages</multiple> </term> <term name="number-of-pages"> <single>page</single> <multiple>pages</multiple> </term> <term name="paragraph"> <single>paragraph</single> <multiple>paragraphs</multiple> </term> <term name="part"> <single>part</single> <multiple>parts</multiple> </term> <term name="section"> <single>section</single> <multiple>sections</multiple> </term> <term name="sub verbo"> <single>sub verbo</single> <multiple>sub verbis</multiple> </term> <term name="verse"> <single>verse</single> <multiple>verses</multiple> </term> <term name="volume"> <single>volume</single> <multiple>volumes</multiple> </term> <!-- SHORT LOCATOR FORMS --> <term name="book" form="short"> <single>bk.</single> <multiple>bks.</multiple> </term> <term name="chapter" form="short"> <single>chap.</single> <multiple>chaps.</multiple> </term> <term name="column" form="short"> <single>col.</single> <multiple>cols.</multiple> </term> <term name="figure" form="short"> <single>fig.</single> <multiple>figs.</multiple> </term> <term name="folio" form="short"> <single>fol.</single> <multiple>fols.</multiple> </term> <term name="issue" form="short"> <single>no.</single> <multiple>nos.</multiple> </term> <term name="line" form="short"> <single>l.</single> <multiple>ll.</multiple> </term> <term name="note" form="short"> <single>n.</single> <multiple>nn.</multiple> </term> <term name="opus" form="short"> <single>op.</single> <multiple>opp.</multiple> </term> <term name="page" form="short"> <single>p.</single> <multiple>pp.</multiple> </term> <term name="number-of-pages" form="short"> <single>p.</single> <multiple>pp.</multiple> </term> <term name="paragraph" form="short"> <single>para.</single> <multiple>paras.</multiple> </term> <term name="part" form="short"> <single>pt.</single> <multiple>pts.</multiple> </term> <term name="section" form="short"> <single>sec.</single> <multiple>secs.</multiple> </term> <term name="sub verbo" form="short"> <single>s.v.</single> <multiple>s.vv.</multiple> </term> <term name="verse" form="short"> <single>v.</single> <multiple>vv.</multiple> </term> <term name="volume" form="short"> <single>vol.</single> <multiple>vols.</multiple> </term> <!-- SYMBOL LOCATOR FORMS --> <term name="paragraph" form="symbol"> <single>¶</single> <multiple>¶¶</multiple> </term> <term name="section" form="symbol"> <single>§</single> <multiple>§§</multiple> </term> <!-- LONG ROLE FORMS --> <term name="director"> <single>director</single> <multiple>directors</multiple> </term> <term name="editor"> <single>editor</single> <multiple>editors</multiple> </term> <term name="editorial-director"> <single>editor</single> <multiple>editors</multiple> </term> <term name="illustrator"> <single>illustrator</single> <multiple>illustrators</multiple> </term> <term name="translator"> <single>translator</single> <multiple>translators</multiple> </term> <term name="editortranslator"> <single>editor &amp; translator</single> <multiple>editors &amp; translators</multiple> </term> <!-- SHORT ROLE FORMS --> <term name="director" form="short"> <single>dir.</single> <multiple>dirs.</multiple> </term> <term name="editor" form="short"> <single>ed.</single> <multiple>eds.</multiple> </term> <term name="editorial-director" form="short"> <single>ed.</single> <multiple>eds.</multiple> </term> <term name="illustrator" form="short"> <single>ill.</single> <multiple>ills.</multiple> </term> <term name="translator" form="short"> <single>tran.</single> <multiple>trans.</multiple> </term> <term name="editortranslator" form="short"> <single>ed. &amp; tran.</single> <multiple>eds. &amp; trans.</multiple> </term> <!-- VERB ROLE FORMS --> <term name="container-author" form="verb">by</term> <term name="director" form="verb">directed by</term> <term name="editor" form="verb">edited by</term> <term name="editorial-director" form="verb">edited by</term> <term name="illustrator" form="verb">illustrated by</term> <term name="interviewer" form="verb">interview by</term> <term name="recipient" form="verb">to</term> <term name="reviewed-author" form="verb">by</term> <term name="translator" form="verb">translated by</term> <term name="editortranslator" form="verb">edited &amp; translated by</term> <!-- SHORT VERB ROLE FORMS --> <term name="director" form="verb-short">dir. by</term> <term name="editor" form="verb-short">ed. by</term> <term name="editorial-director" form="verb-short">ed. by</term> <term name="illustrator" form="verb-short">illus. by</term> <term name="translator" form="verb-short">trans. by</term> <term name="editortranslator" form="verb-short">ed. &amp; trans. by</term> <!-- LONG MONTH FORMS --> <term name="month-01">January</term> <term name="month-02">February</term> <term name="month-03">March</term> <term name="month-04">April</term> <term name="month-05">May</term> <term name="month-06">June</term> <term name="month-07">July</term> <term name="month-08">August</term> <term name="month-09">September</term> <term name="month-10">October</term> <term name="month-11">November</term> <term name="month-12">December</term> <!-- SHORT MONTH FORMS --> <term name="month-01" form="short">Jan.</term> <term name="month-02" form="short">Feb.</term> <term name="month-03" form="short">Mar.</term> <term name="month-04" form="short">Apr.</term> <term name="month-05" form="short">May</term> <term name="month-06" form="short">Jun.</term> <term name="month-07" form="short">Jul.</term> <term name="month-08" form="short">Aug.</term> <term name="month-09" form="short">Sep.</term> <term name="month-10" form="short">Oct.</term> <term name="month-11" form="short">Nov.</term> <term name="month-12" form="short">Dec.</term> <!-- SEASONS --> <term name="season-01">Spring</term> <term name="season-02">Summer</term> <term name="season-03">Autumn</term> <term name="season-04">Winter</term> </terms> </locale> ';//fs.readFileSync('../home/locales-en-US.xml', 'utf8');
// sys.addLocale('en-US', enUS);
// var styleString = '<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US"> <info> <title>BibTeX generic citation style</title> <id>http://www.zotero.org/styles/bibtex</id> <link href="http://www.zotero.org/styles/bibtex" rel="self"/> <link href="http://www.bibtex.org/" rel="documentation"/> <author> <name>Markus Schaffner</name> </author> <contributor> <name>Richard Karnesky</name> <email>karnesky+zotero@gmail.com</email> <uri>http://arc.nucapt.northwestern.edu/Richard_Karnesky</uri> </contributor> <category citation-format="author-date"/> <category field="generic-base"/> <updated>2012-09-14T21:22:32+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <macro name="zotero2bibtexType"> <choose> <if type="bill book graphic legal_case legislation motion_picture report song" match="any"> <text value="book"/> </if> <else-if type="chapter paper-conference" match="any"> <text value="inbook"/> </else-if> <else-if type="article article-journal article-magazine article-newspaper" match="any"> <text value="article"/> </else-if> <else-if type="thesis" match="any"> <text value="phdthesis"/> </else-if> <else-if type="manuscript" match="any"> <text value="unpublished"/> </else-if> <else-if type="paper-conference" match="any"> <text value="inproceedings"/> </else-if> <else-if type="report" match="any"> <text value="techreport"/> </else-if> <else> <text value="misc"/> </else> </choose> </macro> <macro name="citeKey"> <group delimiter="_"> <text macro="author-short" text-case="lowercase"/> <text macro="issued-year"/> </group> </macro> <macro name="author-short"> <names variable="author"> <name form="short" delimiter="_" delimiter-precedes-last="always"/> <substitute> <names variable="editor"/> <names variable="translator"/> <choose> <if type="bill book graphic legal_case legislation motion_picture report song" match="any"> <text variable="title" form="short"/> </if> <else> <text variable="title" form="short"/> </else> </choose> </substitute> </names> </macro> <macro name="issued-year"> <date variable="issued"> <date-part name="year"/> </date> </macro> <macro name="issued-month"> <date variable="issued"> <date-part name="month" form="short" strip-periods="true"/> </date> </macro> <macro name="author"> <names variable="author"> <name sort-separator=", " delimiter=" and " delimiter-precedes-last="always" name-as-sort-order="all"/> <label form="long" text-case="capitalize-first"/> </names> </macro> <macro name="editor-translator"> <names variable="editor translator" delimiter=", "> <name sort-separator=", " delimiter=" and " delimiter-precedes-last="always" name-as-sort-order="all"/> <label form="long" text-case="capitalize-first"/> </names> </macro> <macro name="title"> <text variable="title"/> </macro> <macro name="number"> <text variable="issue"/> <text variable="number"/> </macro> <macro name="container-title"> <choose> <if type="chapter paper-conference" match="any"> <text variable="container-title" prefix=" booktitle={" suffix="}"/> </if> <else> <text variable="container-title" prefix=" journal={" suffix="}"/> </else> </choose> </macro> <macro name="publisher"> <choose> <if type="thesis"> <text variable="publisher" prefix=" school={" suffix="}"/> </if> <else-if type="report"> <text variable="publisher" prefix=" institution={" suffix="}"/> </else-if> <else> <text variable="publisher" prefix=" publisher={" suffix="}"/> </else> </choose> </macro> <macro name="pages"> <text variable="page"/> </macro> <macro name="edition"> <text variable="edition"/> </macro> <citation et-al-min="10" et-al-use-first="10" disambiguate-add-year-suffix="true" disambiguate-add-names="false" disambiguate-add-givenname="false" collapse="year"> <sort> <key macro="author"/> <key variable="issued"/> </sort> <layout delimiter="_"> <text macro="citeKey"/> </layout> </citation> <bibliography hanging-indent="false" et-al-min="10" et-al-use-first="10"> <sort> <key macro="author"/> <key variable="issued"/> </sort> <layout> <text macro="zotero2bibtexType" prefix=" @"/> <group prefix="{" suffix="}" delimiter=", "> <text macro="citeKey"/> <text variable="publisher-place" prefix=" place={" suffix="}"/> <!--Fix This--> <text variable="chapter-number" prefix=" chapter={" suffix="}"/> <!--Fix This--> <text macro="edition" prefix=" edition={" suffix="}"/> <!--Is this in CSL? <text variable="type" prefix=" type={" suffix="}"/>--> <text variable="collection-title" prefix=" series={" suffix="}"/> <text macro="title" prefix=" title={" suffix="}"/> <text variable="volume" prefix=" volume={" suffix="}"/> <!--Not in CSL<text variable="rights" prefix=" rights={" suffix="}"/>--> <text variable="ISBN" prefix=" ISBN={" suffix="}"/> <text variable="ISSN" prefix=" ISSN={" suffix="}"/> <!--Not in CSL <text variable="LCCN" prefix=" callNumber={" suffix="}"/>--> <text variable="archive_location" prefix=" archiveLocation={" suffix="}"/> <text variable="URL" prefix=" url={" suffix="}"/> <text variable="DOI" prefix=" DOI={" suffix="}"/> <text variable="abstract" prefix=" abstractNote={" suffix="}"/> <text variable="note" prefix=" note={" suffix="}"/> <text macro="number" prefix=" number={" suffix="}"/> <text macro="container-title"/> <text macro="publisher"/> <text macro="author" prefix=" author={" suffix="}"/> <text macro="editor-translator" prefix=" editor={" suffix="}"/> <text macro="issued-year" prefix=" year={" suffix="}"/> <text macro="issued-month" prefix=" month={" suffix="}"/> <text macro="pages" prefix=" pages={" suffix="}"/> <text variable="collection-title" prefix=" collection={" suffix="}"/> </group> </layout> </bibliography> </style>';//fs.readFileSync('../home/bibtex.csl', 'utf8');
// var engine = sys.newEngine(styleString, 'en-US', null);
//
// var items = {"14058/RN9M5BF3":{"accessed":{"month":"9","year":"2010","day":"10"},"id":"14058/RN9M5BF3","author":[{"given":"Adel","family":"Hendaoui"},{"given":"Moez","family":"Limayem"},{"given":"Craig W.","family":"Thompson"}],"title":"3D Social Virtual Worlds: <i>Research Issues and Challenges</i>","type":"article-journal","versionNumber":6816},"14058/NSBERGDK":{"accessed":{"month":"9","year":"2010","day":"10"},"issued":{"month":"6","year":"2009"},"event-place":"Istanbul","type":"paper-conference","DOI":"10.1109/DEST.2009.5276761","page-first":"151","id":"14058/NSBERGDK","title-short":"3D virtual worlds as collaborative communities enriching human endeavours","publisher-place":"Istanbul","author":[{"given":"C.","family":"Dreher"},{"given":"T.","family":"Reiners"},{"given":"N.","family":"Dreher"},{"given":"H.","family":"Dreher"}],"title":"3D virtual worlds as collaborative communities enriching human endeavours: Innovative applications in e-Learning","shortTitle":"3D virtual worlds as collaborative communities enriching human endeavours","page":"151-156","event":"2009 3rd IEEE International Conference on Digital Ecosystems and Technologies (DEST)","URL":"http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=5276761","versionNumber":1}};
//
// sys.items = items;
//
// var clusters = [
// {
// citationItems: ["14058/RN9M5BF3"],
// properties: {
// note:0
// }
// },
// {
// citationItems: ["14058/NSBERGDK"],
// properties: {
// note:0
// }
// },
// ];
//
// engine.updateItems(Object.keys(items));
// var bib = engine.makeBibliography();
// console.log(bib[1]);
// this.citation =bib[1];
// }
var data= '[ { "id": "Q23571040", "type": "article-journal", "title": "Correlation of the Base Strengths of Amines 1", "DOI": "10.1021/ja01577a030", "author": [ { "given": "H. K.", "family": "Hall" } ], "issued": [ { "date-parts": [ "1957", "1", "1" ] } ], "container-title": "Journal of the American Chemical Society", "volume": "79", "issue": "20", "page": "5441-5444" } ]';
var Cite = require('../home/citation-0.2.js');
var opt = {
format: 'string',
type : 'string',
style : 'citation-apa',
lang : 'en-US'
};
// var Cite = require('citation-js');
var cite = new Cite(data, opt);
console.log("APA:"+cite.get());
opt = {
format: 'string',
type : 'string',
style : 'citation-harvard1',
lang : 'en-US'
};
cite = new Cite(data, opt);
// cite.set(data);
console.log("harvard1: "+cite.get());
var opt_template = {
format: 'string',
type : 'string',
style : 'citation-ieee',
lang : 'en-US',
template : '<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only"> <info> <title>IEEE (with URL)</title> <id>http://www.zotero.org/styles/ieee-with-url</id> <link href="http://www.zotero.org/styles/ieee-with-url" rel="self"/> <link href="http://www.ieee.org/documents/style_manual.pdf" rel="documentation"/> <link href="http://www.ieee.org/documents/auinfo07.pdf" rel="documentation"/> <author> <name>Michael Berkowitz</name> <email>mberkowi@gmu.edu</email> </author> <contributor> <name>Julian Onions</name> <email>julian.onions@gmail.com</email> </contributor> <contributor> <name>Rintze Zelle</name> <uri>http://twitter.com/rintzezelle</uri> </contributor> <contributor> <name>Stephen Frank</name> <uri>http://www.zotero.org/sfrank</uri> </contributor> <contributor> <name>Sebastian Karcher</name> </contributor> <category citation-format="numeric"/> <category field="engineering"/> <category field="generic-base"/> <updated>2012-10-18T22:38:43+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <locale xml:lang="en"> <terms> <term name="chapter" form="short">ch.</term> <term name="presented at">presented at the</term> <term name="available at">available</term> </terms> </locale> <!-- Macros --> <macro name="edition"> <choose> <if type="bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="any"> <choose> <if is-numeric="edition"> <group delimiter=" "> <number variable="edition" form="ordinal"/> <text term="edition" form="short"/> </group> </if> <else> <text variable="edition" text-case="capitalize-first" suffix="."/> </else> </choose> </if> </choose> </macro> <macro name="issued"> <choose> <if type="article-journal report" match="any"> <date variable="issued"> <date-part name="month" form="short" suffix=" "/> <date-part name="year" form="long"/> </date> </if> <else-if type=" bill book chapter graphic legal_case legislation motion_picture paper-conference song thesis" match="any"> <date variable="issued"> <date-part name="year" form="long"/> </date> </else-if> <else> <date variable="issued"> <date-part name="day" form="numeric-leading-zeros" suffix="-"/> <date-part name="month" form="short" suffix="-" strip-periods="true"/> <date-part name="year" form="long"/> </date> </else> </choose> </macro> <macro name="author"> <names variable="author"> <name initialize-with=". " delimiter=", " and="text"/> <label form="short" prefix=", " text-case="capitalize-first"/> <substitute> <names variable="editor"/> <names variable="translator"/> </substitute> </names> </macro> <macro name="editor"> <names variable="editor"> <name initialize-with=". " delimiter=", " and="text"/> <label form="short" prefix=", " text-case="capitalize-first"/> </names> </macro> <macro name="locators"> <group delimiter=", "> <text macro="edition"/> <group delimiter=" "> <text term="volume" form="short"/> <number variable="volume" form="numeric"/> </group> <group delimiter=" "> <number variable="number-of-volumes" form="numeric"/> <text term="volume" form="short" plural="true"/> </group> <group delimiter=" "> <text term="issue" form="short"/> <number variable="issue" form="numeric"/> </group> </group> </macro> <macro name="title"> <choose> <if type="bill book graphic legal_case legislation motion_picture song" match="any"> <text variable="title" font-style="italic"/> </if> <else> <text variable="title" quotes="true"/> </else> </choose> </macro> <macro name="publisher"> <choose> <if type=" bill book chapter graphic legal_case legislation motion_picture paper-conference song" match="any"> <group delimiter=": "> <text variable="publisher-place"/> <text variable="publisher"/> </group> </if> <else> <group delimiter=", "> <text variable="publisher"/> <text variable="publisher-place"/> </group> </else> </choose> </macro> <macro name="event"> <choose> <if type="paper-conference speech" match="any"> <choose> <!-- Published Conference Paper --> <if variable="container-title"> <group delimiter=", "> <group delimiter=" "> <text term="in"/> <text variable="container-title" font-style="italic"/> </group> <text variable="event-place"/> </group> </if> <!-- Unpublished Conference Paper --> <else> <group delimiter=", "> <group delimiter=" "> <text term="presented at"/> <text variable="event"/> </group> <text variable="event-place"/> </group> </else> </choose> </if> </choose> </macro> <macro name="access"> <choose> <if variable="URL"> <group delimiter=". "> <group delimiter=": "> <text term="available at" text-case="capitalize-first"/> <text variable="URL"/> </group> <group prefix="[" suffix="]" delimiter=": "> <text term="accessed" text-case="capitalize-first"/> <date variable="accessed"> <date-part name="day" form="numeric-leading-zeros" suffix="-"/> <date-part name="month" form="short" suffix="-" strip-periods="true"/> <date-part name="year" form="long"/> </date> </group> </group> </if> </choose> </macro> <macro name="page"> <group> <label variable="page" form="short" suffix=" "/> <text variable="page"/> </group> </macro> <macro name="citation-locator"> <group delimiter=" "> <choose> <if locator="page"> <label variable="locator" form="short"/> </if> <else> <label variable="locator" form="short" text-case="capitalize-first"/> </else> </choose> <text variable="locator"/> </group> </macro> <!-- Citation --> <citation collapse="citation-number"> <sort> <key variable="citation-number"/> </sort> <layout delimiter=", "> <group prefix="[" suffix="]" delimiter=", "> <text variable="citation-number"/> <text macro="citation-locator"/> </group> </layout> </citation> <!-- Bibliography --> <bibliography entry-spacing="0" second-field-align="flush"> <layout> <!-- Citation Number --> <text variable="citation-number" prefix="[" suffix="]"/> <!-- Author(s) --> <text macro="author" suffix=", "/> <!-- Rest of Citation --> <group suffix=". "> <choose> <!-- Specific Formats --> <if type="article-journal"> <group delimiter=", "> <text macro="title"/> <text variable="container-title" font-style="italic" form="short"/> <text macro="locators"/> <text macro="page"/> <text macro="issued"/> </group> </if> <else-if type="paper-conference"> <group delimiter=", "> <text macro="title"/> <text macro="event"/> <text macro="issued"/> <text macro="locators"/> <text macro="page"/> </group> </else-if> <else-if type="report"> <group delimiter=", "> <text macro="title"/> <text macro="publisher"/> <group delimiter=" "> <text variable="genre"/> <text variable="number"/> </group> <text macro="issued"/> </group> </else-if> <else-if type="thesis"> <group delimiter=", "> <text macro="title"/> <text variable="genre"/> <text macro="publisher"/> <text macro="issued"/> </group> </else-if> <else-if type="webpage"> <group delimiter=", " suffix=". "> <text macro="title"/> <text variable="container-title" font-style="italic"/> <text macro="issued"/> </group> </else-if> <else-if type="patent"> <text macro="title" suffix=", "/> <text variable="number"/> <text macro="issued"/> </else-if> <!-- Generic/Fallback Formats --> <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any"> <group delimiter=", " suffix=". "> <text macro="title"/> <text macro="locators"/> </group> <group delimiter=", "> <text macro="publisher"/> <text macro="issued"/> <text macro="page"/> </group> </else-if> <else-if type="article-magazine article-newspaper broadcast interview manuscript map patent personal_communication song speech thesis webpage" match="any"> <group delimiter=", "> <text macro="title"/> <text variable="container-title" font-style="italic"/> <text macro="locators"/> <text macro="publisher"/> <text macro="page"/> <text macro="issued"/> </group> </else-if> <else-if type="chapter paper-conference" match="any"> <group delimiter=", " suffix=", "> <text macro="title"/> <group delimiter=" "> <text term="in"/> <text variable="container-title" font-style="italic"/> </group> <text macro="locators"/> </group> <text macro="editor" suffix=" "/> <group delimiter=", "> <text macro="publisher"/> <text macro="issued"/> <text macro="page"/> </group> </else-if> <else> <group delimiter=", " suffix=". "> <text macro="title"/> <text variable="container-title" font-style="italic"/> <text macro="locators"/> </group> <group delimiter=", "> <text macro="publisher"/> <text macro="page"/> <text macro="issued"/> </group> </else> </choose> <choose> <if variable="URL"> <text value=" [Online]"/> </if> </choose> </group> <text macro="access"/> </layout> </bibliography> </style> '
};
// var opt = { format: 'string', type : 'string', style : 'citation-<NAME>', lang : 'en-US', template : <XML_CSL> };
var cite_template = new Cite(data, opt_template);
cite_template.set(data);
console.log("IEEE: "+cite_template.get());
}
bibtex:string =`<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US"> <info> <title>BibTeX generic citation style</title> <id>http://www.zotero.org/styles/bibtex</id> <link href="http://www.zotero.org/styles/bibtex" rel="self"/> <link href="http://www.bibtex.org/" rel="documentation"/> <author> <name>Markus Schaffner</name> </author> <contributor> <name>Richard Karnesky</name> <email>karnesky+zotero@gmail.com</email> <uri>http://arc.nucapt.northwestern.edu/Richard_Karnesky</uri> </contributor> <category citation-format="author-date"/> <category field="generic-base"/> <updated>2012-09-14T21:22:32+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <macro name="zotero2bibtexType"> <choose> <if type="bill book graphic legal_case legislation motion_picture report song" match="any"> <text value="book"/> </if> <else-if type="chapter paper-conference" match="any"> <text value="inbook"/> </else-if> <else-if type="article article-journal article-magazine article-newspaper" match="any"> <text value="article"/> </else-if> <else-if type="thesis" match="any"> <text value="phdthesis"/> </else-if> <else-if type="manuscript" match="any"> <text value="unpublished"/> </else-if> <else-if type="paper-conference" match="any"> <text value="inproceedings"/> </else-if> <else-if type="report" match="any"> <text value="techreport"/> </else-if> <else> <text value="misc"/> </else> </choose> </macro> <macro name="citeKey"> <group delimiter="_"> <text macro="author-short" text-case="lowercase"/> <text macro="issued-year"/> </group> </macro> <macro name="author-short"> <names variable="author"> <name form="short" delimiter="_" delimiter-precedes-last="always"/> <substitute> <names variable="editor"/> <names variable="translator"/> <choose> <if type="bill book graphic legal_case legislation motion_picture report song" match="any"> <text variable="title" form="short"/> </if> <else> <text variable="title" form="short"/> </else> </choose> </substitute> </names> </macro> <macro name="issued-year"> <date variable="issued"> <date-part name="year"/> </date> </macro> <macro name="issued-month"> <date variable="issued"> <date-part name="month" form="short" strip-periods="true"/> </date> </macro> <macro name="author"> <names variable="author"> <name sort-separator=", " delimiter=" and " delimiter-precedes-last="always" name-as-sort-order="all"/> <label form="long" text-case="capitalize-first"/> </names> </macro> <macro name="editor-translator"> <names variable="editor translator" delimiter=", "> <name sort-separator=", " delimiter=" and " delimiter-precedes-last="always" name-as-sort-order="all"/> <label form="long" text-case="capitalize-first"/> </names> </macro> <macro name="title"> <text variable="title"/> </macro> <macro name="number"> <text variable="issue"/> <text variable="number"/> </macro> <macro name="container-title"> <choose> <if type="chapter paper-conference" match="any"> <text variable="container-title" prefix=" booktitle={" suffix="}"/> </if> <else> <text variable="container-title" prefix=" journal={" suffix="}"/> </else> </choose> </macro> <macro name="publisher"> <choose> <if type="thesis"> <text variable="publisher" prefix=" school={" suffix="}"/> </if> <else-if type="report"> <text variable="publisher" prefix=" institution={" suffix="}"/> </else-if> <else> <text variable="publisher" prefix=" publisher={" suffix="}"/> </else> </choose> </macro> <macro name="pages"> <text variable="page"/> </macro> <macro name="edition"> <text variable="edition"/> </macro> <citation et-al-min="10" et-al-use-first="10" disambiguate-add-year-suffix="true" disambiguate-add-names="false" disambiguate-add-givenname="false" collapse="year"> <sort> <key macro="author"/> <key variable="issued"/> </sort> <layout delimiter="_"> <text macro="citeKey"/> </layout> </citation> <bibliography hanging-indent="false" et-al-min="10" et-al-use-first="10"> <sort> <key macro="author"/> <key variable="issued"/> </sort> <layout> <text macro="zotero2bibtexType" prefix=" @"/> <group prefix="{" suffix="}" delimiter=", "> <text macro="citeKey"/> <text variable="publisher-place" prefix=" place={" suffix="}"/> <!--Fix This--> <text variable="chapter-number" prefix=" chapter={" suffix="}"/> <!--Fix This--> <text macro="edition" prefix=" edition={" suffix="}"/> <!--Is this in CSL? <text variable="type" prefix=" type={" suffix="}"/>--> <text variable="collection-title" prefix=" series={" suffix="}"/> <text macro="title" prefix=" title={" suffix="}"/> <text variable="volume" prefix=" volume={" suffix="}"/> <!--Not in CSL<text variable="rights" prefix=" rights={" suffix="}"/>--> <text variable="ISBN" prefix=" ISBN={" suffix="}"/> <text variable="ISSN" prefix=" ISSN={" suffix="}"/> <!--Not in CSL <text variable="LCCN" prefix=" callNumber={" suffix="}"/>--> <text variable="archive_location" prefix=" archiveLocation={" suffix="}"/> <text variable="URL" prefix=" url={" suffix="}"/> <text variable="DOI" prefix=" DOI={" suffix="}"/> <text variable="abstract" prefix=" abstractNote={" suffix="}"/> <text variable="note" prefix=" note={" suffix="}"/> <text macro="number" prefix=" number={" suffix="}"/> <text macro="container-title"/> <text macro="publisher"/> <text macro="author" prefix=" author={" suffix="}"/> <text macro="editor-translator" prefix=" editor={" suffix="}"/> <text macro="issued-year" prefix=" year={" suffix="}"/> <text macro="issued-month" prefix=" month={" suffix="}"/> <text macro="pages" prefix=" pages={" suffix="}"/> <text variable="collection-title" prefix=" collection={" suffix="}"/> </group> </layout> </bibliography> </style> `;
ieee_csl:string =`<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only"> <info> <title>IEEE</title> <id>http://www.zotero.org/styles/ieee</id> <link href="http://www.zotero.org/styles/ieee" rel="self"/> <link href="http://www.ieee.org/documents/style_manual.pdf" rel="documentation"/> <link href="http://www.ieee.org/documents/auinfo07.pdf" rel="documentation"/> <author> <name>Michael Berkowitz</name> <email>mberkowi@gmu.edu</email> </author> <contributor> <name>Julian Onions</name> <email>julian.onions@gmail.com</email> </contributor> <contributor> <name>Rintze Zelle</name> <uri>http://twitter.com/rintzezelle</uri> </contributor> <contributor> <name>Stephen Frank</name> <uri>http://www.zotero.org/sfrank</uri> </contributor> <contributor> <name>Sebastian Karcher</name> </contributor> <category citation-format="numeric"/> <category field="engineering"/> <category field="generic-base"/> <updated>2016-10-06T15:32:30+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <locale xml:lang="en"> <terms> <term name="chapter" form="short">ch.</term> <term name="presented at">presented at the</term> <term name="available at">available</term> </terms> </locale> <!-- Macros --> <macro name="edition"> <choose> <if type="bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="any"> <choose> <if is-numeric="edition"> <group delimiter=" "> <number variable="edition" form="ordinal"/> <text term="edition" form="short"/> </group> </if> <else> <text variable="edition" text-case="capitalize-first" suffix="."/> </else> </choose> </if> </choose> </macro> <macro name="issued"> <choose> <if type="article-journal report" match="any"> <date variable="issued"> <date-part name="month" form="short" suffix=" "/> <date-part name="year" form="long"/> </date> </if> <else-if type=" bill book chapter graphic legal_case legislation motion_picture paper-conference song thesis" match="any"> <date variable="issued"> <date-part name="year" form="long"/> </date> </else-if> <else> <date variable="issued"> <date-part name="day" form="numeric-leading-zeros" suffix="-"/> <date-part name="month" form="short" suffix="-" strip-periods="true"/> <date-part name="year" form="long"/> </date> </else> </choose> </macro> <macro name="author"> <names variable="author"> <name and="text" et-al-min="7" et-al-use-first="1" initialize-with=". "/> <label form="short" prefix=", " text-case="capitalize-first"/> <et-al font-style="italic"/> <substitute> <names variable="editor"/> <names variable="translator"/> </substitute> </names> </macro> <macro name="editor"> <names variable="editor"> <name initialize-with=". " delimiter=", " and="text"/> <label form="short" prefix=", " text-case="capitalize-first"/> </names> </macro> <macro name="locators"> <group delimiter=", "> <text macro="edition"/> <group delimiter=" "> <text term="volume" form="short"/> <number variable="volume" form="numeric"/> </group> <group delimiter=" "> <number variable="number-of-volumes" form="numeric"/> <text term="volume" form="short" plural="true"/> </group> <group delimiter=" "> <text term="issue" form="short"/> <number variable="issue" form="numeric"/> </group> </group> </macro> <macro name="title"> <choose> <if type="bill book graphic legal_case legislation motion_picture song" match="any"> <text variable="title" font-style="italic"/> </if> <else> <text variable="title" quotes="true"/> </else> </choose> </macro> <macro name="publisher"> <choose> <if type=" bill book chapter graphic legal_case legislation motion_picture paper-conference song" match="any"> <group delimiter=": "> <text variable="publisher-place"/> <text variable="publisher"/> </group> </if> <else> <group delimiter=", "> <text variable="publisher"/> <text variable="publisher-place"/> </group> </else> </choose> </macro> <macro name="event"> <choose> <if type="paper-conference speech" match="any"> <choose> <!-- Published Conference Paper --> <if variable="container-title"> <group delimiter=", "> <group delimiter=" "> <text term="in"/> <text variable="container-title" font-style="italic"/> </group> <text variable="event-place"/> </group> </if> <!-- Unpublished Conference Paper --> <else> <group delimiter=", "> <group delimiter=" "> <text term="presented at"/> <text variable="event"/> </group> <text variable="event-place"/> </group> </else> </choose> </if> </choose> </macro> <macro name="access"> <choose> <if type="webpage"> <choose> <if variable="URL"> <group delimiter=". "> <text term="online" prefix="[" suffix="]" text-case="capitalize-first"/> <group delimiter=": "> <text term="available at" text-case="capitalize-first"/> <text variable="URL"/> </group> <group prefix="[" suffix="]" delimiter=": "> <text term="accessed" text-case="capitalize-first"/> <date variable="accessed"> <date-part name="day" form="numeric-leading-zeros" suffix="-"/> <date-part name="month" form="short" suffix="-" strip-periods="true"/> <date-part name="year" form="long"/> </date> </group> </group> </if> </choose> </if> </choose> </macro> <macro name="page"> <group> <label variable="page" form="short" suffix=" "/> <text variable="page"/> </group> </macro> <macro name="citation-locator"> <group delimiter=" "> <choose> <if locator="page"> <label variable="locator" form="short"/> </if> <else> <label variable="locator" form="short" text-case="capitalize-first"/> </else> </choose> <text variable="locator"/> </group> </macro> <!-- Citation --> <citation collapse="citation-number"> <sort> <key variable="citation-number"/> </sort> <layout delimiter=", "> <group prefix="[" suffix="]" delimiter=", "> <text variable="citation-number"/> <text macro="citation-locator"/> </group> </layout> </citation> <!-- Bibliography --> <bibliography entry-spacing="0" second-field-align="flush"> <layout suffix="."> <!-- Citation Number --> <text variable="citation-number" prefix="[" suffix="]"/> <!-- Author(s) --> <text macro="author" suffix=", "/> <!-- Rest of Citation --> <choose> <!-- Specific Formats --> <if type="article-journal"> <group delimiter=", "> <text macro="title"/> <text variable="container-title" font-style="italic" form="short"/> <text macro="locators"/> <text macro="page"/> <text macro="issued"/> </group> </if> <else-if type="paper-conference speech" match="any"> <group delimiter=", "> <text macro="title"/> <text macro="event"/> <text macro="issued"/> <text macro="locators"/> <text macro="page"/> </group> </else-if> <else-if type="report"> <group delimiter=", "> <text macro="title"/> <text macro="publisher"/> <group delimiter=" "> <text variable="genre"/> <text variable="number"/> </group> <text macro="issued"/> </group> </else-if> <else-if type="thesis"> <group delimiter=", "> <text macro="title"/> <text variable="genre"/> <text macro="publisher"/> <text macro="issued"/> </group> </else-if> <else-if type="webpage post-weblog" match="any"> <group delimiter=", " suffix=". "> <text macro="title"/> <text variable="container-title" font-style="italic"/> <text macro="issued"/> </group> <text macro="access"/> </else-if> <else-if type="patent"> <group delimiter=", "> <text macro="title"/> <text variable="number"/> <text macro="issued"/> </group> </else-if> <!-- Generic/Fallback Formats --> <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any"> <group delimiter=", " suffix=". "> <text macro="title"/> <text macro="locators"/> </group> <group delimiter=", "> <text macro="publisher"/> <text macro="issued"/> <text macro="page"/> </group> </else-if> <else-if type="article-magazine article-newspaper broadcast interview manuscript map patent personal_communication song speech thesis webpage" match="any"> <group delimiter=", "> <text macro="title"/> <text variable="container-title" font-style="italic"/> <text macro="locators"/> <text macro="publisher"/> <text macro="page"/> <text macro="issued"/> </group> </else-if> <else-if type="chapter paper-conference" match="any"> <group delimiter=", " suffix=", "> <text macro="title"/> <group delimiter=" "> <text term="in"/> <text variable="container-title" font-style="italic"/> </group> <text macro="locators"/> </group> <text macro="editor" suffix=" "/> <group delimiter=", "> <text macro="publisher"/> <text macro="issued"/> <text macro="page"/> </group> </else-if> <else> <group delimiter=", " suffix=". "> <text macro="title"/> <text variable="container-title" font-style="italic"/> <text macro="locators"/> </group> <group delimiter=", "> <text macro="publisher"/> <text macro="page"/> <text macro="issued"/> </group> </else> </choose> </layout> </bibliography> </style> `;
}