summaryrefslogtreecommitdiff
path: root/pandoc-cs1
diff options
context:
space:
mode:
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') ) {