summaryrefslogtreecommitdiff
path: root/pandoc-cs1
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-03-31 15:41:32 +0200
committerJonas Smedegaard <dr@jones.dk>2017-03-31 21:52:10 +0200
commit6c206e86ec8e18ccf5d67b1fc796c70764ba0297 (patch)
tree0817ed9eb7cfd41c5f7aa61ebe555d1eb3c40d40 /pandoc-cs1
parent2e928d6b2f4a5f6011639ec437a5044830ffc84e (diff)
Use OSCOLA with no ibid as citation style.
Diffstat (limited to 'pandoc-cs1')
-rwxr-xr-xpandoc-cs132
1 files changed, 32 insertions, 0 deletions
diff --git a/pandoc-cs1 b/pandoc-cs1
index 0eafbc3..e5620c9 100755
--- a/pandoc-cs1
+++ b/pandoc-cs1
@@ -35,6 +35,38 @@ pandoc_filter sub {
'@'.$1.'{'.$id,
@data,
'}');
+ if ( ! $bibdata->get('author') ) {
+ my @authors;
+ for ( my $i = 1;; $i++ ) {
+ my ( $first, $last );
+ if ( $i == 1 and $bibdata->get('first') ) {
+ $first = $bibdata->get("first$i");
+ $bibdata->delete("first$i");
+ } elsif ( $bibdata->get("first$i") ) {
+ $first = $bibdata->get('first');
+ $bibdata->delete('first');
+ }
+ if ( $i == 1 and $bibdata->get('last') ) {
+ $last = $bibdata->get('last');
+ $bibdata->delete('last');
+ } elsif ( $bibdata->get("last$i") ) {
+ $last = $bibdata->get("last$i");
+ $bibdata->delete("last$i");
+ }
+ if ( $first and $last ) {
+ push @authors, "$first {$last}";
+ } elsif ($first) {
+ push @authors, $first;
+ } elsif ($last) {
+ push @authors, $last;
+ } else {
+ last;
+ }
+ }
+ if ( @authors > 0 ) {
+ $bibdata->set( 'author', join ( ' and ', @authors ) );
+ };
+ };
if ( $bibdata->type =~ /web/i ) {
$bibdata->set_type('online');
if ( my $urldate = $bibdata->get('accessdate') ) {