@ca-plant-list/ca-plant-list 0.4.19 → 0.4.20

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.
Files changed (41) hide show
  1. package/data/genera.json +36 -32
  2. package/data/synonyms.csv +2 -0
  3. package/data/taxa.csv +6 -5
  4. package/data/text/Rumex-conglomeratus.md +1 -0
  5. package/data/text/Rumex-obtusifolius.md +1 -0
  6. package/data/text/Rumex-pulcher.md +1 -0
  7. package/data/text/Rumex-salicifolius.md +1 -0
  8. package/lib/ebook/glossarypages.js +3 -3
  9. package/lib/ebook/images.js +2 -2
  10. package/lib/ebook/pages/page_list_families.js +1 -1
  11. package/lib/ebook/pages/page_list_flower_color.js +2 -2
  12. package/lib/ebook/pages/page_list_flowers.js +8 -8
  13. package/lib/ebook/pages/tocpage.js +2 -2
  14. package/lib/ebook/plantbook.js +2 -2
  15. package/lib/externalsites.js +20 -15
  16. package/lib/families.js +1 -1
  17. package/lib/flowercolor.js +2 -2
  18. package/lib/genera.js +2 -2
  19. package/lib/index.d.ts +31 -1
  20. package/lib/photo.js +1 -10
  21. package/lib/plants/glossary.js +2 -4
  22. package/lib/program.js +10 -2
  23. package/lib/sitegenerator.js +13 -3
  24. package/lib/taxa.js +14 -10
  25. package/lib/taxon.js +6 -3
  26. package/lib/tools/calflora.js +41 -8
  27. package/lib/tools/calscape.js +4 -4
  28. package/lib/tools/inat.js +7 -7
  29. package/lib/tools/jepsoneflora.js +28 -4
  30. package/lib/tools/jepsonfamilies.js +102 -0
  31. package/lib/tools/rpi.js +5 -5
  32. package/lib/tools/supplementaltext.js +43 -0
  33. package/lib/tools/taxacsv.js +2 -2
  34. package/lib/utils/inat-tools.js +39 -2
  35. package/lib/web/glossarypages.js +6 -6
  36. package/package.json +6 -7
  37. package/scripts/cpl-photos.js +2 -2
  38. package/scripts/cpl-tools.js +11 -3
  39. package/scripts/inatobsphotos.js +10 -1
  40. package/scripts/inattaxonphotos.js +45 -43
  41. package/types/classes.d.ts +0 -205
package/data/genera.json CHANGED
@@ -607,6 +607,10 @@
607
607
  "family": "Asteraceae",
608
608
  "id": "302"
609
609
  },
610
+ "Aldama": {
611
+ "family": "Asteraceae",
612
+ "id": "95525"
613
+ },
610
614
  "Almutaster": {
611
615
  "family": "Asteraceae",
612
616
  "id": "67986"
@@ -1107,6 +1111,10 @@
1107
1111
  "family": "Asteraceae",
1108
1112
  "id": "497"
1109
1113
  },
1114
+ "Laphamia": {
1115
+ "family": "Asteraceae",
1116
+ "id": "68724"
1117
+ },
1110
1118
  "Lapsana": {
1111
1119
  "family": "Asteraceae",
1112
1120
  "id": "498"
@@ -1199,6 +1207,10 @@
1199
1207
  "family": "Asteraceae",
1200
1208
  "id": "68898"
1201
1209
  },
1210
+ "Mycelis": {
1211
+ "family": "Asteraceae",
1212
+ "id": "532"
1213
+ },
1202
1214
  "Nestotus": {
1203
1215
  "family": "Asteraceae",
1204
1216
  "id": "82475"
@@ -1515,10 +1527,6 @@
1515
1527
  "family": "Asteraceae",
1516
1528
  "id": "653"
1517
1529
  },
1518
- "Viguiera": {
1519
- "family": "Asteraceae",
1520
- "id": "655"
1521
- },
1522
1530
  "Volutaria": {
1523
1531
  "family": "Asteraceae",
1524
1532
  "id": "82515"
@@ -1983,10 +1991,6 @@
1983
1991
  "family": "Cactaceae",
1984
1992
  "id": "9216"
1985
1993
  },
