@ca-plant-list/ca-plant-list 0.2.17 → 0.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.
Files changed (38) hide show
  1. package/data/illustrations/inkscape/asteraceae_floret.svg +125 -83
  2. package/data/illustrations/inkscape/peduncle.svg +38 -34
  3. package/data/synonyms.csv +17 -19
  4. package/data/taxa.csv +7 -11
  5. package/ebook/css/main.css +3 -6
  6. package/jekyll/_layouts/default.html +56 -0
  7. package/jekyll/_layouts/html.html +5 -56
  8. package/jekyll/assets/css/main.css +5 -0
  9. package/lib/basepagerenderer.js +7 -2
  10. package/lib/commandandtaxaprocessor.js +4 -19
  11. package/lib/ebook/ebooksitegenerator.js +34 -0
  12. package/lib/ebook/glossarypages.js +6 -67
  13. package/lib/ebook/images.js +10 -8
  14. package/lib/ebook/pages/taxonpage.js +5 -1
  15. package/lib/ebook/pages/tocpage.js +2 -2
  16. package/lib/ebook/plantbook.js +12 -9
  17. package/lib/errorlog.js +4 -0
  18. package/lib/files.js +5 -0
  19. package/lib/index.d.ts +23 -7
  20. package/lib/index.js +7 -1
  21. package/lib/jekyll.js +13 -1
  22. package/lib/sitegenerator.js +79 -0
  23. package/lib/taxa.js +19 -4
  24. package/lib/taxaprocessor.js +2 -6
  25. package/lib/web/glossarypages.js +23 -18
  26. package/package.json +3 -2
  27. package/scripts/build-ebook.js +8 -12
  28. package/scripts/build-site.js +1 -1
  29. package/data/illustrations/optimized/asteraceae_floret.svg +0 -28
  30. package/data/illustrations/optimized/f-blue.svg +0 -11
  31. package/data/illustrations/optimized/f-orange.svg +0 -11
  32. package/data/illustrations/optimized/f-pink.svg +0 -11
  33. package/data/illustrations/optimized/f-red.svg +0 -11
  34. package/data/illustrations/optimized/f-white.svg +0 -11
  35. package/data/illustrations/optimized/f-yellow.svg +0 -11
  36. package/data/illustrations/optimized/peduncle.svg +0 -21
  37. package/jekyll/glossary.md +0 -5
  38. package/lib/dataloader.js +0 -46
