@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,18 @@
1
+ import markdownIt from "markdown-it";
2
+ import { Files } from "@ca-plant-list/ca-plant-list";
3
+
4
+ class Markdown {
5
+
6
+ static #md = new markdownIt( { xhtmlOut: true } );
7
+
8
+ static fileToHTML( filePath ) {
9
+ return this.strToHTML( Files.read( filePath ) );
10
+ }
11
+
12
+ static strToHTML( str ) {
13
+ return this.#md.render( str );
14
+ }
15
+
16
+ }
17
+
18
+ export { Markdown };
@@ -1,10 +1,9 @@
1
- import { HTML } from "./html.js";
1
+ import { Files, HTML } from "@ca-plant-list/ca-plant-list";
2
2
  import { Taxa, TAXA_LIST_COLS } from "./taxa.js";
3
- import { PageTaxon } from "./pagetaxon.js";
3
+ import { PageTaxon } from "./web/pagetaxon.js";
4
4
  import { Config } from "./config.js";
5
5
  import { RarePlants } from "./rareplants.js";
6
6
  import { BasePageRenderer } from "./basepagerenderer.js";
7
- import { Files } from "./files.js";
8
7
  import { GenericPage } from "./genericpage.js";
9
8
 
10
9
  const ENDANGERED_COLS = [ TAXA_LIST_COLS.SPECIES, TAXA_LIST_COLS.COMMON_NAME, TAXA_LIST_COLS.CESA, TAXA_LIST_COLS.FESA ];
@@ -0,0 +1,52 @@
1
+ import { Config, Files } from "@ca-plant-list/ca-plant-list";
2
+
3
+ class Glossary {
4
+
5
+ #srcPath;
6
+ #srcEntries = [];
7
+
8
+ constructor() {
9
+
10
+ this.#srcPath = Config.getPackageDir() + "/data/glossary";
11
+
12
+ // Find all entries in the glossary directory.
13
+ const entries = Files.getDirEntries( this.#srcPath ).sort();
14
+ for ( const entry of entries ) {
15
+ this.#srcEntries.push( new GlossaryEntry( this.#srcPath, entry ) );
16
+ }
17
+
18
+ }
19
+
20
+ getEntries() {
21
+ return this.#srcEntries;
22
+ }
23
+
24
+ }
25
+
26
+ class GlossaryEntry {
27
+
28
+ #srcPath;
29
+ #fileName;
30
+ #term;
31
+
32
+ constructor( srcPath, fileName ) {
33
+ this.#srcPath = srcPath;
34
+ this.#fileName = fileName;
35
+ this.#term = fileName.split( "." )[ 0 ];
36
+ }
37
+
38
+ getHTMLFileName() {
39
+ return this.#term + ".html";
40
+ }
41
+
42
+ getMarkdown() {
43
+ return Files.read( this.#srcPath + "/" + this.#fileName );
44
+ }
45
+
46
+ getTermName() {
47
+ return this.#term;
48
+ }
49
+
50
+ }
51
+
52
+ export { Glossary };
@@ -0,0 +1,52 @@
1
+ import { Files, HTML } from "@ca-plant-list/ca-plant-list";
2
+ import { Glossary } from "../plants/glossary.js";
3
+ import { Jekyll } from "../jekyll.js";
4
+
5
+ class GlossaryPages {
6
+
7
+ #outputDir;
8
+ #entryDir;
9
+ #glossary;
10
+
11
+ constructor( outputDir ) {
12
+ this.#outputDir = outputDir;
13
+ this.#entryDir = outputDir + "/g";
14
+ this.#glossary = new Glossary();
15
+ }
16
+
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 );
21
+ }
22
+
23
+ #generateEntryPages() {
24
+ const entries = this.#glossary.getEntries();
25
+ for ( const entry of entries ) {
26
+ this.#generateEntryPage( entry );
27
+ }
28
+ }
29
+
30
+ #generateIncludeFile() {
31
+
32
+ const links = [];
33
+ const entries = this.#glossary.getEntries();
34
+ for ( const entry of entries ) {
35
+ links.push( HTML.getLink( "g/" + entry.getHTMLFileName(), entry.getTermName() ) );
36
+ }
37
+
38
+ Files.write( this.#outputDir + "/_includes/glossary.html", HTML.arrayToLI( links ), true );
39
+
40
+ }
41
+
42
+ renderPages() {
43
+ // Make sure output directory exists.
44
+ Files.mkdir( this.#entryDir );
45
+
46
+ this.#generateIncludeFile();
47
+ this.#generateEntryPages();
48
+ }
49
+
50
+ }
51
+
52
+ export { GlossaryPages };
@@ -1,9 +1,9 @@
1
- import { HTML } from "./html.js";
2
- import { Jepson } from "./jepson.js";
3
- import { Config } from "./config.js";
4
- import { RarePlants } from "./rareplants.js";
5
- import { GenericPage } from "./genericpage.js";
6
- import { ExternalSites } from "./externalsites.js";
1
+ import { HTML } from "@ca-plant-list/ca-plant-list";
2
+ import { Jepson } from "../jepson.js";
3
+ import { Config } from "../config.js";
4
+ import { RarePlants } from "../rareplants.js";
5
+ import { GenericPage } from "../genericpage.js";
6
+ import { ExternalSites } from "../externalsites.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.2.6",
3
+ "version": "0.2.7",
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": {