1986
- "Coryphantha": {
1987
- "family": "Cactaceae",
1988
- "id": "9218"
1989
- },
1990
1994
  "Cylindropuntia": {
1991
1995
  "family": "Cactaceae",
1992
1996
  "id": "68351"
@@ -1999,6 +2003,10 @@
1999
2003
  "family": "Cactaceae",
2000
2004
  "id": "9220"
2001
2005
  },
2006
+ "Escobaria": {
2007
+ "family": "Cactaceae",
2008
+ "id": "10632"
2009
+ },
2002
2010
  "Ferocactus": {
2003
2011
  "family": "Cactaceae",
2004
2012
  "id": "10633"
@@ -2115,6 +2123,10 @@
2115
2123
  "family": "Caryophyllaceae",
2116
2124
  "id": "10431"
2117
2125
  },
2126
+ "Engellaria": {
2127
+ "family": "Caryophyllaceae",
2128
+ "id": "85147"
2129
+ },
2118
2130
  "Eremogone": {
2119
2131
  "family": "Caryophyllaceae",
2120
2132
  "id": "68468"
@@ -2175,10 +2187,6 @@
2175
2187
  "family": "Caryophyllaceae",
2176
2188
  "id": "10855"
2177
2189
  },
2178
- "Schizotechium": {
2179
- "family": "Caryophyllaceae",
2180
- "id": "85148"
2181
- },
2182
2190
  "Scleranthus": {
2183
2191
  "family": "Caryophyllaceae",
2184
2192
  "id": "10857"
@@ -2203,6 +2211,10 @@
2203
2211
  "family": "Caryophyllaceae",
2204
2212
  "id": "10852"
2205
2213
  },
2214
+ "Torreyostellaria": {
2215
+ "family": "Caryophyllaceae",
2216
+ "id": "8632"
2217
+ },
2206
2218
  "Euonymus": {
2207
2219
  "family": "Celastraceae",
2208
2220
  "id": "9802"
@@ -2315,30 +2327,14 @@
2315
2327
  "family": "Cistaceae",
2316
2328
  "id": "10869"
2317
2329
  },
2318
- "Carsonia": {
2319
- "family": "Cleomaceae",
2320
- "id": "91883"
2321
- },
2322
2330
  "Cleomella": {
2323
2331
  "family": "Cleomaceae",
2324
2332
  "id": "10309"
2325
2333
  },
2326
- "Oxystylis": {
2327
- "family": "Cleomaceae",
2328
- "id": "10312"
2329
- },
2330
- "Peritoma": {
2331
- "family": "Cleomaceae",
2332
- "id": "91884"
2333
- },
2334
2334
  "Polanisia": {
2335
2335
  "family": "Cleomaceae",
2336
2336
  "id": "10313"
2337
2337
  },
2338
- "Wislizenia": {
2339
- "family": "Cleomaceae",
2340
- "id": "10314"
2341
- },
2342
2338
  "Comandra": {
2343
2339
  "family": "Comandraceae",
2344
2340
  "id": "10714"
@@ -2735,6 +2731,10 @@
2735
2731
  "family": "Fabaceae",
2736
2732
  "id": "9376"
2737
2733
  },
2734
+ "Neltuma": {
2735
+ "family": "Fabaceae",
2736
+ "id": "68919"
2737
+ },
2738
2738
  "Olneya": {
2739
2739
  "family": "Fabaceae",
2740
2740
  "id": "9384"
@@ -2751,6 +2751,10 @@
2751
2751
  "family": "Fabaceae",
2752
2752
  "id": "9391"
2753
2753
  },
2754
+ "Paraserianthes": {
2755
+ "family": "Fabaceae",
2756
+ "id": "9393"
2757
+ },
2754
2758
  "Parkinsonia": {
2755
2759
  "family": "Fabaceae",
2756
2760
  "id": "9394"
@@ -2775,10 +2779,6 @@
2775
2779
  "family": "Fabaceae",
2776
2780
  "id": "9404"
2777
2781
  },
