@ca-plant-list/ca-plant-list 0.2.6 → 0.2.7

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 (43) hide show
  1. package/data/glossary/pappus.md +3 -0
  2. package/data/glossary/petiole.md +1 -0
  3. package/data/glossary/phyllary.md +1 -0
  4. package/data/glossary/stipule.md +1 -0
  5. package/data/illustrations/inkscape/asteraceae_floret.svg +157 -0
  6. package/data/illustrations/optimized/asteraceae_floret.svg +28 -0
  7. package/data/taxa.csv +142 -141
  8. package/data/text/Clematis-ligusticifolia.md +1 -0
  9. package/data/text/Grindelia-camporum.md +1 -1
  10. package/data/text/Grindelia-hirsutula.md +1 -1
  11. package/data/text/Lonicera-interrupta.md +1 -0
  12. package/data/text/Lonicera-subspicata-var-denudata.md +1 -0
  13. package/data/text/Taraxacum-officinale.md +1 -1
  14. package/data/text/Wyethia-angustifolia.md +1 -1
  15. package/data/text/Wyethia-glabra.md +1 -1
  16. package/data/text/Wyethia-helenioides.md +1 -1
  17. package/jekyll/_includes/glossary.html +0 -0
  18. package/jekyll/_layouts/html.html +3 -0
  19. package/jekyll/glossary.md +5 -0
  20. package/lib/basepagerenderer.js +5 -0
  21. package/lib/ebook/ebook.js +24 -0
  22. package/lib/ebook/ebookpage.js +4 -2
  23. package/lib/ebook/glossarypages.js +101 -0
  24. package/lib/ebook/images.js +86 -0
  25. package/lib/ebook/pages/taxonpage.js +2 -3
  26. package/lib/ebook/pages/tocpage.js +1 -0
  27. package/lib/ebook/plantbook.js +17 -67
  28. package/lib/genericpage.js +20 -4
  29. package/lib/html.js +1 -1
  30. package/lib/index.d.ts +18 -12
  31. package/lib/jekyll.js +11 -0
  32. package/lib/markdown.js +18 -0
  33. package/lib/pagerenderer.js +2 -3
  34. package/lib/plants/glossary.js +52 -0
  35. package/lib/web/glossarypages.js +52 -0
  36. package/lib/{pagetaxon.js → web/pagetaxon.js} +6 -6
  37. package/package.json +1 -1
  38. /package/{ebook/i → data/illustrations/optimized}/f-blue.svg +0 -0
  39. /package/{ebook/i → data/illustrations/optimized}/f-orange.svg +0 -0
  40. /package/{ebook/i → data/illustrations/optimized}/f-pink.svg +0 -0
  41. /package/{ebook/i → data/illustrations/optimized}/f-red.svg +0 -0
  42. /package/{ebook/i → data/illustrations/optimized}/f-white.svg +0 -0
  43. /package/{ebook/i → data/illustrations/optimized}/f-yellow.svg +0 -0
@@ -0,0 +1 @@
1
+ Found along streams and in wet places.
@@ -1 +1 @@
1
- Phyllaries flattened only at bases (rounded in cross section distally), phyllary tips often reflexed, or coiled; plants generally not hairy.
1
+ [Phyllaries](g/phyllary.html) flattened only at bases (rounded in cross section distally), phyllary tips often reflexed, or coiled; plants generally not hairy.
@@ -1 +1 @@
1
- Phyllaries flattened, plants generally hairy.
1
+ [Phyllaries](g/phyllary.html) flattened, plants generally hairy.
@@ -0,0 +1 @@
1
+ Upper leaf pairs fused around stem. No [stipules](g/stipule.html), corolla not hairy.
@@ -0,0 +1 @@
1
+ Upper leaf pairs not fused around stem.
@@ -1 +1 @@
1
- Leaves basal. Stem not branched. Outer phyllaries much smaller than inner.
1
+ Leaves basal. Stem not branched. Outer [phyllaries](g/phyllary.html) much smaller than inner.
@@ -1 +1 @@
1
- Outer phyllaries narrow and roughly the same width as inner.
1
+ Outer [phyllaries](g/phyllary.html) narrow and roughly the same width as inner.
@@ -1 +1 @@
1
- Outer phyllaries wide, leaf-like, and usually much larger than inner phyllaries. Generally not hairy or with some glandular hairs.
1
+ Outer [phyllaries](g/phyllary.html) wide, leaf-like, and usually much larger than inner phyllaries. Generally not hairy or with some glandular hairs.
@@ -1 +1 @@
1
- Outer phyllaries wide, leaf-like, and usually much larger than inner phyllaries. Plant densely tomentose.
1
+ Outer [phyllaries](g/phyllary.html) wide, leaf-like, and usually much larger than inner phyllaries. Plant densely tomentose.
File without changes
@@ -31,6 +31,9 @@
31
31
  <li class="nav-item">
