@iebh/polyglot 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -31,26 +31,26 @@ var _global = _interopRequireDefault(require("./modules/global.js"));
31
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
32
32
  var polyglot;
33
33
  var _default = polyglot = {
34
- /**
35
- * Translate the given query using the given engine ID
36
- * This is really just a wrapper for the parse() + engine[ENGINE].compile() pipeline
37
- * Output will be run via preProcess() + postProcess()
38
- * @param {string} query The query to translate
39
- * @param {string} engine The ID of the engine to use
40
- * @param {Object} options Optional options structure to pass to the engine
41
- * @return {string} The translated search query
34
+ /**
35
+ * Translate the given query using the given engine ID
36
+ * This is really just a wrapper for the parse() + engine[ENGINE].compile() pipeline
37
+ * Output will be run via preProcess() + postProcess()
38
+ * @param {string} query The query to translate
39
+ * @param {string} engine The ID of the engine to use
40
+ * @param {Object} options Optional options structure to pass to the engine
41
+ * @return {string} The translated search query
42
42
  */
43
43
  translate: function translate(query, engine, options) {
44
44
  var tree = (0, _parse.parse)(query, options);
45
45
  return polyglot.postProcess(_generic["default"].compile(_lodash["default"].cloneDeep(tree), options, engine), options);
46
46
  },
47
- /**
48
- * Translate the given query using all the supported engines
49
- * Calling this function instead of individual 'translate()' calls is much more efficient as the tree needs to be compiled only once
50
- * Output will be run via preProcess() + postProcess()
51
- * @param {string} query The query to translate
52
- * @param {Object} options Optional options structure to pass to each engine
53
- * @return {Object} The translated search query in each case where the engine ID is the key of the object and the value is the translated string
47
+ /**
48
+ * Translate the given query using all the supported engines
49
+ * Calling this function instead of individual 'translate()' calls is much more efficient as the tree needs to be compiled only once
50
+ * Output will be run via preProcess() + postProcess()
51
+ * @param {string} query The query to translate
52
+ * @param {Object} options Optional options structure to pass to each engine
53
+ * @return {Object} The translated search query in each case where the engine ID is the key of the object and the value is the translated string
54
54
  */
55
55
  translateAll: function translateAll(query, options) {
56
56
  var output = {};
@@ -62,12 +62,12 @@ var _default = polyglot = {
62
62
  output['lexicalTreeJSON'] = _engines["default"].lexicalTreeJSON.compile(tree, options), options;
63
63
  return output;
64
64
  },
65
- /**
66
- * Pre-proess the compile tree before it gets handed to each engines compile function
67
- * @param {Object} tree The tree to compile
68
- * @param {Object} [options] Additional options - these are provided downstream from the parent 'parse()' function
69
- * @return {Object} The mutated tree
70
- * @see parse()
65
+ /**
66
+ * Pre-proess the compile tree before it gets handed to each engines compile function
67
+ * @param {Object} tree The tree to compile
68
+ * @param {Object} [options] Additional options - these are provided downstream from the parent 'parse()' function
69
+ * @return {Object} The mutated tree
70
+ * @see parse()
71
71
  */
72
72
  preProcess: function preProcess(tree, options) {
73
73
  var settings = _lodash["default"].defaults(options, {});
@@ -76,18 +76,18 @@ var _default = polyglot = {
76
76
 
77
77
  return tree;
78
78
  },
79
- /**
80
- * Post process the data from an engine
81
- * This function applies the following behaviours:
82
- * - If HTML is true all `\n` characters are replaced with `<br/>`
83
- * - If HTML is false all <span> item wrappers are removed
84
- * @param {string} text The output from the engine - called from translate() / translateAll()
85
- * @param {Object} options Options provided during post-processing - these are provided downstream from the parent 'parse()' function
86
- * @param {boolean} [options.forceString] Force the output to be a string even if the module returns something unusual (e.g. mongodb driver returns an object)
87
- * @param {boolean} [options.html=true] Provide HTML output
88
- * @param {boolean} [options.trim=true] Trim all output lines
89
- * @returns {string} The post processed text
90
- * @see parse()
79
+ /**
80
+ * Post process the data from an engine
81
+ * This function applies the following behaviours:
82
+ * - If HTML is true all `\n` characters are replaced with `<br/>`
83
+ * - If HTML is false all <span> item wrappers are removed
84
+ * @param {string} text The output from the engine - called from translate() / translateAll()
85
+ * @param {Object} options Options provided during post-processing - these are provided downstream from the parent 'parse()' function
86
+ * @param {boolean} [options.forceString] Force the output to be a string even if the module returns something unusual (e.g. mongodb driver returns an object)
87
+ * @param {boolean} [options.html=true] Provide HTML output
88
+ * @param {boolean} [options.trim=true] Trim all output lines
89
+ * @returns {string} The post processed text
90
+ * @see parse()
91
91
  */
92
92
  postProcess: function postProcess(text, options) {
93
93
  var settings = _lodash["default"].defaults(options, {
@@ -27,19 +27,32 @@ var _default = {
27
27
  id: 'generic',
28
28
  title: 'generic',
29
29
  aliases: ['generic', 'g'],
30
- /**
31
- * Compile a tree structure to PubMed output
32
- * @param {array} tree The parsed tree to process
33
- * @param {Object} [options] Optional options to use when compiling
34
- * @param {boolean} [options.replaceWildcards=true] Whether to replace wildcard characters (usually '?' or '$') within phrase nodes with this engines equivelent
35
- * @return {string} The compiled output
30
+ /**
31
+ * Compile a tree structure to PubMed output
32
+ * @param {array} tree The parsed tree to process
33
+ * @param {Object} [options] Optional options to use when compiling
34
+ * @param {boolean} [options.replaceWildcards=true] Whether to replace wildcard characters (usually '?' or '$') within phrase nodes with this engines equivelent
35
+ * @return {string} The compiled output
36
36
  */
37
37
  compile: function compile(tree, options, engine) {
38
38
  var settings = _lodash["default"].defaults(options, {
39
39
  replaceWildcards: true,
40
40
  testing: false
41
41
  });
42
+
43
+ // Collapse a run of duplicate `$N OR $N+1 OR ...` clauses (Ovid's limited-truncation enumeration, e.g.
44
+ // `$2 OR $3 OR $4`) into just the first one - every target engine other than Ovid MEDLINE renders every
45
+ // `dollarNum` the same way ('*'), so the rest are redundant once translated.
46
+ var collapseDollarNumRuns = function collapseDollarNumRuns(tree) {
47
+ return tree.reduce(function (acc, branch, i) {
48
+ var isRedundant = branch.type === 'joinOr' && tree[i - 1] && tree[i - 1].type === 'dollarNum' && tree[i + 1] && tree[i + 1].type === 'dollarNum';
49
+ var continuesRun = branch.type === 'dollarNum' && tree[i - 1] && tree[i - 1].type === 'joinOr' && tree[i - 2] && tree[i - 2].type === 'dollarNum';
50
+ if (!isRedundant && !continuesRun) acc.push(branch);
51
+ return acc;
52
+ }, []);
53
+ };
42
54
  var compileWalker = function compileWalker(tree) {
55
+ if (engine !== 'Ovid MEDLINE') tree = collapseDollarNumRuns(tree);
43
56
  return tree.map(function (branch, branchIndex) {
44
57
  var buffer = '';
45
58
  switch (branch.type) {
@@ -316,7 +329,15 @@ var _default = {
316
329
  buffer += 'OR';
317
330
  break;
318
331
  case 'joinNot':
319
- buffer += 'NOT';
332
+ switch (engine) {
333
+ case 'WoS Advanced':
334
+ case 'Scopus (basic search)':
335
+ case 'Lilacs':
336
+ buffer += 'AND NOT';
337
+ break;
338
+ default:
339
+ buffer += 'NOT';
340
+ }
320
341
  break;
321
342
  case 'raw':
322
343
  buffer += branch.content;
@@ -353,7 +374,6 @@ var _default = {
353
374
  }
354
375
  break;
355
376
  case 'dollarNum':
356
- console.log("Here1", branch, engine, buffer);
357
377
  switch (engine) {
358
378
  case 'PubMed full':
359
379
  case 'PubMed abbreviation':
@@ -385,7 +405,6 @@ var _default = {
385
405
  }
386
406
  break;
387
407
  case 'template':
388
- console.log("Here2", branch.content, engine, buffer);
389
408
  buffer += _tools["default"].resolveTemplate(branch.content, engine);
390
409
  break;
391
410
  case 'comment':
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
- /**
8
- * Collection of supported engines
9
- * Each engine should specify:
10
- * title - Human readable name of the engine
11
- * aliases - Alternative names for each engine
12
- * compile() - function that takes a parsed tree array and returns a string (string can contain HTML markup of the form <span class="black-underline" v-tooltip="message"> content </span>)
13
- * open() - optional function that takes a query and provides the direct searching method
14
- * debugging - optional boolean specifying that the engine is for debugging purposes only
15
- *
16
- * @var {array}
7
+ /**
8
+ * Collection of supported engines
9
+ * Each engine should specify:
10
+ * title - Human readable name of the engine
11
+ * aliases - Alternative names for each engine
12
+ * compile() - function that takes a parsed tree array and returns a string (string can contain HTML markup of the form <span class="black-underline" v-tooltip="message"> content </span>)
13
+ * open() - optional function that takes a query and provides the direct searching method
14
+ * debugging - optional boolean specifying that the engine is for debugging purposes only
15
+ *
16
+ * @var {array}
17
17
  */
18
18
  var _default = {
19
19
  // Lexical tree (JSON) {{{
@@ -24,11 +24,11 @@ var _default = {
24
24
  debugging: true,
25
25
  // Mark this module for debugging only
26
26
 
27
- /**
28
- * Compile a tree structure to JSON output
29
- * @param {array} tree The parsed tree to process
30
- * @param {Object} [options] Optional options to use when compiling
31
- * @return {string} The compiled output
27
+ /**
28
+ * Compile a tree structure to JSON output
29
+ * @param {array} tree The parsed tree to process
30
+ * @param {Object} [options] Optional options to use when compiling
31
+ * @return {string} The compiled output
32
32
  */
33
33
  compile: function compile(tree, options) {
34
34
  return tree;
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  // File contains global variables
8
8
  var _default = {
9
- /**
10
- * List of example search queries
11
- * See tests/examples.js for the outputs in each case
12
- * @var {array}
9
+ /**
10
+ * List of example search queries
11
+ * See tests/examples.js for the outputs in each case
12
+ * @var {array}
13
13
  */
14
14
  examples: [{
15
15
  title: 'Failure of antibiotic prescribing for bacterial infections',
@@ -35,13 +35,13 @@ var _default = {
35
35
  no_field_tag: [] // Stores offsets for phrases with no field tags (for replacement)
36
36
  },
37
37
 
38
- /**
39
- * List of templates
40
- * Each key is the (case insensitive; specify in lowercase) keyword used in angular brackets
41
- * Each value is an object containing 'name', 'description', 'debugging' and an engines object with an additional 'default' key
42
- * @var {Object}
43
- * @example
44
- * {rct: {engines: {default: 'foo', ovid: 'bar'}}} // `<rct>` => 'foo' in most databases and 'bar' in Ovid MEDLINE
38
+ /**
39
+ * List of templates
40
+ * Each key is the (case insensitive; specify in lowercase) keyword used in angular brackets
41
+ * Each value is an object containing 'name', 'description', 'debugging' and an engines object with an additional 'default' key
42
+ * @var {Object}
43
+ * @example
44
+ * {rct: {engines: {default: 'foo', ovid: 'bar'}}} // `<rct>` => 'foo' in most databases and 'bar' in Ovid MEDLINE
45
45
  */
46
46
  // TODO: Update templates to match new engines
47
47
  templates: {
@@ -17,17 +17,17 @@ function escapeRegExp(string) {
17
17
  return string.replace(/[.*+?^${}()[\]\\]/g, '\\$&'); // $& means the whole matched string
18
18
  }
19
19
 
20
- /**
21
- * Parse a given string into a lexical object tree
22
- * This tree can then be recompiled via each engines compile()
23
- * @param {string} query The query string to compile. This can be multiline
24
- * @param {Object} [options] Optional options to use when parsing
25
- * @param {boolean} [options.groupLines=false] Wrap lines inside their own groups (only applies if multiple lines are present)
26
- * @param {boolean} [options.groupLinesAlways=true] Group lines even if there is only one apparent line (i.e. enclose single line queries within brackets)
27
- * @param {boolean} [options.transposeLines=true] Insert all line references where needed (e.g. `1 - 3/OR`)
28
- * @param {boolean} [options.removeNumbering=true] Remove any number prefixes from lines - this is a classic copy/paste error from certain online search engines (e.g. `1. Term` -> `term`)
29
- * @param {boolean} [options.preserveNewlines=true] Preserve newlines in the output as 'raw' tree nodes
30
- * @return {array} Array representing the parsed tree nodes
20
+ /**
21
+ * Parse a given string into a lexical object tree
22
+ * This tree can then be recompiled via each engines compile()
23
+ * @param {string} query The query string to compile. This can be multiline
24
+ * @param {Object} [options] Optional options to use when parsing
25
+ * @param {boolean} [options.groupLines=false] Wrap lines inside their own groups (only applies if multiple lines are present)
26
+ * @param {boolean} [options.groupLinesAlways=true] Group lines even if there is only one apparent line (i.e. enclose single line queries within brackets)
27
+ * @param {boolean} [options.transposeLines=true] Insert all line references where needed (e.g. `1 - 3/OR`)
28
+ * @param {boolean} [options.removeNumbering=true] Remove any number prefixes from lines - this is a classic copy/paste error from certain online search engines (e.g. `1. Term` -> `term`)
29
+ * @param {boolean} [options.preserveNewlines=true] Preserve newlines in the output as 'raw' tree nodes
30
+ * @return {array} Array representing the parsed tree nodes
31
31
  */
32
32
  var parse = function parse(query, options) {
33
33
  var settings = _lodash["default"].defaults(options, {
@@ -81,9 +81,9 @@ var parse = function parse(query, options) {
81
81
  // }}}
82
82
 
83
83
  // Utility functions {{{
84
- /**
85
- * Trim previous leaf content if it has any text
86
- * The leaf will be removed completely if it is now blank
84
+ /**
85
+ * Trim previous leaf content if it has any text
86
+ * The leaf will be removed completely if it is now blank
87
87
  */
88
88
  function trimLastLeaf() {
89
89
  if (leaf && _lodash["default"].includes(['phrase', 'raw'], leaf.type) && / $/.test(leaf.content)) {
@@ -92,9 +92,9 @@ var parse = function parse(query, options) {
92
92
  }
93
93
  }
94
94
  ;
95
- /**
96
- * End the previous line branch and create a new one
97
- * this function is run every time a new raw node is inserted
95
+ /**
96
+ * End the previous line branch and create a new one
97
+ * this function is run every time a new raw node is inserted
98
98
  */
99
99
  function newLine(currentNumber) {
100
100
  lastGroup = branch;
@@ -571,7 +571,26 @@ var parse = function parse(query, options) {
571
571
  if ((_lodash["default"].isUndefined(leaf) || _lodash["default"].isArray(leaf)) && nextChar != ' ') {
572
572
  // Leaf pointing to array entity - probably not created fallback leaf to append to
573
573
  // if (/^["“”]$/.test(nextChar) && (match = /^["“”](.*?)["“”]/.exec(q))) { // First character is a speachmark - slurp until we see the next one
574
- if (/^["“”'‘’]$/.test(nextChar) && (match = /^["“”'‘’](.*?)["“”'‘’]/.exec(q))) {
574
+ /*if (/^["“”'‘’]$/.test(nextChar) && (match = /^["“”'‘’](.*?)["“”'‘’]/.exec(q))) {
575
+ leaf = { type: 'phrase', content: match[1], offset: offset };
576
+ branch.nodes.push(leaf);
577
+ offset += match[0].length;
578
+ q = q.substr(match[0].length);
579
+ cropString = false;
580
+ }*/
581
+ if (/^["“”]/.test(nextChar) && (match = /^["“”](.*?)["“”]/.exec(q))) {
582
+ leaf = {
583
+ type: 'phrase',
584
+ content: match[1],
585
+ offset: offset
586
+ };
587
+ branch.nodes.push(leaf);
588
+ offset += match[0].length;
589
+ q = q.substr(match[0].length);
590
+ cropString = false;
591
+ }
592
+ //match = /^['‘’](.*?)['‘’]/.exec(q)
593
+ else if (/^['‘’]/.test(nextChar) && (match = /^['\u2018\u2019]((?:(?:[\0-&\(-\u2017\u201A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])|['\u2019](?=(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930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DF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])))*)['\u2018\u2019]/.exec(q))) {
575
594
  leaf = {
576
595
  type: 'phrase',
577
596
  content: match[1],
@@ -7,19 +7,19 @@ exports["default"] = void 0;
7
7
  var _global = _interopRequireDefault(require("./global.js"));
8
8
  var _lodash = _interopRequireDefault(require("lodash"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
- /**
11
- * Collection of utility functions to apply common behaviour to a compiled tree
12
- * @var {Object}
10
+ /**
11
+ * Collection of utility functions to apply common behaviour to a compiled tree
12
+ * @var {Object}
13
13
  */
14
14
  var tools = {
15
- /**
16
- * Visit the given node types within a deeply nested tree and run a function
17
- * This function may mutate the input tree depending on the actions of the callbacks
18
- * NOTE: If the return value of the callback is `"DEL"` the node is deleted
19
- * @param {array} tree The tree sturcture to operate on
20
- * @param {null|array} types Node filter to apply to (if falsy all are used)
21
- * @param {function} callback The callback to call with each node. Called as (node, path)
22
- * @return {array} The input tree
15
+ /**
16
+ * Visit the given node types within a deeply nested tree and run a function
17
+ * This function may mutate the input tree depending on the actions of the callbacks
18
+ * NOTE: If the return value of the callback is `"DEL"` the node is deleted
19
+ * @param {array} tree The tree sturcture to operate on
20
+ * @param {null|array} types Node filter to apply to (if falsy all are used)
21
+ * @param {function} callback The callback to call with each node. Called as (node, path)
22
+ * @return {array} The input tree
23
23
  */
24
24
  visit: function visit(tree, types, callback) {
25
25
  var removals = []; // Stack of removal paths we are performing when done
@@ -49,13 +49,13 @@ var tools = {
49
49
  });
50
50
  return tree;
51
51
  },
52
- /**
53
- * Apply a series of text replacements to every matching node object within a tree
54
- * This function mutates tree
55
- * @param {array} tree The tree sturcture to operate on
56
- * @param {null|array} types Type filter to apply. If falsy all are used
57
- * @param {array} replacements Array of replacements to apply. Each must be of the form `{subject: STRING|REGEXP, value: STRING|FUNCTION}`
58
- * @return {array} The input tree element with the replacements applied
52
+ /**
53
+ * Apply a series of text replacements to every matching node object within a tree
54
+ * This function mutates tree
55
+ * @param {array} tree The tree sturcture to operate on
56
+ * @param {null|array} types Type filter to apply. If falsy all are used
57
+ * @param {array} replacements Array of replacements to apply. Each must be of the form `{subject: STRING|REGEXP, value: STRING|FUNCTION}`
58
+ * @return {array} The input tree element with the replacements applied
59
59
  */
60
60
  replaceContent: function replaceContent(tree, types, replacements) {
61
61
  this.visit(tree, types, function (branch) {
@@ -83,12 +83,12 @@ var tools = {
83
83
  return text;
84
84
  }
85
85
  },
86
- /**
87
- * Retrieve the contents of a template by its ID
88
- * NOTE: If the specific engine definition is not found 'default' is used (and it will be pre-parsed via .translate())
89
- * @param {string} template The template to resolve
90
- * @param {string} engine The current engine (used to get the correct sub-templating string)
91
- * @return {string} The resolved template
86
+ /**
87
+ * Retrieve the contents of a template by its ID
88
+ * NOTE: If the specific engine definition is not found 'default' is used (and it will be pre-parsed via .translate())
89
+ * @param {string} template The template to resolve
90
+ * @param {string} engine The current engine (used to get the correct sub-templating string)
91
+ * @return {string} The resolved template
92
92
  */
93
93
  resolveTemplate: function resolveTemplate(template, engine) {
94
94
  if (!_global["default"].templates[template]) return 'UNKNOWN-TEMPLATE:' + template;
@@ -97,11 +97,11 @@ var tools = {
97
97
  if (!_global["default"].templates[template].engines[engine]) return "Template: \"".concat(template, "\" not found for engine: \"").concat(engine, "\"");
98
98
  return '';
99
99
  },
100
- /**
101
- * Structure the wild cards correctly for cochrane to ensure no wildcards appear inside quotation marks
102
- * @param {string} text The text to parse
103
- * @param {Boolean} highlighting Whether to assign custom fonts
104
- * @return {string} The parsed string seperated by NEXT
100
+ /**
101
+ * Structure the wild cards correctly for cochrane to ensure no wildcards appear inside quotation marks
102
+ * @param {string} text The text to parse
103
+ * @param {Boolean} highlighting Whether to assign custom fonts
104
+ * @return {string} The parsed string seperated by NEXT
105
105
  */
106
106
  wildCardCochrane: function wildCardCochrane(text, highlighting) {
107
107
  var wildcards = ["?", "$", "*"];
@@ -141,11 +141,11 @@ var tools = {
141
141
  }
142
142
  return foundMatch ? "(".concat(words.join(" "), ")") : words.join(" ");
143
143
  },
144
- /**
145
- * Print number in format defined by engine
146
- * @param {string} engine Engine to use
147
- * @param {string} ref Branch ref (e.g. 1)
148
- * @return {string} Formatted number
144
+ /**
145
+ * Print number in format defined by engine
146
+ * @param {string} engine Engine to use
147
+ * @param {string} ref Branch ref (e.g. 1)
148
+ * @return {string} Formatted number
149
149
  */
150
150
  printNumber: function printNumber(engine, ref) {
151
151
  // Get line number format for engine
@@ -179,12 +179,12 @@ var tools = {
179
179
  }
180
180
  return number;
181
181
  },
182
- /**
183
- * Determine if a phrase needs to be enclosed within speachmarks and return the result
184
- * @param {Object} branch Phrase branch to examine
185
- * @param {string} engine Optional engine ID to examine for other enclose methods
186
- * @param {boolean} highlighting Optional bool to determine if html color styling is added
187
- * @return {string} The phrase enclosed as needed
182
+ /**
183
+ * Determine if a phrase needs to be enclosed within speachmarks and return the result
184
+ * @param {Object} branch Phrase branch to examine
185
+ * @param {string} engine Optional engine ID to examine for other enclose methods
186
+ * @param {boolean} highlighting Optional bool to determine if html color styling is added
187
+ * @return {string} The phrase enclosed as needed
188
188
  */
189
189
  quotePhrase: function quotePhrase(branch, engine, settings) {
190
190
  var text = _lodash["default"].trimEnd(branch.content);
@@ -202,10 +202,16 @@ var tools = {
202
202
  '#': settings.highlighting ? tools.createTooltip("*", "As PubMed does not single character wildcards a wildcard is used here", "highlight") : '*'
203
203
  };
204
204
  break;
205
- case 'Lilacs':
206
205
  case 'Ovid MEDLINE':
207
206
  break;
208
207
  // Nothing needed
208
+ case 'Lilacs':
209
+ replaceObj = {
210
+ '$': '*',
211
+ '?': '*',
212
+ '#': '*'
213
+ };
214
+ break;
209
215
  case 'Cochrane Library':
210
216
  if (space) {
211
217
  text = tools.wildCardCochrane(text, settings.highlighting);
@@ -220,6 +226,7 @@ var tools = {
220
226
  return tools.multiReplace(text, replaceObj);
221
227
  // Return here to prevent duplicate quotes
222
228
  case 'Embase (Elsevier)':
229
+ text = text.replace(/['\u2019](?=(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\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\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF]))/g, ' '); // Change apostrophe to a space
223
230
  replaceObj = {
224
231
  '$': '*',
225
232
  '?': '$',
@@ -312,11 +319,11 @@ var tools = {
312
319
  }
313
320
  return engine == 'Embase (Elsevier)' ? space ? settings.highlighting ? "<font color='DarkBlue'>'" + text + "'</font>" : "'" + text + "'" : text : space ? settings.highlighting ? '<font color="DarkBlue">"' + text + '"</font>' : '"' + text + '"' : text;
314
321
  },
315
- /**
316
- * Convert the '$or' / '$and' nodes within a tree into a nested structure
317
- * This function will also flatten identical branches (i.e. run-on multiple $and / $or into one array)
318
- * @param {Object} tree The object tree to recombine
319
- * @returns {Object} The recombined tree
322
+ /**
323
+ * Convert the '$or' / '$and' nodes within a tree into a nested structure
324
+ * This function will also flatten identical branches (i.e. run-on multiple $and / $or into one array)
325
+ * @param {Object} tree The object tree to recombine
326
+ * @returns {Object} The recombined tree
320
327
  */
321
328
  renestConditions: function renestConditions(tree) {
322
329
  if (!_lodash["default"].isArray(tree)) return tree; // Not an array - skip
@@ -340,17 +347,17 @@ var tools = {
340
347
  return res;
341
348
  }, []);
342
349
  },
343
- /**
344
- * Combine multiple run-on $and / $or conditional branches into one branch
345
- * This function is a companion function to renestConditions and should be called directly afterwards if needed
346
- * @param {Object} tree The tree to traverse
347
- * @param {Object} [options] Additional options to accept
348
- * @param {number} [options.depth=10] The maximum depth to traverse before giving up, set to 0 to infinitely recurse
349
- * @return {Object} The collapsed tree
350
- * @example
351
- * {left, joinAnd, right} => {joinAnd: [left, right]}
352
- * @example
353
- * {foo, joinOr, bar, joinOr, baz} => {joinOr: [foo, bar, baz]}
350
+ /**
351
+ * Combine multiple run-on $and / $or conditional branches into one branch
352
+ * This function is a companion function to renestConditions and should be called directly afterwards if needed
353
+ * @param {Object} tree The tree to traverse
354
+ * @param {Object} [options] Additional options to accept
355
+ * @param {number} [options.depth=10] The maximum depth to traverse before giving up, set to 0 to infinitely recurse
356
+ * @return {Object} The collapsed tree
357
+ * @example
358
+ * {left, joinAnd, right} => {joinAnd: [left, right]}
359
+ * @example
360
+ * {foo, joinOr, bar, joinOr, baz} => {joinOr: [foo, bar, baz]}
354
361
  */
355
362
  combineConditions: function combineConditions(tree, options) {
356
363
  var settings = _lodash["default"].defaults(options, {
@@ -400,19 +407,19 @@ var tools = {
400
407
  });
401
408
  return tree;
402
409
  },
403
- /**
404
- * Create a tooltip with a specified message
405
- * @param {string} content Content to append tooltip to
406
- * @param {string} message Message to contain inside tooltip
407
- * @param {string} css CSS class to use
410
+ /**
411
+ * Create a tooltip with a specified message
412
+ * @param {string} content Content to append tooltip to
413
+ * @param {string} message Message to contain inside tooltip
414
+ * @param {string} css CSS class to use
408
415
  */
409
416
  createTooltip: function createTooltip(content, message, css) {
410
417
  css = typeof css !== 'undefined' ? css : "black-underline";
411
418
  return "<span class=\"" + css + '" v-tooltip="`' + message + '`">' + content + '</span>';
412
419
  },
413
- /**
414
- * Create a popover with options to replace empty field tags with specified field tag
415
- * @param {string} content Content to append popover to
420
+ /**
421
+ * Create a popover with options to replace empty field tags with specified field tag
422
+ * @param {string} content Content to append popover to
416
423
  */
417
424
  createPopover: function createPopover(content, offset) {
418
425
  return '<v-popover offset="8" placement="right">' + '<span class="blue-underline">' + content + '</span>' + '<template slot="popover">' + '<h3 class="popover-header">Add Field Tag</h3>' + '<input class="tooltip-content" v-model="customField" placeholder="Field tag" />' + '<div class="replace-all">' + '<input type="checkbox" id="checkbox" v-model="replaceAll">' + '<label for="checkbox">Replace All</label>' + '</div>' + '<div class="replace-buttons">' + '<button v-on:click="replaceFields(customField, replaceAll, ' + offset + ')" type="button" class="btn btn-primary">Replace</button>' + '<button v-close-popover type="button" class="btn btn-dark">Close</button>' + '</div>' + '</template>' + '</v-popover>';