From 6c206e86ec8e18ccf5d67b1fc796c70764ba0297 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 31 Mar 2017 15:41:32 +0200 Subject: Use OSCOLA with no ibid as citation style. --- pandoc-cs1 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'pandoc-cs1') 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') ) { -- cgit v1.2.3