32
32
  <a class="nav-link" href="{{site.baseurl}}/name_search.html">Name Search</a>
33
33
  </li>
34
+ <li class="nav-item">
35
+ <a class="nav-link" href="{{site.baseurl}}/glossary.html">Glossary</a>
36
+ </li>
34
37
  {%include menu_extra.html %}
35
38
  </ul>
36
39
  </div>
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: Glossary
3
+ ---
4
+
5
+ {%include glossary.html %}
@@ -1,6 +1,7 @@
1
1
  import { Config } from "./config.js";
2
2
  import { Families } from "./families.js";
3
3
  import { Files } from "./files.js";
4
+ import { GlossaryPages } from "./web/glossarypages.js";
4
5
 
5
6
  class BasePageRenderer {
6
7
 
@@ -12,9 +13,13 @@ class BasePageRenderer {
12
13
  Files.copyDir( Config.getPackageDir() + "/jekyll", outputDir );
13
14
  // Then copy Jekyll files from current dir (which may override default files).
14
15
  Files.copyDir( "jekyll", outputDir );
16
+ // Copy illustrations.
17
+ Files.copyDir( Config.getPackageDir() + "/data/illustrations/optimized", outputDir + "/i" );
15
18
 
16
19
  Families.renderPages( outputDir, familyCols );
17
20
 
21
+ new GlossaryPages( outputDir ).renderPages();
22
+
18
23
  this.renderTools( outputDir, Taxa );
19
24
 
20
25
  }
@@ -3,6 +3,18 @@ import { default as archiver } from "archiver";
3
3
  import { XHTML } from "./xhtml.js";
4
4
  import { Config } from "../config.js";
5
5
 
6
+ const MEDIA_TYPES = {
7
+ SVG: "image/svg+xml",
8
+ JPG: "image/jpeg",
9
+ XHTML: "application/xhtml+xml",
10
+ };
11
+
12
+ const EXT_MEDIA_MAP = {
13
+ "jpeg": MEDIA_TYPES.JPG,
14
+ "jpg": MEDIA_TYPES.JPG,
15
+ "svg": MEDIA_TYPES.SVG,
16
+ };
17
+
6
18
  class EBook {
7
19
 
8
20
  #outputDir;
@@ -103,6 +115,18 @@ class EBook {
103
115
  return this.#outputDir + "/epub";
104
116
  }
105
117
 
118
+ static getManifestEntry( id, href, mediaType = MEDIA_TYPES.XHTML ) {
119
+ return "<item id=\"" + id + "\" href=\"" + href + "\" media-type=\"" + mediaType + "\" />";
120
+ }
121
+
122
+ static getMediaTypeForExt( ext ) {
123
+ return EXT_MEDIA_MAP[ ext ];
124
+ }
125
+
126
+ static getSpineEntry( id ) {
127
+ return "<itemref idref=\"" + id + "\"/>";
128
+ }
129
+
106
130
  #getMetaDir() {
107
131
  return this.#outputDir + "/META-INF";
108
132
  }
@@ -4,10 +4,12 @@ class EBookPage {
4
4
 
5
5
  #fileName;
6
6
  #title;
7
+ #rootPrefix;
7
8
 
8
- constructor( fileName, title ) {
9
+ constructor( fileName, title, rootPrefix = "" ) {
9
10
  this.#fileName = fileName;
10
11
  this.#title = title;
12
+ this.#rootPrefix = rootPrefix;
11
13
  }
12
14
 
13
15
  create() {
@@ -37,7 +39,7 @@ class EBookPage {
37
39
  let html = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
38
40
  html += "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">";
39
41
  html += "<head><title>" + title + "</title>";
40
- html += "<link href=\"./css/main.css\" rel=\"stylesheet\" />";
42
+ html += "<link href=\"" + this.#rootPrefix + "css/main.css\" rel=\"stylesheet\" />";
41
43
  html += "</head>" + this.#renderBodyStart();
42
44
  return html;
43
45
  }
@@ -0,0 +1,101 @@
1
+ import * as fs from "node:fs";
2
+
3
+ import { EBookPage } from "./ebookpage.js";
4
+ import { XHTML } from "./xhtml.js";
5
+
6
+ import { HTML } from "../html.js";
7
+ import { Markdown } from "../markdown.js";
8
+ import { EBook } from "./ebook.js";
9
+
10
+ import { Glossary } from "../plants/glossary.js";
11
+
12
+ class GlossaryPages {
13
+
14
+ #glossary;
15
+
16
+ constructor() {
17
+ this.#glossary = new Glossary();
18
+ }
19
+
20
+ createPages( contentDir ) {
21
+
22
+ const termList = [];
23
+
24
+ // Create target directory.
25
+ const dirTarget = contentDir + "/g";
26
+ fs.mkdirSync( dirTarget, { recursive: true } );
27
+
28
+ for ( const entry of this.#glossary.getEntries() ) {
29
+
30
+ new PageGlossaryEntry( contentDir, entry ).create();
31
+
32
+ // Add term to index page list.
33
+ termList.push( HTML.getLink( "g/" + entry.getHTMLFileName(), entry.getTermName() ) );
34
+
35
+ }
36
+
37
+ // Write glossary index page.
38
+ new PageGlossary( contentDir, termList ).create();
39
+ }
40
+
41
+ getManifestEntries() {
42
+
43
+ const glossaryEntries = this.#glossary.getEntries();
44
+ const manifestEntries = [];
45
+
46
+ manifestEntries.push( EBook.getManifestEntry( "g", "glossary.html" ) );
47
+ for ( let index = 0; index < glossaryEntries.length; index++ ) {
48
+ const entry = glossaryEntries[ index ];
49
+ manifestEntries.push( EBook.getManifestEntry( "g" + index, "g/" + entry.getHTMLFileName() ) );
50
+ }
51
+
52
+ return manifestEntries.join( "" );
53
+ }
54
+
55
+ getSpineEntries() {
56
+
57
+ const glossaryEntries = this.#glossary.getEntries();
58
+ const spineEntries = [];
59
+
60
+ spineEntries.push( EBook.getSpineEntry( "g", "glossary.html" ) );
61
+ for ( let index = 0; index < glossaryEntries.length; index++ ) {
62
+ spineEntries.push( EBook.getSpineEntry( "g" + index ) );
63
+ }
64
+
65
+ return spineEntries.join( "" );
66
+
67
+ }
68
+
69
+ }
70
+
71
+ class PageGlossary extends EBookPage {
72
+
73
+ #entries;
74
+
75
+ constructor( outputDir, entries ) {
76
+ super( outputDir + "/glossary.html", "Glossary" );
77
+ this.#entries = entries;
78
+ }
79
+
80
+ renderPageBody() {
81
+ const html = XHTML.textElement( "h1", this.getTitle() );
82
+ return html + XHTML.wrap( "ol", XHTML.arrayToLI( this.#entries ) );
83
+ }
84
+ }
85
+
86
+ class PageGlossaryEntry extends EBookPage {
87
+
88
+ #entry;
89
+
90
+ constructor( outputDir, entry ) {
91
+ super( outputDir + "/g/" + entry.getHTMLFileName(), entry.getTermName(), "../" );
92
+ this.#entry = entry;
93
+ }
94
+
95
+ renderPageBody() {
96
+ const html = XHTML.textElement( "h1", this.getTitle() );
97
+ return html + Markdown.strToHTML( this.#entry.getMarkdown() );
98
+ }
99
+ }
100
+
101
+ export { GlossaryPages };
@@ -0,0 +1,86 @@
1
+ import * as fs from "node:fs";
2
+ import path from "node:path";
3
+
4
+ import sharp from "sharp";
5
+
6
+ import { Config, CSV, Files, Taxa } from "@ca-plant-list/ca-plant-list";
7
+
8
+ import { Image } from "./image.js";
9
+ import { EBook } from "./ebook.js";
10
+
11
+ class Images {
12
+
13
+ #contentDir;
14
+ #images = {};
15
+
16
+ constructor( contentDir ) {
17
+ this.#contentDir = contentDir;
18
+ }
19
+
20
+ async createImages() {
21
+
22
+ const photoDirSrc = "external_data/photos";
23
+ const imagePrefix = "i";
24
+ const photoDirTarget = this.#contentDir + "/" + imagePrefix;
25
+ fs.mkdirSync( photoDirSrc, { recursive: true } );
26
+ fs.mkdirSync( photoDirTarget, { recursive: true } );
27
+
28
+ const rows = CSV.parseFile( Config.getPackageDir() + "/data", "photos.csv" );
29
+ for ( const row of rows ) {
30
+
31
+ const name = row[ "taxon_name" ];
32
+ const taxon = Taxa.getTaxon( name );
33
+ if ( !taxon ) {
34
+ continue;
35
+ }
36
+
37
+ let imageList = this.#images[ name ];
38
+ if ( !imageList ) {
39
+ imageList = [];
40
+ this.#images[ name ] = imageList;
41
+ }
42
+
43
+ const src = new URL( row[ "source" ] );
44
+ const parts = path.parse( src.pathname ).dir.split( "/" );
45
+ const prefix = src.host.includes( "calflora" ) ? "cf-" : "inat-";
46
+ const filename = prefix + parts.slice( -1 )[ 0 ] + ".jpg";
47
+ const srcFileName = photoDirSrc + "/" + filename;
48
+ const targetFileName = photoDirTarget + "/" + filename;
49
+
50
+ if ( !fs.existsSync( srcFileName ) ) {
51
+ // File is not there; retrieve it.
52
+ console.log( "retrieving " + srcFileName );
53
+ await Files.fetch( src, srcFileName );
54
+ }
55
+
56
+ await new sharp( srcFileName ).resize( { width: 400 } ).jpeg( { quality: 40 } ).toFile( targetFileName );
57
+
58
+ imageList.push( new Image( imagePrefix + "/" + filename, row[ "credit" ] ) );
59
+
60
+ }
61
+
62
+ this.#getIllustrations( this.#contentDir );
63
+
64
+ }
65
+
66
+ #getIllustrations() {
67
+ Files.copyDir( Config.getPackageDir() + "/data/illustrations/optimized", this.#contentDir + "/i" );
68
+ }
69
+
70
+ getManifestEntries() {
71
+
72
+ const entries = [];
73
+ const images = Files.getDirEntries( this.#contentDir + "/i" ).sort();
74
+
75
+ for ( let index = 0; index < images.length; index++ ) {
76
+ const fileName = images[ index ];
77
+ const ext = fileName.split( "." )[ 1 ];
78
+ entries.push( EBook.getManifestEntry( "i" + index, "i/" + fileName, EBook.getMediaTypeForExt( ext ) ) );
79
+ }
80
+
81
+ return entries.join( "" );
82
+ }
83
+
84
+ }
85
+
86
+ export { Images };
@@ -1,8 +1,8 @@
1
1
  import sizeOf from "image-size";
2
- import markdownIt from "markdown-it";
3
2
  import { Config, Files } from "@ca-plant-list/ca-plant-list";
4
3
  import { EBookPage } from "../ebookpage.js";
5
4
  import { XHTML } from "../xhtml.js";
5
+ import { Markdown } from "../../markdown.js";
6
6
 
7
7
  class TaxonPage extends EBookPage {
8
8
 
@@ -39,8 +39,7 @@ class TaxonPage extends EBookPage {
39
39
  return "";
40
40
  }
41
41
  const text = Files.read( fileName );
42
- const md = new markdownIt();
43
- return md.render( text );
42
+ return Markdown.strToHTML( text );
44
43
  }
45
44
 
46
45
  const name = this.#taxon.getName();
@@ -17,6 +17,7 @@ class TOCPage extends EBookPage {
17
17
  mainLinks.push( this.#getFlowerColorLinks() );
18
18
  mainLinks.push( XHTML.getLink( "./list_families.html", "All Families" ) );
19
19
  mainLinks.push( XHTML.getLink( "./list_species.html", "All Species" ) );
20
+ mainLinks.push( XHTML.getLink( "./glossary.html", "Glossary" ) );
20
21
  html += XHTML.wrap( "ol", XHTML.arrayToLI( mainLinks ) );
21
22
 
22
23
  html += "</nav>";
@@ -1,9 +1,7 @@
1
- import * as fs from "node:fs";
2
- import path from "node:path";
3
- import sharp from "sharp";
4
- import { CSV, Families, Files, Taxa } from "@ca-plant-list/ca-plant-list";
1
+ import { Families, Taxa } from "@ca-plant-list/ca-plant-list";
5
2
  import { EBook } from "./ebook.js";
6
- import { Image } from "./image.js";
3
+ import { GlossaryPages } from "./glossarypages.js";
4
+ import { Images } from "./images.js";
7
5
  import { PageListFamilies } from "./pages/page_list_families.js";
8
6
  import { PageListFlowerColor } from "./pages/page_list_flower_color.js";
9
7
  import { PageListSpecies } from "./pages/page_list_species.js";
@@ -14,7 +12,8 @@ import { FLOWER_COLOR_NAMES } from "../taxa.js";
14
12
 
15
13
  class PlantBook extends EBook {
16
14
 
17
- #images = {};
15
+ #glossary;
16
+ #images;
18
17
 
19
18
  constructor() {
20
19
 
@@ -25,13 +24,13 @@ class PlantBook extends EBook {
25
24
  Config.getConfigValue( "ebook", "title" )
26
25
  );
27
26
 
27
+ this.#glossary = new GlossaryPages();
28
+ this.#images = new Images( this.getContentDir() );
29
+
28
30
  }
29
31
 
30
32
  async createPages() {
31
33
 
32
- console.log( "checking images" );
33
- await this.#importImages();
34
-
35
34
  const contentDir = this.getContentDir();
36
35
 
37
36
  console.log( "creating taxon pages" );
@@ -56,63 +55,16 @@ class PlantBook extends EBook {
56
55
  }
57
56
  new PageListSpecies( contentDir, taxa, "list_species.html", "All Species" ).create();
58
57
 
59
- new TOCPage( contentDir ).create();
60
- }
61
-
62
- async #importImages() {
63
-
64
- const photoDirSrc = "external_data/photos";
65
- const imagePrefix = "i";
66
- const photoDirTarget = this.getContentDir() + "/" + imagePrefix;
67
- fs.mkdirSync( photoDirSrc, { recursive: true } );
68
- fs.mkdirSync( photoDirTarget, { recursive: true } );
69
-
70
- const rows = CSV.parseFile( Config.getPackageDir() + "/data", "photos.csv" );
71
- for ( const row of rows ) {
72
-
73
- const name = row[ "taxon_name" ];
74
- const taxon = Taxa.getTaxon( name );
75
- if ( !taxon ) {
76
- continue;
77
- }
78
-
79
- let imageList = this.#images[ name ];
80
- if ( !imageList ) {
81
- imageList = [];
82
- this.#images[ name ] = imageList;
83
- }
84
-
85
- const src = new URL( row[ "source" ] );
86
- const parts = path.parse( src.pathname ).dir.split( "/" );
87
- const prefix = src.host.includes( "calflora" ) ? "cf-" : "inat-";
88
- const filename = prefix + parts.slice( -1 )[ 0 ] + ".jpg";
89
- const srcFileName = photoDirSrc + "/" + filename;
90
- const targetFileName = photoDirTarget + "/" + filename;
91
-
92
- if ( !fs.existsSync( srcFileName ) ) {
93
- // File is not there; retrieve it.
94
- console.log( "retrieving " + srcFileName );
95
- await Files.fetch( src, srcFileName );
96
- }
97
-
98
- await new sharp( srcFileName ).resize( { width: 400 } ).jpeg( { quality: 40 } ).toFile( targetFileName );
58
+ await this.#images.createImages( contentDir );
59
+ this.#glossary.createPages( contentDir );
99
60
 
100
- imageList.push( new Image( imagePrefix + "/" + filename, row[ "credit" ] ) );
101
-
102
- }
61
+ new TOCPage( contentDir ).create();
103
62
  }
104
63
 
105
64
  renderManifestEntries() {
106
65
 
107
66
  let xml = "";
108
67
 
109
- xml += "<item id=\"f0\" href=\"i/f-blue.svg\" media-type=\"image/svg+xml\" />";
110
- xml += "<item id=\"f1\" href=\"i/f-orange.svg\" media-type=\"image/svg+xml\" />";
111
- xml += "<item id=\"f2\" href=\"i/f-pink.svg\" media-type=\"image/svg+xml\" />";
112
- xml += "<item id=\"f3\" href=\"i/f-red.svg\" media-type=\"image/svg+xml\" />";
113
- xml += "<item id=\"f4\" href=\"i/f-white.svg\" media-type=\"image/svg+xml\" />";
114
- xml += "<item id=\"f5\" href=\"i/f-yellow.svg\" media-type=\"image/svg+xml\" />";
115
-
116
68
  // Add lists.
117
69
  xml += "<item id=\"lspecies\" href=\"list_species.html\" media-type=\"application/xhtml+xml\" />";
118
70
  xml += "<item id=\"lfamilies\" href=\"list_families.html\" media-type=\"application/xhtml+xml\" />";
@@ -137,14 +89,9 @@ class PlantBook extends EBook {
137
89
  xml += "<item id=\"t" + index + "\" href=\"" + taxon.getFileName() + "\" media-type=\"application/xhtml+xml\" />";
138
90
  }
139
91
 
140
- // Add images.
141
- let index = 0;
142
- for ( const imageList of Object.values( this.#images ) ) {
143
- for ( const image of imageList ) {
144
- xml += "<item id=\"i" + index + "\" href=\"" + image.getSrc() + "\" media-type=\"image/jpeg\" />";
145
- index++;
146
- }
147
- }
92
+ xml += this.#glossary.getManifestEntries();
93
+ xml += this.#images.getManifestEntries();
94
+
148
95
  return xml;
149
96
  }
150
97
 
@@ -172,6 +119,9 @@ class PlantBook extends EBook {
172
119
  for ( let index = 0; index < Taxa.getTaxa().length; index++ ) {
173
120
  xml += "<itemref idref=\"t" + index + "\"/>";
174
121
  }
122
+
123
+ xml += this.#glossary.getSpineEntries();
124
+
175
125
  return xml;
176
126
  }
177
127
  }
@@ -1,4 +1,5 @@
1
- import { Files, HTML, Jekyll } from "@ca-plant-list/ca-plant-list";
1
+ import { Config, Files, HTML, Jekyll } from "@ca-plant-list/ca-plant-list";
2
+ import { Markdown } from "./markdown.js";
2
3
 
3
4
  class GenericPage {
4
5
 
@@ -19,11 +20,18 @@ class GenericPage {
19
20
  }
20
21
 
21
22
  getDefaultIntro() {
23
+
22
24
  let html = this.#getFrontMatter();
23
- const introPath = "intros/" + this.#baseFileName + ".md";
24
- if ( Jekyll.hasInclude( this.#outputDir, introPath ) ) {
25
- html += HTML.wrap( "div", Jekyll.include( introPath ), { class: "section" } );
25
+
26
+ // Include site-specific markdown.
27
+ html += this.#getMarkdown( "intros" );
28
+
29
+ // Include package markdown.
30
+ const mdPath = Config.getPackageDir() + "/data/text/" + this.#baseFileName + ".md";
31
+ if ( Files.exists( mdPath ) ) {
32
+ html += HTML.wrap( "div", Markdown.fileToHTML( mdPath ), { class: "section" } );
26
33
  }
34
+
27
35
  return html;
28
36
  }
29
37
 
@@ -34,6 +42,14 @@ class GenericPage {
34
42
  + "---\n";
35
43
  }
36
44
 
45
+ #getMarkdown( path ) {
46
+ const textPath = path + "/" + this.#baseFileName + ".md";
47
+ if ( !Jekyll.hasInclude( this.#outputDir, textPath ) ) {
48
+ return "";
49
+ }
50
+ return HTML.wrap( "div", Jekyll.include( textPath ), { class: "section" } );
51
+ }
52
+
37
53
  getOutputDir() {
38
54
  return this.#outputDir;
39
55
  }
package/lib/html.js CHANGED
@@ -65,7 +65,7 @@ export class HTML {
65
65
  if ( openInNewWindow ) {
66
66
  html += this.renderAttribute( "target", "_blank" );
67
67
  }
68
- return html + ">" + this.escapeText( linkText ) + "</a >";
68
+ return html + ">" + this.escapeText( linkText ) + "</a>";
69
69
  }
70
70
 
71
71
  /**
package/lib/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export class Config {
12
12
  }
13
13
  export class CSV {
14
14
  static getMap(dir: any, fileName: any): {};
15
- static "__#8@#getOptions"(fileName: any, columns: any, delimiter: any): {
15
+ static "__#9@#getOptions"(fileName: any, columns: any, delimiter: any): {
16
16
  relax_column_count_less: boolean;
17
17
  };
18
18
  static parseFile(dir: any, fileName: any, columns: boolean, delimiter: any): any;
@@ -28,19 +28,19 @@ export class DataLoader {
28
28
  static load(options: any): void;
29
29
  }
30
30
  export class ErrorLog {
31
- static "__#7@#errors": any[];
31
+ static "__#8@#errors": any[];
32
32
  static log(...args: any[]): void;
33
33
  static write(fileName: any): void;
34
34
  }
35
35
  export class Exceptions {
36
- static "__#17@#exceptions": {};
36
+ static "__#21@#exceptions": {};
37
37
  static getExceptions(): [string, any][];
38
38
  static getValue(name: any, cat: any, subcat: any, defaultValue: any): any;
39
39
  static hasException(name: any, cat: any, subcat: any): boolean;
40
40
  static init(dir: any): void;
41
41
  }
42
42
  export class Families {
43
- static "__#11@#families": any;
43
+ static "__#12@#families": any;
44
44
  static getFamilies(): any[];
45
45
  static getFamily(familyName: any): any;
46
46
  static init(): void;
@@ -67,7 +67,7 @@ export class Files {
67
67
  static zipFileExtract(zipFilePath: any, fileNameToUnzip: any, targetFilePath: any): Promise<void>;
68
68
  }
69
69
  export class Genera {
70
- static "__#4@#genera": any;
70
+ static "__#5@#genera": any;
71
71
  static addTaxon(taxon: any): void;
72
72
  static getGenus(genusName: any): Genus;
73
73
  static getFamily(genusName: any): any;
@@ -101,7 +101,7 @@ export class HTML {
101
101
  * @deprecated
102
102
  */
103
103
  static getElement(elName: any, text: any, attributes?: {}, options?: number): string;
104
- static "__#3@#getElement"(elName: any, text: any, attributes: any, escape: any): string;
104
+ static "__#4@#getElement"(elName: any, text: any, attributes: any, escape: any): string;
105
105
  /**
106
106
  * Generate HTML for an &lt;a> element.
107
107
  * @param {string|undefined} href
@@ -143,6 +143,7 @@ import { TAXA_COLNAMES } from "./taxon.js";
143
143
  import { Taxon } from "./taxon.js";
144
144
  export { BasePageRenderer, Config, CSV, DataLoader, ErrorLog, Exceptions, Families, Files, HTML, Jekyll, PlantBook, Taxa, TAXA_COLNAMES, Taxon };
145
145
  export class Jekyll {
146
+ static getFrontMatter(atts: any): string;
146
147
  static hasInclude(baseDir: any, path: any): boolean;
147
148
  static include(path: any): string;
148
149
  static writeInclude(baseDir: any, path: any, data: any): void;
@@ -150,6 +151,11 @@ export class Jekyll {
150
151
  export class Jepson {
151
152
  static getEFloraLink(id: any): string;
152
153
  }
154
+ export class Markdown {
155
+ static "__#2@#md": any;
156
+ static fileToHTML(filePath: any): any;
157
+ static strToHTML(str: any): any;
158
+ }
153
159
  export class RarePlants {
154
160
  static getCESADescription(cesa: any): any;
155
161
  static getFESADescription(fesa: any): any;
@@ -158,9 +164,9 @@ export class RarePlants {
158
164
  }
159
165
  export const FLOWER_COLOR_NAMES: string[];
160
166
  export class Taxa {
161
- static "__#10@#taxa": {};
162
- static "__#10@#flower_colors": {};
163
- static "__#10@#sortedTaxa": any;
167
+ static "__#11@#taxa": {};
168
+ static "__#11@#flower_colors": {};
169
+ static "__#11@#sortedTaxa": any;
164
170
  static getHTMLTable(taxa: any, columns?: {
165
171
  title: string;
166
172
  data: (t: any) => any;
@@ -169,8 +175,8 @@ export class Taxa {
169
175
  static getTaxa(): any;
170
176
  static getTaxon(name: any): any;
171
177
  static init(inclusionList: any, taxaMeta?: {}, taxonClass?: typeof Taxon, extraTaxa?: any[], extraSynonyms?: any[]): void;
172
- static "__#10@#loadSyns"(synCSV: any, inclusionList: any): void;
173
- static "__#10@#loadTaxa"(taxaCSV: any, inclusionList: any, taxaMeta: any, taxonClass: any): void;
178
+ static "__#11@#loadSyns"(synCSV: any, inclusionList: any): void;
179
+ static "__#11@#loadTaxa"(taxaCSV: any, inclusionList: any, taxaMeta: any, taxonClass: any): void;
174
180
  }
175
181
  export namespace TAXA_LIST_COLS {
176
182
  namespace CESA {
@@ -228,7 +234,7 @@ export class Taxon {
228
234
  getFileName(ext?: string): string;
229
235
  getFlowerColors(): any;
230
236
  getGenus(): {
231
- "__#5@#data": any;
237
+ "__#6@#data": any;
232
238
  getTaxa(): any;
233
239
  };
234
240
  getGenusName(): any;
package/lib/jekyll.js CHANGED
@@ -1,7 +1,18 @@
1
1
  import { Files } from "./files.js";
2
2
 
3
+ const FRONT_DELIM = "---";
4
+
3
5
  class Jekyll {
4
6
 
7
+ static getFrontMatter( atts ) {
8
+ const lines = [ FRONT_DELIM ];
9
+ for ( const [ k, v ] of Object.entries( atts ) ) {
10
+ lines.push( k + ": \"" + v + "\"" );
11
+ }
12
+ lines.push( FRONT_DELIM );
13
+ return lines.join( "\n" ) + "\n";
14
+ }
15
+
5
16
  static hasInclude( baseDir, path ) {
6
17
  return Files.exists( baseDir + "/_includes/" + path );
7
18
  }