Skip to content

Commit

Permalink
Fix braced-entry and add line-entry support for hack syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
fbennett committed Sep 21, 2016
1 parent f81698b commit 13d2bc9
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/load.js
Expand Up @@ -33,7 +33,7 @@

var CSL = {

PROCESSOR_VERSION: "1.1.131",
PROCESSOR_VERSION: "1.1.132",

CONDITION_LEVEL_TOP: 1,

Expand Down Expand Up @@ -264,19 +264,21 @@ var CSL = {
elems.push(m[i]);
}
elems.push(splt[splt.length-1])
for (var i=1,ilen=elems.length;i<ilen;i += 2) {
elems[i] = '\n' + elems[i].slice(2,-1).trim() + '\n';
}
elems = elems.join('').split('\n');
var names = {};
for (var i=1,ilen=elems.length;i<ilen;i+=2) {
var mm = elems[i].match(CSL.NOTE_FIELD_REGEXP);
for (var i=0,ilen=elems.length;i<ilen;i++) {
var line = elems[i];
var mm = line.match(CSL.NOTE_FIELD_REGEXP);
if (!mm) continue;
var key = mm[1];
var val = mm[2].replace(/^\s+/, "").replace(/\s+$/, "");
if (!Item[key]) {
if (!validFieldsForType || validFieldsForType[key]) {
if (CSL.DATE_VARIABLES.indexOf(key) > -1) {
Item[key] = {raw: val};
elems[i] = "";
} else {
Item[key] = val;
}
if (CSL.DATE_VARIABLES.indexOf(key) > -1) {
Item[key] = {raw: val};
elems[i] = "";
} else if (CSL.NAME_VARIABLES.indexOf(key) > -1) {
if (!names[key]) {
names[key] = [];
Expand All @@ -290,7 +292,10 @@ var CSL = {
names[key].push(name);
}
elems[i] = "";
} else {
Item[key] = val;
}

}
if (name === "type") {
Item.type = val;
Expand Down Expand Up @@ -437,7 +442,7 @@ var CSL = {
VIETNAMESE_NAMES: /^(?:(?:[.AaBbCcDdEeGgHhIiKkLlMmNnOoPpQqRrSsTtUuVvXxYy \u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]{2,6})(\s+|$))+$/,

NOTE_FIELDS_REGEXP: /\{:(?:[\-_a-z]+|[A-Z]+):[^\}]+\}/g,
NOTE_FIELD_REGEXP: /\{:([\-_a-z]+|[A-Z]+):\s*([^\}]+)\}/,
NOTE_FIELD_REGEXP: /^([\-_a-z]+|[A-Z]+):\s*([^\}]+)$/,

DISPLAY_CLASSES: ["block", "left-margin", "right-inline", "indent"],

Expand Down

0 comments on commit 13d2bc9

Please sign in to comment.