Browse Source

Added 'Letter' publication type to parser

spficklin 11 years ago
parent
commit
b1d1e48b01
1 changed files with 47 additions and 3 deletions
  1. 47 3
      tripal_pub/api/tripal_pub.api.inc

+ 47 - 3
tripal_pub/api/tripal_pub.api.inc

@@ -1169,13 +1169,16 @@ function tripal_pub_create_citation($pub) {
       if ($ptype == 'Journal Article' ) {
         $pub_type = $ptype;
         break;
-      } else if ($ptype == 'Conference Proceedings'){ 
+      } 
+      else if ($ptype == 'Conference Proceedings'){ 
         $pub_type = $ptype;
         break;
-      } else if ($ptype == 'Book') {
+      } 
+      else if ($ptype == 'Book') {
         $pub_type = $ptype;
         break;
-      } else if ($ptype == 'Book Chapter') {
+      } 
+      else if ($ptype == 'Book Chapter') {
         $pub_type = $ptype;
         break;
       }
@@ -1231,6 +1234,47 @@ function tripal_pub_create_citation($pub) {
     $citation .= '.';
   }
   //----------------------
+  // Letter
+  //----------------------
+  elseif ($pub_type == 'Letter') {
+    $citation = $pub['Authors'] . '. ' . $pub['Title'] .  '. ';
+  
+    if ($pub['Journal Name']) {
+      $citation .= $pub['Journal Name'] . '. ';
+    }
+    elseif ($pub['Journal Abbreviation']) {
+      $citation .= $pub['Journal Abbreviation'] . '. ';
+    }
+    elseif ($pub['Series Name']) {
+      $citation .= $pub['Series Name'] . '. ';  
+    }
+    elseif ($pub['Series Abbreviation']) {
+      $citation .= $pub['Series Abbreviation'] . '. ';
+    }
+    if ($pub['Publication Date']) {
+      $citation .= $pub['Publication Date'];
+    }
+    elseif ($pub['Year']) {
+      $citation .= $pub['Year'];
+    }
+    if ($pub['Volume'] or $pub['Issue'] or $pub['Pages']) {
+      $citation .= '; ';
+    }
+    if ($pub['Volume']) {
+      $citation .= $pub['Volume'];
+    }
+    if ($pub['Issue']) {
+      $citation .= '(' . $pub['Issue'] . ')';
+    }
+    if ($pub['Pages']) {
+      if($pub['Volume']) {
+        $citation .= ':';
+      }
+      $citation .= $pub['Pages'];
+    }
+    $citation .= '.';
+  }
+  //----------------------
   // Book
   //----------------------
   elseif ($pub_type == 'Book') {