2778
- "Prosopis": {
2779
- "family": "Fabaceae",
2780
- "id": "9406"
2781
- },
2782
2782
  "Psorothamnus": {
2783
2783
  "family": "Fabaceae",
2784
2784
  "id": "9408"
@@ -2811,6 +2811,10 @@
2811
2811
  "family": "Fabaceae",
2812
2812
  "id": "9420"
2813
2813
  },
2814
+ "Strombocarpa": {
2815
+ "family": "Fabaceae",
2816
+ "id": "8678"
2817
+ },
2814
2818
  "Thermopsis": {
2815
2819
  "family": "Fabaceae",
2816
2820
  "id": "10382"
package/data/synonyms.csv CHANGED
@@ -597,10 +597,12 @@ Dodecatheon jeffreyi subsp. jeffreyi,Primula jeffreyi
597
597
  Dodecatheon jeffreyi subsp. pygmaeum,Primula jeffreyi
598
598
  Dodecatheon jeffreyi var. alpinum,Primula tetrandra
599
599
  Dodecatheon tetrandrum,Primula tetrandra
600
+ Downingia concolor var. tricolor,Downingia concolor var. concolor
600
601
  Downingia immaculata,Downingia cuspidata
601
602
  Downingia mirabilis,Downingia ornatissima var. mirabilis
602
603
  Downingia mirabilis var. eximia,Downingia ornatissima var. mirabilis
603
604
  Downingia ornatissima var. eximia,Downingia ornatissima var. mirabilis
605
+ Downingia tricolor,Downingia concolor var. concolor
604
606
  Draba cuneifolia var. cuneifolia,Draba cuneifolia
605
607
  Draba cuneifolia var. integrifolia,Draba cuneifolia
606
608
  Draba cuneifolia var. sonorae,Draba cuneifolia
package/data/taxa.csv CHANGED
@@ -592,11 +592,12 @@ Dipterostemon capitatus,blue dicks,N,108599,13632,1196784,Blue Dicks
592
592
  Dirca occidentalis,western leatherwood,N,23143,2739,50315,Western Leatherwood,,,,,567,1B.2,,,S2,G2
593
593
  Distichlis spicata,saltgrass,N,23161,2743,58372,Saltgrass
594
594
  Dittrichia graveolens,stinkwort,X,2454,8482,58822
595
- Downingia bella,,N,23273,2766,60160,Hoover's Downingia
596
- Downingia cuspidata,,N,101864,2773,60163,Toothed Calicoflower
597
- Downingia insignis,,N,23278,2776,60164,Harlequin Calicoflower
598
- Downingia ornatissima var. mirabilis,,N,84766,14563
599
- Downingia pulchella,,N,23282,2782,60167,Flatface Calicoflower
595
+ Downingia bella,,N,23273,2766,60160,Hoover's Downingia,annual,blue,3,5
596
+ Downingia concolor var. concolor,maroonspot calicoflower,N,57811,2772,80674,Maroonspot Calicoflower,annual,blue,4,7
597
+ Downingia cuspidata,,N,101864,2773,60163,Toothed Calicoflower,annual,blue,3,6
598
+ Downingia insignis,,N,23278,2776,60164,Harlequin Calicoflower,annual,blue,3,5
599
+ Downingia ornatissima var. mirabilis,,N,84766,14563,,,annual,blue,4,5
600
+ Downingia pulchella,,N,23282,2782,60167,Flatface Calicoflower,annual,blue,4,6
600
601
  Draba cuneifolia,,N,23332,2798,1138678,Wedgeleaf Draba
601
602
  Draba verna,spring whitlow-grass,X,23442,2816,55823,,,white,2,5
602
603
  Drymocallis glandulosa var. glandulosa,sticky cinquefoil,N,82059,11609,80678,Sticky Cinquefoil,perennial,"yellow,white",5,7
@@ -0,0 +1 @@
1
+ [Perianth](./g/perianth.html) without teeth.
@@ -0,0 +1 @@
1
+ [Perianth](./g/perianth.html) with teeth.
@@ -0,0 +1 @@
1
+ [Perianth](./g/perianth.html) with teeth.
@@ -0,0 +1 @@
1
+ Leaves only on stem (no basal leaves).
@@ -3,7 +3,7 @@ import { EBook } from "./ebook.js";
3
3
 
4
4
  class GlossaryPages extends BaseGlossaryPages {
5
5
  /**
6
- * @param {SiteGenerator} siteGenerator
6
+ * @param {import("../sitegenerator.js").SiteGenerator} siteGenerator
7
7
  */
8
8
  constructor(siteGenerator) {
9
9
  super(siteGenerator);
@@ -19,8 +19,8 @@ class GlossaryPages extends BaseGlossaryPages {
19
19
  manifestEntries.push(
20
20
  EBook.getManifestEntry(
21
21
  "g" + index,
22
- "g/" + entry.getHTMLFileName()
23
- )
22
+ "g/" + entry.getHTMLFileName(),
23
+ ),
24
24
  );
25
25
  }
26
26
 
@@ -12,9 +12,9 @@ class Images {
12
12
  #taxa;
13
13
 
14
14
  /**
15
- * @param {SiteGenerator} siteGenerator
15
+ * @param {import("../sitegenerator.js").SiteGenerator} siteGenerator
16
16
  * @param {string} contentDir
17
- * @param {Taxa} taxa
17
+ * @param {import("../taxa.js").Taxa} taxa
18
18
  */
19
19
  constructor(siteGenerator, contentDir, taxa) {
20
20
  this.#siteGenerator = siteGenerator;
@@ -6,7 +6,7 @@ class PageListFamilies extends EBookPage {
6
6
 
7
7
  /**
8
8
  * @param {string} outputDir
9
- * @param {Families} families
9
+ * @param {import("../../families.js").Families} families
10
10
  */
11
11
  constructor(outputDir, families) {
12
12
  super(outputDir + "/list_families.html", "All Families");
@@ -6,12 +6,12 @@ class PageListFlowerColor extends EBookPage {
6
6
 
7
7
  /**
8
8
  * @param {string} outputDir
9
- * @param {FlowerColor} color
9
+ * @param {import("../../flowercolor.js").FlowerColor} color
10
10
  */
11
11
  constructor(outputDir, color) {
12
12
  super(
13
13
  outputDir + "/" + color.getFileName(),
14
- color.getColorName(true) + " Flowers"
14
+ color.getColorName(true) + " Flowers",
15
15
  );
16
16
  this.#color = color;
17
17
  }
@@ -8,7 +8,7 @@ const FN_FLOWER_TIME_INDEX = "fm.html";
8
8
  class PageListFlowers {
9
9
  /**
10
10
  * @param {string} contentDir
11
- * @param {Taxa} taxa
11
+ * @param {import("../../taxa.js").Taxa} taxa
12
12
  */
13
13
  static createPages(contentDir, taxa) {
14
14
  new PageListFlowerTimeIndex(contentDir).create();
@@ -21,14 +21,14 @@ class PageListFlowers {
21
21
  const manifestEntries = [];
22
22
 
23
23
  manifestEntries.push(
24
- EBook.getManifestEntry("fm0", FN_FLOWER_TIME_INDEX)
24
+ EBook.getManifestEntry("fm0", FN_FLOWER_TIME_INDEX),
25
25
  );
26
26
  for (let m1 = 1; m1 < 13; m1++) {
27
27
  manifestEntries.push(
28
28
  EBook.getManifestEntry(
29
29
  "fm" + m1,
30
- PageListFlowerTime.getFileNameBloomTime(m1)
31
- )
30
+ PageListFlowerTime.getFileNameBloomTime(m1),
31
+ ),
32
32
  );
33
33
  }
34
34
 
@@ -54,8 +54,8 @@ class PageListFlowers {
54
54
  PageListFlowerTime.getFileNameBloomTime(m1),
55
55
  DateUtils.getMonthName(m1) +
56
56
  " - " +
57
- DateUtils.getMonthName((m1 % 12) + 1)
58
- )
57
+ DateUtils.getMonthName((m1 % 12) + 1),
58
+ ),
59
59
  );
60
60
  }
61
61
  return XHTML.wrap("ol", XHTML.arrayToLI(links));
@@ -83,7 +83,7 @@ class PageListFlowerTime extends EBookPage {
83
83
 
84
84
  /**
85
85
  * @param {string} outputDir
86
- * @param {Taxa} taxa
86
+ * @param {import("../../taxa.js").Taxa} taxa
87
87
  * @param {number} month
88
88
  */
89
89
  constructor(outputDir, taxa, month) {
@@ -92,7 +92,7 @@ class PageListFlowerTime extends EBookPage {
92
92
  "Flowering in " +
93
93
  DateUtils.getMonthName(month) +
94
94
  " - " +
95
- DateUtils.getMonthName((month % 12) + 1)
95
+ DateUtils.getMonthName((month % 12) + 1),
96
96
  );
97
97
  this.#taxa = taxa;
98
98
  this.#m1 = month;
@@ -7,7 +7,7 @@ class TOCPage extends EBookPage {
7
7
 
8
8
  /**
9
9
  * @param {string} outputDir
10
- * @param {Taxa} taxa
10
+ * @param {import("../../taxa.js").Taxa} taxa
11
11
  */
12
12
  constructor(outputDir, taxa) {
13
13
  super(outputDir + "/toc.xhtml", "Table of Contents");
@@ -37,7 +37,7 @@ class TOCPage extends EBookPage {
37
37
  for (const color of this.#taxa.getFlowerColors()) {
38
38
  const colorName = color.getColorName();
39
39
  links.push(
40
- XHTML.getLink("list_fc_" + colorName + ".html", colorName)
40
+ XHTML.getLink("list_fc_" + colorName + ".html", colorName),
41
41
  );
42
42
  }
43
43
  return html + XHTML.wrap("ol", XHTML.arrayToLI(links));
@@ -17,7 +17,7 @@ class PlantBook extends EBook {
17
17
 
18
18
  /**
19
19
  * @param {string} outputDir
20
- * @param {Config} config
20
+ * @param {import("../config.js").Config} config
21
21
  * @param {import("../taxa.js").Taxa} taxa
22
22
  */
23
23
  constructor(outputDir, config, taxa) {
@@ -168,7 +168,7 @@ class PlantBook extends EBook {
168
168
  }
169
169
 
170
170
  /**
171
- * @param {Config} config
171
+ * @param {import("../config.js").Config} config
172
172
  * @param {string} name
173
173
  * @returns {string}
174
174
  */
@@ -1,27 +1,32 @@
1
+ /** @typedef {{
2
+ coords?: [number, number];
3
+ project_id?: string;
4
+ subview?: "grid" | "list" | "map";
5
+ taxon_id?: string;
6
+ }} InatObsOptions */
7
+
1
8
  class ExternalSites {
2
9
  /**
3
10
  * @param {InatObsOptions} options
4
11
  */
5
12
  static getInatObsLink(options) {
6
13
  const url = new URL(
7
- "https://www.inaturalist.org/observations?subview=map"
14
+ "https://www.inaturalist.org/observations?subview=map",
8
15
  );
9
16
 
17
+ if (options.coords) {
18
+ const delta = 0.1;
19
+ const params = url.searchParams;
20
+ const lat = options.coords[1];
21
+ const lng = options.coords[0];
22
+ params.set("nelat", (lat + delta).toString());
23
+ params.set("swlat", (lat - delta).toString());
24
+ params.set("nelng", (lng + delta).toString());
25
+ params.set("swlng", (lng - delta).toString());
26
+ }
27
+
10
28
  for (const [k, v] of Object.entries(options)) {
11
29
  switch (k) {
12
- case "coords": {
13
- const delta = 0.1;
14
- const params = url.searchParams;
15
- /** @type {number} */
16
- const lat = v[1];
17
- /** @type {number} */
18
- const lng = v[0];
19
- params.set("nelat", (lat + delta).toString());
20
- params.set("swlat", (lat - delta).toString());
21
- params.set("nelng", (lng + delta).toString());
22
- params.set("swlng", (lng - delta).toString());
23
- break;
24
- }
25
30
  case "created_d1":
26
31
  case "list_id":
27
32
  case "place_id":
@@ -29,7 +34,7 @@ class ExternalSites {
29
34
  case "subview":
30
35
  case "taxon_id":
31
36
  case "taxon_name":
32
- if (v) {
37
+ if (typeof v === "string") {
33
38
  url.searchParams.set(k, v);
34
39
  }
35
40
  break;
package/lib/families.js CHANGED
@@ -5,7 +5,7 @@ import { Files } from "./files.js";
5
5
  import { Config } from "./config.js";
6
6
  import { HTMLTaxon } from "./htmltaxon.js";
7
7
 
8
- class Family {
8
+ export class Family {
9
9
  #name;
10
10
  #data;
11
11
 
@@ -3,7 +3,7 @@ import { TextUtils } from "./textutils.js";
3
3
  class FlowerColor {
4
4
  #colorName;
5
5
  #colorCode;
6
- /** @type {Taxon[]} */
6
+ /** @type {import("./taxon.js").Taxon[]} */
7
7
  #taxa = [];
8
8
 
9
9
  /**
@@ -16,7 +16,7 @@ class FlowerColor {
16
16
  }
17
17
 
18
18
  /**
19
- * @param {Taxon} taxon
19
+ * @param {import("./taxon.js").Taxon} taxon
20
20
  */
21
21
  addTaxon(taxon) {
22
22
  this.#taxa.push(taxon);
package/lib/genera.js CHANGED
@@ -6,7 +6,7 @@ class Genera {
6
6
  #genera;
7
7
 
8
8
  /**
9
- * @param {Families} families
9
+ * @param {import("./families.js").Families} families
10
10
  */
11
11
  constructor(families) {
12
12
  const dataDir = Config.getPackageDir() + "/data";
@@ -46,7 +46,7 @@ class Genus {
46
46
  #data;
47
47
 
48
48
  /**
49
- * @param {{family:string,familyObj:Family,taxa:Taxon[]}} data
49
+ * @param {{family:string,familyObj:import("./families.js").Family,taxa:import("./taxon.js").Taxon[]}} data
50
50
  */
51
51
  constructor(data) {
52
52
  this.#data = data;
package/lib/index.d.ts CHANGED
@@ -1,5 +1,29 @@
1
1
  import { Command } from "commander";
2
2
 
3
+ // Types
4
+
5
+ export type TaxonData = {
6
+ bloom_end: string;
7
+ bloom_start: string;
8
+ calrecnum: string;
9
+ calscape_cn?: string;
10
+ CESA: string;
11
+ "common name": string;
12
+ CRPR: string;
13
+ FESA: string;
14
+ flower_color: string;
15
+ GRank: string;
16
+ "inat id": string;
17
+ "jepson id": string;
18
+ life_cycle: string;
19
+ "RPI ID": string;
20
+ SRank: string;
21
+ status: "N" | "NC" | "U" | "X";
22
+ taxon_name: string;
23
+ };
24
+
25
+ // Classes
26
+
3
27
  export class Config {
4
28
  constructor(dataDir: string);
5
29
  getConfigValue(
@@ -94,6 +118,12 @@ export class Program {
94
118
  static getProgram(): Command;
95
119
  }
96
120
 
121
+ export class Family {}
122
+
123
+ export class Genera {}
124
+
125
+ export class Genus {}
126
+
97
127
  export class Taxa {
98
128
  constructor(
99
129
  inclusionList: Record<string, TaxonData> | true,
@@ -101,7 +131,7 @@ export class Taxa {
101
131
  showFlowerErrors: boolean,
102
132
  taxonFactory?: (td: TaxonData, g: Genera) => Taxon,
103
133
  extraTaxa?: TaxonData[],
104
- extraSynonyms?: SynonymData[],
134
+ extraSynonyms?: Record<string, string>[],
105
135
  );
106
136
  getTaxon(name: string): Taxon;
107
137
  getTaxonList(): Taxon[];
package/lib/photo.js CHANGED
@@ -1,14 +1,5 @@
1
1
  /**
2
2
  * @typedef {"CC0" | "CC BY" | "CC BY-NC" | "C" | null} PhotoRights
3
- * @typedef { "cc-by-nc-sa"
4
- | "cc-by-nc"
5
- | "cc-by-nc-nd"
6
- | "cc-by"
7
- | "cc-by-sa"
8
- | "cc-by-nd"
9
- | "pd"
10
- | "gdfl"
11
- | "cc0"} InatLicenseCode
12
3
  */
13
4
 
14
5
  export class Photo {
@@ -21,7 +12,7 @@ export class Photo {
21
12
  /**
22
13
  * @param {number} id
23
14
  * @param {string} ext
24
- * @param {InatLicenseCode} licenseCode
15
+ * @param {import("./utils/inat-tools.js").InatLicenseCode} licenseCode
25
16
  * @param {string} rightsHolder
26
17
  */
27
18
  constructor(id, ext, licenseCode, rightsHolder) {
@@ -1,7 +1,7 @@
1
1
  import { Config } from "../config.js";
2
2
  import { Files } from "../files.js";
3
3
 
4
- class Glossary {
4
+ export class Glossary {
5
5
  #srcPath;
6
6
  /** @type {GlossaryEntry[]} */
7
7
  #srcEntries = [];
@@ -21,7 +21,7 @@ class Glossary {
21
21
  }
22
22
  }
23
23
 
24
- class GlossaryEntry {
24
+ export class GlossaryEntry {
25
25
  #srcPath;
26
26
  #fileName;
27
27
  #term;
@@ -48,5 +48,3 @@ class GlossaryEntry {
48
48
  return this.#term;
49
49
  }
50
50
  }
51
-
52
- export { Glossary };
package/lib/program.js CHANGED
@@ -3,6 +3,14 @@ import { Files } from "./files.js";
3
3
  import { CSV } from "./csv.js";
4
4
  import path from "node:path";
5
5
 
6
+ /**
7
+ * @typedef {{
8
+ datadir: string;
9
+ outputdir: string;
10
+ "show-flower-errors": boolean;
11
+ }} CommandLineOptions
12
+ */
13
+
6
14
  class Program {
7
15
  /**
8
16
  * @param {string} dataDir
@@ -16,10 +24,10 @@ class Program {
16
24
  return true;
17
25
  }
18
26
 
19
- /** @type {TaxonData[]} */
27
+ /** @type {import("./index.js").TaxonData[]} */
20
28
  // @ts-ignore
21
29
  const includeCSV = CSV.readFile(path.join(dataDir, includeFileName));
22
- /** @type {Object<string,TaxonData>} */
30
+ /** @type {Object<string,import("./index.js").TaxonData>} */
23
31
  const include = {};
24
32
  for (const row of includeCSV) {
25
33
  include[row["taxon_name"]] = row;
@@ -14,12 +14,12 @@ class SiteGenerator {
14
14
  }
15
15
 
16
16
  /**
17
- * @param {FlowerColor[]} flowerColors
17
+ * @param {import("./flowercolor.js").FlowerColor[]} flowerColors
18
18
  */
19
19
  copyIllustrations(flowerColors) {
20
20
  /**
21
21
  * @param {string} outputDir
22
- * @param {FlowerColor[]} flowerColors
22
+ * @param {import("./flowercolor.js").FlowerColor[]} flowerColors
23
23
  */
24
24
  function createFlowerColorIcons(outputDir, flowerColors) {
25
25
  // Read generic input.
@@ -28,7 +28,7 @@ class SiteGenerator {
28
28
  for (const color of flowerColors) {
29
29
  Files.write(
30
30
  Files.join(outputDir, "f-" + color.getColorName() + ".svg"),
31
- srcSVG.replace("#ff0", color.getColorCode())
31
+ srcSVG.replace("#ff0", color.getColorCode()),
32
32
  );
33
33
  }
34
34
  // Delete input file.
@@ -69,6 +69,16 @@ class SiteGenerator {
69
69
  mkdir(path) {
70
70
  Files.mkdir(Files.join(this.#baseDir, path));
71
71
  }
72
+
73
+ /**
74
+ * @param {string} content
75
+ * @param {{title:string}} attributes
76
+ * @param {string} filename
77
+ */
78
+ // eslint-disable-next-line no-unused-vars
79
+ writeTemplate(content, attributes, filename) {
80
+ throw new Error("must be implemented by subclass");
81
+ }
72
82
  }
73
83
 
74
84
  export { SiteGenerator };