Skip to content

Instantly share code, notes, and snippets.

@njbart
njbart / date_TextFormFulldateDayRange-da-DK-rangedelimiter.txt
Created January 5, 2014 18:22
citeproc tests for localized date ranges
/*
* Copyright (c) 2009-2013 Frank G. Bennett, Jr. All Rights
* Reserved.
*
* The contents of this file are subject to the Common Public
* Attribution License Version 1.0 (the “License”); you may not use
* this file except in compliance with the License. You may obtain a
* copy of the License at:
*
* http://bitbucket.org/fbennett/citeproc-js/src/tip/LICENSE.
@njbart
njbart / cms-dates-sample-pandoc.md
Last active January 3, 2016 05:19
test files for pandoc-citeproc adapted from biblatex-chicago

\newcommand{\adddot}{.} \newcommand{\addcomma}{,}

The Chicago Author-Date Specification {#sec:spec .unnumbered}

[adapted from cms-dates-sample.tex from the biblatex-chicago package]

Important Note {#bibernote .unnumbered}

@njbart
njbart / gist:aa90d7994a94ef59d8b7
Created June 28, 2014 10:38
chicago-author-date-with-original-date-and-status.csl
<?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="never" page-range-format="chicago">
<info>
<title>Chicago Manual of Style 16th edition (author-date)</title>
<id>http://www.zotero.org/styles/chicago-author-date</id>
<link href="http://www.zotero.org/styles/chicago-author-date" rel="self"/>
<link href="http://www.chicagomanualofstyle.org/tools_citationguide.html" rel="documentation"/>
<author>
<name>Julian Onions</name>
<email>julian.onions@gmail.com</email>
pandoc -F pandoc-citeproc -t markdown-citations << EOT
# origdate
## CMoS examples, 16e 15.38
> (Austen [1813] 2003)
> (Darwin [1859] 1964)
<?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="never" page-range-format="chicago">
<info>
<title>Chicago Manual of Style 16th edition (author-date) modif 2014-06-30</title>
<id></id>
<link href="" rel="self"/>
<link href="http://www.chicagomanualofstyle.org/tools_citationguide.html" rel="documentation"/>
<author>
<name>Julian Onions</name>
<email>julian.onions@gmail.com</email>
pandoc -F pandoc-citeproc -t markdown-citations << EOT
Foo [@doe1].
Bar [@doe2].
Foo [@doe1].
Remove this line to see the problem [@doe2].
# References
---
@njbart
njbart / shortdoi.r
Created April 14, 2015 10:41
Replace DOIs by shortDOIs in CSL JSON
#! /usr/bin/env Rscript
library("jsonlite")
filename <- commandArgs(TRUE)[1]
bibdata <- fromJSON(filename, simplifyVector = FALSE, simplifyDataFrame = FALSE, simplifyMatrix = FALSE)
for (n in seq_along(bibdata)) {
if (exists('DOI', where=bibdata[[n]]))
[
{
"id": "x1",
"type": "chapter",
"title": "Firms and the welfare state: when, why, and how does social policy matter to employers?",
"container-title": "Varieties of capitalism: the institutional foundations of comparative advantage",
"publisher": "Oxford University Press",
"publisher-place": "Oxford",
"event-place": "Oxford",
"ISBN": "9780199247752",
@njbart
njbart / chicago-author-date-plus.csl
Created October 11, 2015 10:40
chicago-author-date-plus.csl = chicago-author-date.csl with volume-title
<?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="display-and-sort" page-range-format="chicago">
<info>
<title>Chicago Manual of Style 16th edition (author-date) plus</title>
<id>chicago-author-date-plus</id>
<!-- <link href="http://www.zotero.org/styles/chicago-author-date" rel="self"/>-->
<link href="http://www.chicagomanualofstyle.org/tools_citationguide.html" rel="documentation"/>
<author>
<name>Julian Onions</name>
<email>julian.onions@gmail.com</email>
<!DOCTYPE HTML>
<html>
<head>
<style>
.csl-bib-body { line-height: 1.35; }
.csl-entry { clear: left; }
.csl-block { }
.csl-left-margin { clear: left; float: left; width: 100px; }
.csl-right-inline { margin-left: 100px; }
.csl-indent { margin-left: 3em; }