@ca-plant-list/ca-plant-list 0.3.0 → 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
+ }
@@ -19,7 +19,7 @@
19
19
  "translation": "Castilleja ambigua subsp. ambigua"
20
20
  }
21
21
  },
22
- "Lupinus littoralis var. variicolor": {
22
+ "Downingia ornatissima var. mirabilis": {
23
23
  "inat": {
24
24
  "notintaxondata": true
25
25
  }
@@ -42,17 +42,40 @@
42
42
  "notintaxondata": true
43
43
  }
44
44
  },
45
- "Downingia ornatissima var. mirabilis": {
45
+ "Lupinus littoralis var. variicolor": {
46
46
  "inat": {
47
47
  "notintaxondata": true
48
48
  }
49
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
+ },
50
71
  "Myosurus minimus subsp. apus": {
72
+ "comment": "in CNPS Rare Plant Inventory",
51
73
  "jepson": {
52
- "notineflora": "in CNPS Rare Plant Inventory"
74
+ "notineflora": true
53
75
  }
54
76
  },
55
77
  "Ravenella exigua": {
78
+ "comment": "in CNPS Rare Plant Inventory as Ravenella",
56
79
  "rpi": {
57
80
  "translation": "Campanula exigua"
58
81
  }
package/data/synonyms.csv CHANGED
@@ -25,7 +25,7 @@ Achnatherum lemmonii subsp. lemmonii,Stipa lemmonii var. lemmonii
25
25
  Acmispon strigosus var. hirtellus,Acmispon strigosus
26
26
  Acroptilon repens,Rhaponticum repens
27
27
  Actaea rubra subsp. arguta,Actaea rubra
28
- Adelinia grande,Adelinia grandis,INAT
28
+ Adelinia grandis,Adelinia grandis,INAT
29
29
  Adiantum boreale,Adiantum aleuticum
30
30
  Adiantum pedatum subsp. calderi,Adiantum aleuticum
31
31
  Adiantum pedatum var. aleuticum,Adiantum aleuticum
@@ -832,6 +832,8 @@ Heracleum lanatum,Heracleum maximum
832
832
  Herniaria cinerea,Herniaria hirsuta var. cinerea,INAT
833
833
  Herniaria hirsuta subsp. cinerea,Herniaria hirsuta var. cinerea
834
834
  Herpestris pilosa,Mimetanthe pilosa
835
+ Hesperocyparis macrocarpa,Hesperocyparis macrocarpa,INAT
836
+ Hesperocyparis sargentii,Hesperocyparis sargentii,INAT
835
837
  Hesperomecon filiformis,Hesperomecon linearis
836
838
  Hesperoscordum hyacinthinum,Triteleia hyacinthina
837
839
  Hesperoscordum lacteum,Triteleia hyacinthina
@@ -1121,6 +1123,7 @@ Medicago polymorpha var. brevispina,Medicago polymorpha
1121
1123
  Medicago sativa subsp. falcata,Medicago sativa
1122
1124
  Medicago sativa subsp. sativa,Medicago sativa
1123
1125
  Mentha arvensis var. canadensis,Mentha canadensis
1126
+ Mentha arvensis var. villosa,Mentha canadensis
1124
1127
  Mentha citrata,Mentha aquatica
1125
1128
  Mentzelia dispersa var. compacta,Mentzelia dispersa
1126
1129
  Mentzelia dispersa var. dispersa,Mentzelia dispersa
@@ -1265,7 +1268,6 @@ Myosurus minimus subsp. major,Myosurus minimus
1265
1268
  Myosurus minimus var. filiformis,Myosurus minimus
1266
1269
  Myosurus minimus var. major,Myosurus minimus
1267
1270
  Myosurus minimus var. sessiliflorus,Myosurus sessilis
1268
- Myosurus minimus,Myosurus minimus subsp. minimus,INAT
1269
1271
  Myrica californica,Morella californica
1270
1272
  Myriophyllum brasiliense,Myriophyllum aquaticum
1271
1273
  Myriophyllum exalbescens,Myriophyllum sibiricum
package/data/taxa.csv CHANGED
@@ -27,7 +27,7 @@ Acmispon parviflorus,least trefoil,N,91717,11299,57048
27
27
  Acmispon strigosus,,N,91722,11305,58152
28
28
  Acmispon wrangelianus,common trefoil,N,82483,11306,57050
29
29
  Actaea rubra,baneberry,N,11894,93,49870
30
- Adelinia grandis,hound's tongue,N,101954,14544,769151,blue
30
+ Adelinia grandis,hound's tongue,N,101954,14544,1520640,blue
31
31
  Adenocaulon bicolor,American trailplant,N,721,94,56854
32
32
  Adenostoma fasciculatum,chamise,N,11939,97,47146
33
33
  Adiantum aleuticum,five-finger fern,N,11945,100,52667
@@ -201,7 +201,7 @@ Balsamorhiza deltoidea,,N,1634,1047,70383
201
201
  Balsamorhiza macrolepis,,N,1639,1051,69665,,,,350,1B.2,,,S2,G2
202
202
  Barbarea orthoceras,winter cress,N,15481,1057,52976
203
203
  Bassia hyssopifolia,,X,15511,1060,58125
204
- Bellardia trixago var. trixago,,X,8635,1064,1115038
204
+ Bellardia trixago var. trixago,,X,8635,14706,1115038
205
205
  Bellis perennis,English daisy,X,1652,1065,55563
206
206
  Berberis aquifolium var. aquifolium,,N,71483,1068,126887
207
207
  Berberis aquifolium var. dictyota,,N,76967,1069,775436
@@ -846,8 +846,8 @@ Hesperevax acaulis var. ambusticola,fire evax,N,59934,4108,80930
846
846
  Hesperevax caulescens,hogwallow starfish,N,28021,4110,60135,,,,1931,4.2,,,S3,G3
847
847
  Hesperevax sparsiflora var. sparsiflora,,N,59937,4113,61172
848
848
  Hesperocnide tenella,black haired nettle,N,28033,4118,59036
849
- Hesperocyparis macrocarpa,Monterey cypress,N,89298,11190,322545,,,,536,1B.2,,,S1,G1
850
- Hesperocyparis sargentii,Sargent cypress,N,89302,10803,83149
849
+ Hesperocyparis macrocarpa,Monterey cypress,N,89298,11190,77378,,,,536,1B.2,,,S1,G1
850
+ Hesperocyparis sargentii,Sargent cypress,N,89302,10803,77381
851
851
  Hesperolinon breweri,Brewer's dwarf flax,N,28038,4121,77385,,,,404,1B.2,,,S2,G2
852
852
  Hesperolinon californicum,California dwarf flax,N,28039,4122,77386
853
853
  Hesperolinon clevelandii,,N,28040,4123,77387
@@ -1103,8 +1103,9 @@ 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,,,,1065,1B.2,,,S2,G2
1106
1107
  Malacothamnus fremontii,white-coat mallow,N,32524,5312,70397
1107
- Malacothamnus arcuatus var. elmeri,,N,108345,14681,1497404
1108
+ Malacothamnus hallii,,N,108345,14681,1497404,,,,1065,1B.2,,,S2,G2
1108
1109
  Malacothrix californica,,N,4059,5325,58026
1109
1110
  Malacothrix clevelandii,Cleveland's malacothrix,N,4060,5326,58841
1110
1111
  Malacothrix coulteri,snake's-head,N,4061,5327,58027
@@ -1145,7 +1146,7 @@ Mentha spicata,spearmint,X,33209,10111,62652
1145
1146
  Mentha suaveolens,pineapple mint,X,33212,5417,77993
1146
1147
  Mentzelia affinis,,N,33219,5418,58194
1147
1148
  Mentzelia dispersa,,N,33236,5423,58196
1148
- Mentzelia laevicaulis var. laevicaulis,blazingstar,N,61864,5431,241687
1149
+ Mentzelia laevicaulis var. laevicaulis,blazingstar,N,61864,14741,241687
1149
1150
  Mentzelia lindleyi,,N,33255,5432,53923
1150
1151
  Mentzelia micrantha,,N,33259,5433,58933
1151
1152
  Mentzelia pectinata,,N,33274,5439,58198
@@ -1377,7 +1378,7 @@ Pogogyne douglasii,,N,38936,6704,63943
1377
1378
  Pogogyne serpylloides,,N,38939,6708,57118
1378
1379
  Pogogyne zizyphoroides,,N,78298,6709,60209
1379
1380
  Polemonium carneum,royal sky pilot,N,38971,6712,78665,,,,3345,2B.2,,,S2,G3G4
1380
- Polycarpon tetraphyllum subsp. tetraphyllum,four-leaved allseed,X,80560,11032,81277
1381
+ Polycarpon tetraphyllum subsp. tetraphyllum,four-leaved allseed,X,80560,14756,81277
1381
1382
  Polygonum argyrocoleon,persian knotweed,X,39158,6738,78676
1382
1383
  Polygonum aviculare subsp. aviculare,,X,80990,10667,80151
1383
1384
  Polygonum aviculare subsp. depressum,,X,80993,11034,63967
@@ -1761,7 +1762,7 @@ Triglochin concinna var. concinna,slender arrow-grass,N,74018,8112,81439
1761
1762
  Triglochin maritima,seaside arrow-grass,N,47197,8114,60264
1762
1763
  Triglochin scilloides,flowering quillwort,N,91083,12117,79437
1763
1764
  Triglochin striata,,N,47201,8116,79438
1764
- Trillium chloropetalum,giant trillium,N,47218,8119,50823
1765
+ Trillium chloropetalum,giant trillium,N,47218,8119,50823,"yellow,pink,purple,white",4,5
1765
1766
  Trillium ovatum subsp. ovatum,white trillium,N,53276,8122,63972
1766
1767
  Triodanis biflora,Venus' looking-glass,N,47267,8126,79440
1767
1768
  Triphysaria eriantha subsp. eriantha,butter-and-eggs,N,53279,8129,59332
@@ -1825,7 +1826,7 @@ Woodwardia fimbriata,giant chain fern,N,48619,8355,52685
1825
1826
  Wyethia angustifolia,narrowleaf mule-ears,N,5572,8356,56987,yellow
1826
1827
  Wyethia glabra,mules ears,N,5578,8359,56988,yellow
1827
1828
  Wyethia helenioides,woolly mules ears,N,5579,8360,50799,yellow
1828
- Xanthium orientale,cocklebur,N,5618,8367,506262
1829
+ Xanthium orientale,cocklebur,N,5618,14779,506262
1829
1830
  Xanthium spinosum,spiny cocklebur,X,5590,8366,58045
1830
1831
  Yabea microcarpa,California hedge parsley,N,48745,8373,56847
1831
1832
  Zannichellia palustris,horned-pondweed,N,48827,8379,79546
@@ -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.
@@ -12,7 +12,6 @@ class BasePageRenderer {
12
12
  const siteGenerator = new Jekyll( outputDir );
13
13
 
14
14
  // Copy static files
15
- Files.rmDir( outputDir );
16
15
  // First copy default Jekyll files from package.
17
16
  Files.copyDir( Config.getPackageDir() + "/jekyll", outputDir );
18
17
  // Then copy Jekyll files from current dir (which may override default files).
@@ -1,4 +1,5 @@
1
1
  import { CommandProcessor } from "./commandprocessor.js";
2
+ import { Files } from "./files.js";
2
3
  import { TaxaProcessor } from "./taxaprocessor.js";
3
4
 
4
5
  class CommandAndTaxaProcessor extends CommandProcessor {
@@ -14,6 +15,8 @@ class CommandAndTaxaProcessor extends CommandProcessor {
14
15
  if ( this.helpShown() ) {
15
16
  return;
16
17
  }
18
+ Files.rmDir( this.getOptions().outputdir );
19
+
17
20
  await this.#taxaProcessor.process( commandRunner );
18
21
  }
19
22
 
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.
@@ -218,39 +231,45 @@ export class Taxa {
218
231
  getFlowerColor(name: any): any;
219
232
  getTaxon(name: any): any;
220
233
  getTaxonList(): any[];
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;
221
240
  #private;
222
241
  }
223
242
  export namespace TAXA_LIST_COLS {
224
243
  namespace CESA {
225
- const title: string;
244
+ let title: string;
226
245
  function data(t: any): any;
227
246
  }
228
247
  namespace COMMON_NAME {
229
- const title_1: string;
248
+ let title_1: string;
230
249
  export { title_1 as title };
231
250
  export function data_1(t: any): any;
232
251
  export { data_1 as data };
233
252
  }
234
253
  namespace CNPS_RANK {
235
- const title_2: string;
254
+ let title_2: string;
236
255
  export { title_2 as title };
237
256
  export function data_2(t: any): string;
238
257
  export { data_2 as data };
239
258
  }
240
259
  namespace FESA {
241
- const title_3: string;
260
+ let title_3: string;
242
261
  export { title_3 as title };
243
262
  export function data_3(t: any): any;
244
263
  export { data_3 as data };
245
264
  }
246
265
  namespace SPECIES {
247
- const title_4: string;
266
+ let title_4: string;
248
267
  export { title_4 as title };
249
268
  export function data_4(t: any): any;
250
269
  export { data_4 as data };
251
270
  }
252
271
  namespace SPECIES_BARE {
253
- const title_5: string;
272
+ let title_5: string;
254
273
  export { title_5 as title };
255
274
  export function data_5(t: any): any;
256
275
  export { data_5 as data };
@@ -272,10 +291,10 @@ export class TaxaProcessor {
272
291
  }
273
292
  import { TaxaLoader } from "./taxaloader.js";
274
293
  export namespace TAXA_COLNAMES {
275
- const BLOOM_START: string;
276
- const BLOOM_END: string;
277
- const COMMON_NAME: string;
278
- const FLOWER_COLOR: string;
294
+ let BLOOM_START: string;
295
+ let BLOOM_END: string;
296
+ let COMMON_NAME: string;
297
+ let FLOWER_COLOR: string;
279
298
  }
280
299
  export class Taxon {
281
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 = {
@@ -75,9 +76,13 @@ class Taxa {
75
76
  #taxa = {};
76
77
  #flower_colors = {};
77
78
  #sortedTaxa;
79
+ #synonyms = new Set();
80
+ #isSubset;
78
81
 
79
82
  constructor( inclusionList, errorLog, showFlowerErrors, taxaMeta = {}, taxonClass = Taxon, extraTaxa = [], extraSynonyms = [] ) {
80
83
 
84
+ this.#isSubset = ( inclusionList !== true );
85
+
81
86
  this.#errorLog = errorLog;
82
87
 
83
88
  for ( const color of FLOWER_COLORS ) {
@@ -153,18 +158,33 @@ class Taxa {
153
158
  return this.#sortedTaxa;
154
159
  }
155
160
 
161
+ hasSynonym( formerName ) {
162
+ return this.#synonyms.has( formerName );
163
+ }
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
+
156
173
  #loadSyns( synCSV, inclusionList ) {
157
174
  for ( const syn of synCSV ) {
158
175
  const currName = syn[ "Current" ];
159
176
  const taxon = this.getTaxon( currName );
160
177
  if ( !taxon ) {
161
- if ( inclusionList === true ) {
162
- // If including all taxa, note the error.
178
+ if ( inclusionList === true && !syn.Type ) {
179
+ // If including all taxa, note the error - the target is not defined, and this is not
180
+ // a synonym for a non-Jepson system.
163
181
  console.log( "synonym target not found: " + currName );
164
182
  }
165
183
  continue;
166
184
  }
167
- taxon.addSynonym( syn[ "Former" ], syn[ "Type" ] );
185
+ const formerName = syn[ "Former" ];
186
+ this.#synonyms.add( formerName );
187
+ taxon.addSynonym( formerName, syn[ "Type" ] );
168
188
  }
169
189
  }
170
190
 
@@ -27,8 +27,8 @@ class TaxaProcessor {
27
27
  console.log( "loading data" );
28
28
  this.#taxaLoader = new this.#taxaLoaderClass( this.#options );
29
29
  await this.#taxaLoader.load();
30
- await commandRunner( this );
31
30
  this.#taxaLoader.writeErrorLog();
31
+ await commandRunner( this );
32
32
  }
33
33
 
34
34
  }
@@ -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.0",
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
+ }