@ca-plant-list/ca-plant-list 0.3.1 → 0.3.2

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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "editor.formatOnSave": true
3
+ }
@@ -1,88 +1,96 @@
1
1
  {
2
- "Campanula exigua": {
3
- "rpi": {
4
- "translation-to-rpi": "Ravenella exigua"
5
- }
6
- },
7
- "Campanula sharsmithiae": {
8
- "rpi": {
9
- "translation-to-rpi": "Ravenella sharsmithiae"
10
- }
11
- },
12
- "Castilleja ambigua subsp. ambigua": {
13
- "rpi": {
14
- "translation-to-rpi": "Castilleja ambigua var. ambigua"
15
- }
16
- },
17
- "Castilleja ambigua var. ambigua": {
18
- "rpi": {
19
- "translation": "Castilleja ambigua subsp. ambigua"
20
- }
21
- },
22
- "Downingia ornatissima var. mirabilis": {
23
- "inat": {
24
- "notintaxondata": true
25
- }
26
- },
27
- "Erysimum capitatum var. angustatum": {
28
- "calflora": {
29
- "badjepsonid": true
2
+ "Campanula exigua": {
3
+ "rpi": {
4
+ "translation-to-rpi": "Ravenella exigua"
5
+ }
30
6
  },
31
- "jepson": {
32
- "allowsynonym": true
33
- }
34
- },
35
- "Heterotheca oregona var. rudis": {
36
- "inat": {
37
- "notintaxondata": true
38
- }
39
- },
40
- "Horkelia californica var. frondosa": {
41
- "inat": {
42
- "notintaxondata": true
43
- }
44
- },
45
- "Lupinus littoralis var. variicolor": {
46
- "inat": {
47
- "notintaxondata": true
48
- }
49
- },
50
- "Malacothamnus hallii": {
51
- "comment": "in CNPS Rare Plant Inventory",
52
- "calflora": {
53
- "notintaxondata": true
7
+ "Campanula sharsmithiae": {
8
+ "rpi": {
9
+ "translation-to-rpi": "Ravenella sharsmithiae"
10
+ }
54
11
  },
55
- "jepson": {
56
- "allowsynonym": true
57
- }
58
- },
59
- "Malacothamnus arcuatus var. elmeri": {
60
- "calflora": {
61
- "badjepsonid": true
62
- }
63
- },
64
- "Myosurus minimus subsp. apus": {
65
- "comment": "in CNPS Rare Plant Inventory",
66
- "jepson": {
67
- "notineflora": true
68
- }
69
- },
70
- "Ravenella exigua": {
71
- "rpi": {
72
- "translation": "Campanula exigua"
73
- }
74
- },
75
- "Ravenella sharsmithiae": {
76
- "rpi": {
77
- "translation": "Campanula sharsmithiae"
78
- }
79
- },
80
- "Streptanthus albidus subsp. peramoenus": {
81
- "calflora": {
82
- "notintaxondata": true
12
+ "Castilleja ambigua subsp. ambigua": {
13
+ "rpi": {
14
+ "translation-to-rpi": "Castilleja ambigua var. ambigua"
15
+ }
16
+ },
17
+ "Castilleja ambigua var. ambigua": {
18
+ "rpi": {
19
+ "translation": "Castilleja ambigua subsp. ambigua"
20
+ }
21
+ },
22
+ "Downingia ornatissima var. mirabilis": {
23
+ "inat": {
24
+ "notintaxondata": true
25
+ }
26
+ },
27
+ "Erysimum capitatum var. angustatum": {
28
+ "calflora": {
29
+ "badjepsonid": true
30
+ },
31
+ "jepson": {
32
+ "allowsynonym": true
33
+ }
34
+ },
35
+ "Heterotheca oregona var. rudis": {
36
+ "inat": {
37
+ "notintaxondata": true
38
+ }
39
+ },
40
+ "Horkelia californica var. frondosa": {
41
+ "inat": {
42
+ "notintaxondata": true
43
+ }
44
+ },
45
+ "Lupinus littoralis var. variicolor": {
46
+ "inat": {
47
+ "notintaxondata": true
48
+ }
49
+ },
50
+ "Malacothamnus hallii": {
51
+ "comment": "in CNPS Rare Plant Inventory",
52
+ "calflora": {
53
+ "notintaxondata": true
54
+ },
55
+ "jepson": {
56
+ "allowsynonym": true
57
+ },
58
+ "rpi": {
59
+ "translation": "Malacothamnus arcuatus var. elmeri"
60
+ }
61
+ },
62
+ "Malacothamnus arcuatus var. elmeri": {
63
+ "comment": "in CNPS Rare Plant Inventory as Malacothamnus hallii",
64
+ "calflora": {
65
+ "badjepsonid": true
66
+ },
67
+ "rpi": {
68
+ "translation-to-rpi": "Malacothamnus hallii"
69
+ }
70
+ },
71
+ "Myosurus minimus subsp. apus": {
72
+ "comment": "in CNPS Rare Plant Inventory",
73
+ "jepson": {
74
+ "notineflora": true
75
+ }
76
+ },
77
+ "Ravenella exigua": {
78
+ "comment": "in CNPS Rare Plant Inventory as Ravenella",
79
+ "rpi": {
80
+ "translation": "Campanula exigua"
81
+ }
82
+ },
83
+ "Ravenella sharsmithiae": {
84
+ "rpi": {
85
+ "translation": "Campanula sharsmithiae"
86
+ }
83
87
  },
84
- "jepson": {
85
- "allowsynonym": true
88
+ "Streptanthus albidus subsp. peramoenus": {
89
+ "calflora": {
90
+ "notintaxondata": true
91
+ },
92
+ "jepson": {
93
+ "allowsynonym": true
94
+ }
86
95
  }
87
- }
88
- }
96
+ }
package/data/taxa.csv CHANGED
@@ -1103,7 +1103,7 @@ Madia radiata,showy madia,N,4053,5296,77924,,,,1054,1B.1,,,S3,G3
1103
1103
  Madia sativa,coast tarweed,N,4055,5298,53143,yellow
1104
1104
  Maianthemum racemosum,false Solomon's seal,N,32495,10096,51062
1105
1105
  Maianthemum stellatum,,N,32497,9629,53268
1106
- Malacothamnus arcuatus var. elmeri,,N,108345,14681,1497404
1106
+ Malacothamnus arcuatus var. elmeri,,N,108345,14681,1497404,,,,1065,1B.2,,,S2,G2
1107
1107
  Malacothamnus fremontii,white-coat mallow,N,32524,5312,70397
1108
1108
  Malacothamnus hallii,,N,108345,14681,1497404,,,,1065,1B.2,,,S2,G2
1109
1109
  Malacothrix californica,,N,4059,5325,58026
@@ -1762,7 +1762,7 @@ Triglochin concinna var. concinna,slender arrow-grass,N,74018,8112,81439
1762
1762
  Triglochin maritima,seaside arrow-grass,N,47197,8114,60264
1763
1763
  Triglochin scilloides,flowering quillwort,N,91083,12117,79437
1764
1764
  Triglochin striata,,N,47201,8116,79438
1765
- Trillium chloropetalum,giant trillium,N,47218,8119,50823
1765
+ Trillium chloropetalum,giant trillium,N,47218,8119,50823,"yellow,pink,purple,white",4,5
1766
1766
  Trillium ovatum subsp. ovatum,white trillium,N,53276,8122,63972
1767
1767
  Triodanis biflora,Venus' looking-glass,N,47267,8126,79440
1768
1768
  Triphysaria eriantha subsp. eriantha,butter-and-eggs,N,53279,8129,59332
@@ -1 +1 @@
1
- Tissue between anther sacs purple. Ovaries purple.
1
+ Tissue between anther sacs purple, ovaries purple. In _T. albidum_, both ovaries and tissue between anther sacs are usually greenish.
package/lib/csv.js CHANGED
@@ -39,6 +39,12 @@ class CSV {
39
39
  return options;
40
40
  }
41
41
 
42
+ /**
43
+ * @param {string} dir
44
+ * @param {string} fileName
45
+ * @param {boolean|undefined} [columns]
46
+ * @param {string|undefined} [delimiter]
47
+ */
42
48
  static parseFile( dir, fileName, columns = true, delimiter ) {
43
49
  const content = fs.readFileSync( dir + "/" + fileName );
44
50
 
@@ -46,6 +52,13 @@ class CSV {
46
52
  return parseSync( content, options );
47
53
  }
48
54
 
55
+ /**
56
+ * @param {string} dir
57
+ * @param {string} fileName
58
+ * @param {boolean|undefined} columns
59
+ * @param {string|undefined} delimiter
60
+ * @param {*} callback
61
+ */
49
62
  static async parseStream( dir, fileName, columns = true, delimiter, callback ) {
50
63
  const options = this.#getOptions( fileName, columns, delimiter );
51
64
  const processFile = async () => {
package/lib/exceptions.js CHANGED
@@ -18,6 +18,8 @@ class Exceptions {
18
18
  const localExceptions = readConfig( dir + "/exceptions.json" );
19
19
  for ( const [ k, v ] of Object.entries( localExceptions ) ) {
20
20
  this.#exceptions[ k ] = v;
21
+ // Tag as a local exception so we can distinguish between global and local.
22
+ v.local = true;
21
23
  }
22
24
 
23
25
  }
package/lib/html.js CHANGED
@@ -52,8 +52,8 @@ export class HTML {
52
52
  * Generate HTML for an <a> element.
53
53
  * @param {string|undefined} href
54
54
  * @param {string} linkText
55
- * @param {Object} attributes
56
- * @param {boolean} openInNewWindow true if the link should open in a new window.
55
+ * @param {Object} [attributes]
56
+ * @param {boolean} [openInNewWindow] true if the link should open in a new window.
57
57
  * @returns {string} an HTML <a> element.
58
58
  */
59
59
  static getLink( href, linkText, attributes = {}, openInNewWindow ) {
package/lib/index.d.ts CHANGED
@@ -36,8 +36,21 @@ export class CSV {
36
36
  static "__#8@#getOptions"(fileName: any, columns: any, delimiter: any): {
37
37
  relax_column_count_less: boolean;
38
38
  };
39
- static parseFile(dir: any, fileName: any, columns: boolean, delimiter: any): any;
40
- static parseStream(dir: any, fileName: any, columns: boolean, delimiter: any, callback: any): Promise<void>;
39
+ /**
40
+ * @param {string} dir
41
+ * @param {string} fileName
42
+ * @param {boolean|undefined} [columns]
43
+ * @param {string|undefined} [delimiter]
44
+ */
45
+ static parseFile(dir: string, fileName: string, columns?: boolean | undefined, delimiter?: string | undefined): any;
46
+ /**
47
+ * @param {string} dir
48
+ * @param {string} fileName
49
+ * @param {boolean|undefined} columns
50
+ * @param {string|undefined} delimiter
51
+ * @param {*} callback
52
+ */
53
+ static parseStream(dir: string, fileName: string, columns: boolean | undefined, delimiter: string | undefined, callback: any): Promise<void>;
41
54
  }
42
55
  export class DateUtils {
43
56
  static getMonthName(monthNum: any): string;
@@ -118,8 +131,8 @@ export class GenericTaxaLoader {
118
131
  }
119
132
  import { ErrorLog } from "./errorlog.js";
120
133
  export namespace HTML_OPTIONS {
121
- const OPEN_NEW: number;
122
- const NO_ESCAPE: number;
134
+ let OPEN_NEW: number;
135
+ let NO_ESCAPE: number;
123
136
  }
124
137
  /** HTML utility functions. */
125
138
  export class HTML {
@@ -135,11 +148,11 @@ export class HTML {
135
148
  * Generate HTML for an &lt;a> element.
136
149
  * @param {string|undefined} href
137
150
  * @param {string} linkText
138
- * @param {Object} attributes
139
- * @param {boolean} openInNewWindow true if the link should open in a new window.
151
+ * @param {Object} [attributes]
152
+ * @param {boolean} [openInNewWindow] true if the link should open in a new window.
140
153
  * @returns {string} an HTML &lt;a> element.
141
154
  */
142
- static getLink(href: string | undefined, linkText: string, attributes: any, openInNewWindow: boolean): string;
155
+ static getLink(href: string | undefined, linkText: string, attributes?: any, openInNewWindow?: boolean): string;
143
156
  /**
144
157
  * Get a Bootstrap formatted tooltip element.
145
158
  * @param {string} text - The text or HTML that should trigger the tooltip on hover.
@@ -219,39 +232,44 @@ export class Taxa {
219
232
  getTaxon(name: any): any;
220
233
  getTaxonList(): any[];
221
234
  hasSynonym(formerName: any): boolean;
235
+ /**
236
+ * true if an inclusion list was supplied when reading the taxa.
237
+ * @returns {boolean}
238
+ */
239
+ isSubset(): boolean;
222
240
  #private;
223
241
  }
224
242
  export namespace TAXA_LIST_COLS {
225
243
  namespace CESA {
226
- const title: string;
244
+ let title: string;
227
245
  function data(t: any): any;
228
246
  }
229
247
  namespace COMMON_NAME {
230
- const title_1: string;
248
+ let title_1: string;
231
249
  export { title_1 as title };
232
250
  export function data_1(t: any): any;
233
251
  export { data_1 as data };
234
252
  }
235
253
  namespace CNPS_RANK {
236
- const title_2: string;
254
+ let title_2: string;
237
255
  export { title_2 as title };
238
256
  export function data_2(t: any): string;
239
257
  export { data_2 as data };
240
258
  }
241
259
  namespace FESA {
242
- const title_3: string;
260
+ let title_3: string;
243
261
  export { title_3 as title };
244
262
  export function data_3(t: any): any;
245
263
  export { data_3 as data };
246
264
  }
247
265
  namespace SPECIES {
248
- const title_4: string;
266
+ let title_4: string;
249
267
  export { title_4 as title };
250
268
  export function data_4(t: any): any;
251
269
  export { data_4 as data };
252
270
  }
253
271
  namespace SPECIES_BARE {
254
- const title_5: string;
272
+ let title_5: string;
255
273
  export { title_5 as title };
256
274
  export function data_5(t: any): any;
257
275
  export { data_5 as data };
@@ -273,10 +291,10 @@ export class TaxaProcessor {
273
291
  }
274
292
  import { TaxaLoader } from "./taxaloader.js";
275
293
  export namespace TAXA_COLNAMES {
276
- const BLOOM_START: string;
277
- const BLOOM_END: string;
278
- const COMMON_NAME: string;
279
- const FLOWER_COLOR: string;
294
+ let BLOOM_START: string;
295
+ let BLOOM_END: string;
296
+ let COMMON_NAME: string;
297
+ let FLOWER_COLOR: string;
280
298
  }
281
299
  export class Taxon {
282
300
  constructor(data: any);
package/lib/taxa.js CHANGED
@@ -11,6 +11,7 @@ const FLOWER_COLORS = [
11
11
  { name: "orange", color: "orange" },
12
12
  { name: "yellow", color: "yellow" },
13
13
  { name: "blue", color: "blue" },
14
+ { name: "purple", color: "purple" },
14
15
  ];
15
16
 
16
17
  const TAXA_LIST_COLS = {
@@ -76,9 +77,12 @@ class Taxa {
76
77
  #flower_colors = {};
77
78
  #sortedTaxa;
78
79
  #synonyms = new Set();
80
+ #isSubset;
79
81
 
80
82
  constructor( inclusionList, errorLog, showFlowerErrors, taxaMeta = {}, taxonClass = Taxon, extraTaxa = [], extraSynonyms = [] ) {
81
83
 
84
+ this.#isSubset = ( inclusionList !== true );
85
+
82
86
  this.#errorLog = errorLog;
83
87
 
84
88
  for ( const color of FLOWER_COLORS ) {
@@ -158,6 +162,14 @@ class Taxa {
158
162
  return this.#synonyms.has( formerName );
159
163
  }
160
164
 
165
+ /**
166
+ * true if an inclusion list was supplied when reading the taxa.
167
+ * @returns {boolean}
168
+ */
169
+ isSubset() {
170
+ return this.#isSubset;
171
+ }
172
+
161
173
  #loadSyns( synCSV, inclusionList ) {
162
174
  for ( const syn of synCSV ) {
163
175
  const currName = syn[ "Current" ];
@@ -1,9 +1,9 @@
1
- import { HTML } from "@ca-plant-list/ca-plant-list";
2
1
  import { Jepson } from "../jepson.js";
3
2
  import { RarePlants } from "../rareplants.js";
4
3
  import { GenericPage } from "../genericpage.js";
5
4
  import { ExternalSites } from "../externalsites.js";
6
5
  import { DateUtils } from "../dateutils.js";
6
+ import { HTML } from "../html.js";
7
7
 
8
8
  class PageTaxon extends GenericPage {
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ca-plant-list/ca-plant-list",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Tools to create Jekyll files for a website listing plants in an area of California.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,6 +36,6 @@
36
36
  "devDependencies": {
37
37
  "@types/node": "^18.11.9",
38
38
  "eslint": "^8.26.0",
39
- "typescript": "^4.9.3"
39
+ "typescript": "^5.3.3"
40
40
  }
41
- }
41
+ }