@@ -0,0 +1,79 @@
1
+ import { optimize } from "svgo";
2
+
3
+ import { Config } from "./config.js";
4
+ import { Files } from "./files.js";
5
+
6
+ class SiteGenerator {
7
+ #baseDir;
8
+
9
+ constructor( baseDir ) {
10
+ this.#baseDir = baseDir;
11
+ }
12
+
13
+ copyIllustrations( flowerColors ) {
14
+ function createFlowerColorIcons( outputDir, flowerColors ) {
15
+ // Read generic input.
16
+ const inputFileName = Files.join( outputDir, "flower.svg" );
17
+ const srcSVG = Files.read( inputFileName );
18
+ for ( const color of flowerColors ) {
19
+ Files.write(
20
+ Files.join( outputDir, "f-" + color.name + ".svg" ),
21
+ srcSVG.replace( "#ff0", color.color )
22
+ );
23
+ }
24
+ // Delete input file.
25
+ Files.rmDir( inputFileName );
26
+ }
27
+
28
+ function optimizeSVG( outputDir ) {
29
+ const srcDir = Config.getPackageDir() + "/data/illustrations/inkscape";
30
+ const entries = Files.getDirEntries( srcDir );
31
+ for ( const entry of entries ) {
32
+ const srcFile = Files.join( srcDir, entry );
33
+ const srcSVG = Files.read( srcFile );
34
+ const result = optimize( srcSVG, {
35
+ plugins: [
36
+ {
37
+ name: "preset-default",
38
+ params: {
39
+ overrides: {
40
+ // minifyStyles changes font-weight: normal to 400, which keeps it from being removed as a default.
41
+ // Disable it here and run it last.
42
+ minifyStyles: false,
43
+ removeViewBox: false,
44
+ },
45
+ },
46
+ },
47
+ "convertStyleToAttrs",
48
+ {
49
+ name: "removeAttrs",
50
+ params: {
51
+ attrs: "(style)",
52
+ },
53
+ },
54
+ "removeDimensions",
55
+ "minifyStyles",
56
+ ],
57
+ multipass: true,
58
+ } );
59
+ Files.write( Files.join( outputDir, entry ), result.data );
60
+ }
61
+ }
62
+
63
+ const outputDir = Files.join( this.#baseDir, "i" );
64
+ Files.mkdir( outputDir );
65
+
66
+ optimizeSVG( outputDir );
67
+ createFlowerColorIcons( outputDir, flowerColors );
68
+ }
69
+
70
+ getBaseDir() {
71
+ return this.#baseDir;
72
+ }
73
+
74
+ mkdir( path ) {
75
+ Files.mkdir( Files.join( this.#baseDir, path ) );
76
+ }
77
+ }
78
+
79
+ export { SiteGenerator };
package/lib/taxa.js CHANGED
@@ -4,7 +4,14 @@ import { HTML } from "./html.js";
4
4
  import { CSV } from "./csv.js";
5
5
  import { RarePlants } from "./rareplants.js";
6
6
 
7
- const FLOWER_COLOR_NAMES = [ "white", "red", "pink", "orange", "yellow", "blue" ];
7
+ const FLOWER_COLORS = [
8
+ { name: "white", color: "white" },
9
+ { name: "red", color: "red" },
10
+ { name: "pink", color: "pink" },
11
+ { name: "orange", color: "orange" },
12
+ { name: "yellow", color: "yellow" },
13
+ { name: "blue", color: "blue" },
14
+ ];
8
15
 
9
16
  const TAXA_LIST_COLS = {
10
17
  CESA: {
@@ -73,8 +80,8 @@ class Taxa {
73
80
 
74
81
  this.#errorLog = errorLog;
75
82
 
76
- for ( const color of FLOWER_COLOR_NAMES ) {
77
- this.#flower_colors[ color ] = new FlowerColor( color );
83
+ for ( const color of FLOWER_COLORS ) {
84
+ this.#flower_colors[ color.name ] = new FlowerColor( color.name );
78
85
  }
79
86
 
80
87
  const dataDir = Config.getPackageDir() + "/data";
@@ -130,6 +137,14 @@ class Taxa {
130
137
  return this.#flower_colors[ name ];
131
138
  }
132
139
 
140
+ static getFlowerColorNames() {
141
+ return FLOWER_COLORS.map( ( o ) => o.name );
142
+ }
143
+
144
+ static getFlowerColors() {
145
+ return FLOWER_COLORS;
146
+ }
147
+
133
148
  getTaxon( name ) {
134
149
  return this.#taxa[ name ];
135
150
  }
@@ -206,4 +221,4 @@ class Taxa {
206
221
 
207
222
  }
208
223
 
209
- export { FLOWER_COLOR_NAMES, Taxa, TAXA_LIST_COLS };
224
+ export { Taxa, TAXA_LIST_COLS };
@@ -11,10 +11,6 @@ class TaxaProcessor {
11
11
  this.#taxaLoaderClass = taxaLoaderClass;
12
12
  }
13
13
 
14
- async customProcess() {
15
- throw new Error( "must be implemented by subclass" );
16
- }
17
-
18
14
  getErrorLog() {
19
15
  return this.#taxaLoader.getErrorLog();
20
16
  }
@@ -27,11 +23,11 @@ class TaxaProcessor {
27
23
  return this.#taxaLoader.getTaxa();
28
24
  }
29
25
 
30
- async process() {
26
+ async process( commandRunner ) {
31
27
  console.log( "loading data" );
32
28
  this.#taxaLoader = new this.#taxaLoaderClass( this.#options );
33
29
  await this.#taxaLoader.load();
34
- await this.customProcess();
30
+ await commandRunner( this );
35
31
  this.#taxaLoader.writeErrorLog();
36
32
  }
37
33
 
@@ -1,49 +1,54 @@
1
1
  import { Files, HTML } from "@ca-plant-list/ca-plant-list";
2
2
  import { Glossary } from "../plants/glossary.js";
3
- import { Jekyll } from "../jekyll.js";
3
+ import { Markdown } from "../markdown.js";
4
+
5
+ const ENTRY_DIR = "g";
4
6
 
5
7
  class GlossaryPages {
6
8
 
7
- #outputDir;
8
- #entryDir;
9
+ #siteGenerator;
9
10
  #glossary;
10
11
 
11
- constructor( outputDir ) {
12
- this.#outputDir = outputDir;
13
- this.#entryDir = outputDir + "/g";
12
+ constructor( siteGenerator ) {
13
+ this.#siteGenerator = siteGenerator;
14
14
  this.#glossary = new Glossary();
15
15
  }
16
16
 
17
17
  #generateEntryPage( entry ) {
18
- const front = Jekyll.getFrontMatter( { title: entry.getTermName() } );
19
- const markdown = entry.getMarkdown();
20
- Files.write( this.#entryDir + "/" + entry.getTermName() + ".md", front + markdown );
18
+ const title = entry.getTermName();
19
+ let html = HTML.textElement( "h1", title );
20
+ html += HTML.wrap( "div", Markdown.strToHTML( entry.getMarkdown() ), { class: "glossary" } );
21
+ this.#siteGenerator.writeTemplate( html, { title: title }, Files.join( ENTRY_DIR, title + ".html" ) );
21
22
  }
22
23
 
23
24
  #generateEntryPages() {
25
+
26
+ // Make sure output directory exists.
27
+ this.#siteGenerator.mkdir( ENTRY_DIR );
28
+
24
29
  const entries = this.#glossary.getEntries();
25
30
  for ( const entry of entries ) {
26
31
  this.#generateEntryPage( entry );
27
32
  }
28
33
  }
29
34
 
30
- #generateIncludeFile() {
31
-
35
+ #generateIndexPage() {
32
36
  const links = [];
33
37
  const entries = this.#glossary.getEntries();
34
38
  for ( const entry of entries ) {
35
- links.push( HTML.getLink( "g/" + entry.getHTMLFileName(), entry.getTermName() ) );
39
+ links.push( HTML.getLink( Files.join( ENTRY_DIR, entry.getHTMLFileName() ), entry.getTermName() ) );
36
40
  }
41
+ let html = HTML.wrap( "h1", "Glossary" );
42
+ html += HTML.wrap( "ol", HTML.arrayToLI( links ) );
43
+ this.#siteGenerator.writeTemplate( html, { title: "Glossary" }, "glossary.html" );
44
+ }
37
45
 
38
- Files.write( this.#outputDir + "/_includes/glossary.html", HTML.arrayToLI( links ), true );
39
-
46
+ getGlossary() {
47
+ return this.#glossary;
40
48
  }
41
49
 
42
50
  renderPages() {
43
- // Make sure output directory exists.
44
- Files.mkdir( this.#entryDir );
45
-
46
- this.#generateIncludeFile();
51
+ this.#generateIndexPage();
47
52
  this.#generateEntryPages();
48
53
  }
49
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ca-plant-list/ca-plant-list",
3
- "version": "0.2.17",
3
+ "version": "0.3.0",
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": {
@@ -30,6 +30,7 @@
30
30
  "image-size": "^1.0.2",
31
31
  "markdown-it": "^13.0.1",
32
32
  "sharp": "^0.32.1",
33
+ "svgo": "^3.0.3",
33
34
  "unzipper": "^0.10.11"
34
35
  },
35
36
  "devDependencies": {
@@ -37,4 +38,4 @@
37
38
  "eslint": "^8.26.0",
38
39
  "typescript": "^4.9.3"
39
40
  }
40
- }
41
+ }
@@ -29,14 +29,10 @@ class BookCommand extends CommandProcessor {
29
29
 
30
30
  }
31
31
 
32
- class BookGenerator extends TaxaProcessor {
33
-
34
- async customProcess() {
35
- const options = this.getOptions();
36
- const ebook = new PlantBook( options.outputdir, new Config( options.datadir ), this.getTaxa() );
37
- await ebook.create();
38
- }
39
-
32
+ async function commandRunner( tp ) {
33
+ const options = tp.getOptions();
34
+ const ebook = new PlantBook( options.outputdir, new Config( options.datadir ), tp.getTaxa() );
35
+ await ebook.create();
40
36
  }
41
37
 
42
38
  async function generateEBooks( options ) {
@@ -54,14 +50,14 @@ async function generateEBooks( options ) {
54
50
  if ( Files.isDir( path ) ) {
55
51
  options.datadir = path;
56
52
  options.outputdir = outputBase + suffix;
57
- const gen = new BookGenerator( options );
58
- await gen.process( options );
53
+ const gen = new TaxaProcessor( options );
54
+ await gen.process( commandRunner );
59
55
  }
60
56
  }
61
57
  } else {
62
58
  // Otherwise use the default directory.
63
- const gen = new BookGenerator( options );
64
- await gen.process( options );
59
+ const gen = new TaxaProcessor( options );
60
+ await gen.process( commandRunner );
65
61
  }
66
62
 
67
63
  }
@@ -52,4 +52,4 @@ async function generateSite( taxaProcessor ) {
52
52
  }
53
53
 
54
54
  const gen = new CommandAndTaxaProcessor( "ca-plant-list", "A tool to generate a website with local plant data.", generateSite );
55
- await gen.process();
55
+ await gen.process( generateSite );
@@ -1,28 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
- <svg width="82.437mm" height="84.504mm" version="1.1" viewBox="0 0 82.437 84.504" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
4
- <defs>
5
- <marker id="Triangle" overflow="visible" markerHeight="1" markerWidth="1" orient="auto-start-reverse" preserveAspectRatio="xMidYMid" viewBox="0 0 1 1">
6
- <path transform="scale(.5)" d="m5.77 0-8.65 5v-10z" fill="context-stroke" fill-rule="evenodd" stroke="context-stroke" stroke-width="1pt"/>
7
- </marker>
8
- </defs>
9
- <g transform="translate(-48.054 -6.5123)">
10
- <g fill="#959595">
11
- <path d="m79.276 37.945a8.4667 31.089 0 0 1 1.8353 33.88 8.4667 31.089 0 0 1-7.8222 19.191 8.4667 31.089 0 0 1-7.8222-19.191 8.4667 31.089 0 0 1 1.8353-33.88z"/>
12
- <path d="m48.253 13.074 19.05 24.871" stroke="#888" stroke-width=".5"/>
13
- <path id="path3" d="m98.326 13.074-19.05 24.871" fill="#959595" stroke="#888" stroke-width=".5"/>
14
- </g>
15
- <use transform="rotate(-17.226 77.257 49.068)" xlink:href="#path3"/>
16
- <path d="m55.686 9.6812 13.798 28.126" fill="#959595" stroke="#888" stroke-width=".5"/>
17
- <path d="m62.705 7.5473 8.2896 30.212" fill="#959595" stroke="#888" stroke-width=".5"/>
18
- <use transform="rotate(-5.8666 77.05 56.397)" xlink:href="#path3"/>
19
- <use transform="rotate(-27.32 76.391 49.027)" xlink:href="#path3"/>
20
- <g>
21
- <path d="m69.881 6.5376 3.171 31.167" fill="#959595" stroke="#888" stroke-width=".5"/>
22
- <text x="114.47877" y="66.073151" fill="#050000" font-family="Arial" font-size="4.9389px" stroke="#020000" stroke-width="0" xml:space="preserve"><tspan x="114.47877" y="66.073151" fill="#050000" font-family="Arial" font-size="4.9389px" stroke="#020000" stroke-width="0">achene</tspan></text>
23
- <text x="114.47877" y="28.502281" fill="#050000" font-family="Arial" font-size="4.9389px" stroke="#020000" stroke-width="0" xml:space="preserve"><tspan x="114.47877" y="28.502281" fill="#050000" font-family="Arial" font-size="4.9389px" stroke="#020000" stroke-width="0">pappus</tspan></text>
24
- <path d="m88.996 65.009 20.886-0.12554" marker-start="url(#Triangle)" stroke="#000" stroke-width=".42043"/>
25
- <path d="m90.584 27.967 20.886-0.12554" marker-start="url(#Triangle)" stroke="#000" stroke-width=".42043"/>
26
- </g>
27
- </g>
28
- </svg>
@@ -1,11 +0,0 @@
1
- <svg version="1.1" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"
2
- xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <ellipse id="a" cx="15" cy="15" rx="2.5" ry="15" fill="blue" stroke-width="0" />
4
- <use xlink:href="#a" />
5
- <use transform="rotate(30,15,15)" xlink:href="#a" />
6
- <use transform="rotate(60,15,15)" xlink:href="#a" />
7
- <use transform="rotate(90,15,15)" xlink:href="#a" />
8
- <use transform="rotate(120,15,15)" xlink:href="#a" />
9
- <use transform="rotate(150,15,15)" xlink:href="#a" />
10
- </svg>
11
-
@@ -1,11 +0,0 @@
1
- <svg version="1.1" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"
2
- xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <ellipse id="a" cx="15" cy="15" rx="2.5" ry="15" fill="orange" stroke-width="0" />
4
- <use xlink:href="#a" />
5
- <use transform="rotate(30,15,15)" xlink:href="#a" />
6
- <use transform="rotate(60,15,15)" xlink:href="#a" />
7
- <use transform="rotate(90,15,15)" xlink:href="#a" />
8
- <use transform="rotate(120,15,15)" xlink:href="#a" />
9
- <use transform="rotate(150,15,15)" xlink:href="#a" />
10
- </svg>
11
-
@@ -1,11 +0,0 @@
1
- <svg version="1.1" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"
2
- xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <ellipse id="a" cx="15" cy="15" rx="2.5" ry="15" fill="pink" stroke-width="0" />
4
- <use xlink:href="#a" />
5
- <use transform="rotate(30,15,15)" xlink:href="#a" />
6
- <use transform="rotate(60,15,15)" xlink:href="#a" />
7
- <use transform="rotate(90,15,15)" xlink:href="#a" />
8
- <use transform="rotate(120,15,15)" xlink:href="#a" />
9
- <use transform="rotate(150,15,15)" xlink:href="#a" />
10
- </svg>
11
-
@@ -1,11 +0,0 @@
1
- <svg version="1.1" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"
2
- xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <ellipse id="a" cx="15" cy="15" rx="2.5" ry="15" fill="red" stroke-width="0" />
4
- <use xlink:href="#a" />
5
- <use transform="rotate(30,15,15)" xlink:href="#a" />
6
- <use transform="rotate(60,15,15)" xlink:href="#a" />
7
- <use transform="rotate(90,15,15)" xlink:href="#a" />
8
- <use transform="rotate(120,15,15)" xlink:href="#a" />
9
- <use transform="rotate(150,15,15)" xlink:href="#a" />
10
- </svg>
11
-
@@ -1,11 +0,0 @@
1
- <svg version="1.1" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"
2
- xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <ellipse id="a" cx="15" cy="15" rx="2.5" ry="15" fill="white" stroke-width="0" />
4
- <use xlink:href="#a" />
5
- <use transform="rotate(30,15,15)" xlink:href="#a" />
6
- <use transform="rotate(60,15,15)" xlink:href="#a" />
7
- <use transform="rotate(90,15,15)" xlink:href="#a" />
8
- <use transform="rotate(120,15,15)" xlink:href="#a" />
9
- <use transform="rotate(150,15,15)" xlink:href="#a" />
10
- </svg>
11
-
@@ -1,11 +0,0 @@
1
- <svg version="1.1" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg"
2
- xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <ellipse id="a" cx="15" cy="15" rx="2.5" ry="15" fill="yellow" stroke-width="0" />
4
- <use xlink:href="#a" />
5
- <use transform="rotate(30,15,15)" xlink:href="#a" />
6
- <use transform="rotate(60,15,15)" xlink:href="#a" />
7
- <use transform="rotate(90,15,15)" xlink:href="#a" />
8
- <use transform="rotate(120,15,15)" xlink:href="#a" />
9
- <use transform="rotate(150,15,15)" xlink:href="#a" />
10
- </svg>
11
-
@@ -1,21 +0,0 @@
1
- <svg version="1.1" viewBox="0 0 102.55 60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
- <defs>
3
- <marker id="b" overflow="visible" markerHeight="1" markerWidth="1" orient="auto-start-reverse" preserveAspectRatio="xMidYMid" viewBox="0 0 1 1">
4
- <path transform="scale(.5)" d="m5.77 0-8.65 5v-10z" fill="context-stroke" fill-rule="evenodd" stroke="context-stroke" stroke-width="1pt"/>
5
- </marker>
6
- </defs>
7
- <path d="m15 60v-45" fill="#14140c" stroke="#160707"/>
8
- <use xlink:href="#a"/>
9
- <use transform="rotate(30,15,15)" xlink:href="#a"/>
10
- <use transform="rotate(60,15,15)" xlink:href="#a"/>
11
- <use transform="rotate(90,15,15)" xlink:href="#a"/>
12
- <use transform="rotate(120,15,15)" xlink:href="#a"/>
13
- <use transform="rotate(150,15,15)" xlink:href="#a"/>
14
- <ellipse id="a" cx="15" cy="15" rx="2.5" ry="15" fill="#ff0" stroke-width="0"/>
15
- <g fill="#14140c" stroke="#160707">
16
- <path d="m20 45h25" marker-start="url(#b)" stroke-width=".5"/>
17
- <text x="50" y="47.068359" font-family="Arial" font-size="8px" letter-spacing=".5px" opacity=".55843" stroke-width=".1" xml:space="preserve"><tspan x="50" y="47.068359" font-family="Arial" font-size="8px" letter-spacing=".5px" stroke-width=".1" style="font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal">peduncle</tspan></text>
18
- <path d="m35 15h10" marker-start="url(#b)" stroke-width=".5"/>
19
- <text x="49.696735" y="17.068359" font-family="Arial" font-size="8px" letter-spacing=".5px" opacity=".55843" stroke-width=".1" xml:space="preserve"><tspan x="49.696735" y="17.068359" font-family="Arial" font-size="8px" letter-spacing=".5px" stroke-width=".1" style="font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal">inflorescence</tspan></text>
20
- </g>
21
- </svg>
@@ -1,5 +0,0 @@
1
- ---
2
- title: Glossary
3
- ---
4
-
5
- {%include glossary.html %}
package/lib/dataloader.js DELETED
@@ -1,46 +0,0 @@
1
- import { CSV } from "./csv.js";
2
- import { Taxa } from "./taxa.js";
3
- import { Files } from "./files.js";
4
- import { ErrorLog } from "./errorlog.js";
5
-
6
- class DataLoader {
7
-
8
- static #errorLog = new ErrorLog();
9
-
10
- static getErrorLog() {
11
- return DataLoader.#errorLog;
12
- }
13
-
14
- static load( options ) {
15
-
16
- function getIncludeList( dataDir ) {
17
- // Read inclusion list.
18
- const includeFileName = "taxa_include.csv";
19
- const includeFilePath = dataDir + "/" + includeFileName;
20
- if ( !Files.exists( includeFilePath ) ) {
21
- console.log( includeFilePath + " not found; loading all taxa" );
22
- return true;
23
- }
24
- const includeCSV = CSV.parseFile( dataDir, includeFileName );
25
- const include = {};
26
- for ( const row of includeCSV ) {
27
- include[ row[ "taxon_name" ] ] = row;
28
- }
29
- return include;
30
- }
31
-
32
- const showFlowerErrors = options[ "show-flower-errors" ];
33
-
34
- console.log( "loading data" );
35
-
36
- return new Taxa( getIncludeList( options.datadir ), this.getErrorLog(), showFlowerErrors );
37
-
38
- }
39
-
40
- static writeErrorLog() {
41
- DataLoader.#errorLog.write();
42
- }
43
-
44
- }
45
-
46
- export { DataLoader };