1. Frank Bennett
  2. citeproc-js

Commits

Frank Bennett  committed 0a5b187

Fix title-short and container-title-short

  • Participants
  • Parent commits 687b8b8
  • Branches default

Comments (0)

Files changed (3)

File src/api_bibliography.js

View file
             for (i = 0, ilen = rule.triggers.length; i < ilen; i += 1) {
                 if (clonedItem[rule.triggers[i]]) {
                     delete clonedItem[rule.triggers[i]];
+                    if (rule.triggers[i] === "title-short") {
+                        delete clonedItem.shortTitle;
+                    }
+                    if (rule.triggers[i] === "container-title-short") {
+                        delete clonedItem.journalAbbreviation;
+                    }
                 }
             }
             // amend itemID (to the form set on genIDs fork)

File src/build.js

View file
 			Item.legislation_id = legislation_id.join("::");
         }
     }
+    // XXX Add getAbbreviation() call for title-short and container-title-short
+    Item["title-short"] = Item.shortTitle;
+    if (Item.title && this.sys.getAbbreviation) {
+        var jurisdiction = this.transform.loadAbbreviation(Item.jurisdiction, "title", Item.title);
+        if (this.transform.abbrevs[jurisdiction].title) {
+            if (this.transform.abbrevs[jurisdiction].title[Item.title]) {
+                Item["title-short"] = this.transform.abbrevs[jurisdiction].title[Item.title];
+            }
+        }
+    }
+    Item["container-title-short"] = Item.journalAbbreviation;
+    if (Item["container-title"] && this.sys.getAbbreviation) {
+        var jurisdiction = this.transform.loadAbbreviation(Item.jurisdiction, "title", Item["container-title"]);
+        if (this.transform.abbrevs[jurisdiction].title) {
+            if (this.transform.abbrevs[jurisdiction].title[Item["container-title"]]) {
+                Item["container-title-short"] = this.transform.abbrevs[jurisdiction].title[Item["container-title"]];
+            }
+        }
+    }
     return Item;
 };
 

File src/util_transform.js

View file
             myabbrev_family = "title";
         }
 
-        if (["title-short"].indexOf(myabbrev_family) > -1) {
-            myabbrev_family = "title";
-        }
-
         // Lazy retrieval of abbreviations.
         value = "";
         if (state.sys.getAbbreviation) {