@ca-plant-list/ca-plant-list 0.2.5 → 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 (62) 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/synonyms.csv +2 -0
  8. package/data/taxa.csv +147 -145
  9. package/data/text/Clematis-ligusticifolia.md +1 -0
  10. package/data/text/Galium-californicum-subsp-californicum.md +1 -0
  11. package/data/text/Galium-porrigens-var-porrigens.md +1 -0
  12. package/data/text/Galium-porrigens-var-tenue.md +1 -0
  13. package/data/text/Grindelia-camporum.md +1 -1
  14. package/data/text/Grindelia-hirsutula.md +1 -1
  15. package/data/text/Hordeum-marinum-subsp-gussoneanum.md +1 -0
  16. package/data/text/Hordeum-murinum-subsp-glaucum.md +1 -0
  17. package/data/text/Hordeum-murinum-subsp-leporinum.md +1 -0
  18. package/data/text/Hordeum-murinum-subsp-murinum.md +1 -0
  19. package/data/text/Horkelia-californica-var-californica.md +1 -0
  20. package/data/text/Horkelia-californica-var-elata.md +1 -0
  21. package/data/text/Horkelia-californica-var-frondosa.md +1 -0
  22. package/data/text/Lonicera-interrupta.md +1 -0
  23. package/data/text/Lonicera-subspicata-var-denudata.md +1 -0
  24. package/data/text/Navarretia-mellita.md +1 -0
  25. package/data/text/Navarretia-squarrosa.md +1 -0
  26. package/data/text/Piperia-elegans-subsp-elegans.md +1 -0
  27. package/data/text/Piperia-elongata.md +1 -0
  28. package/data/text/Piperia-michaelii.md +1 -0
  29. package/data/text/Piperia-transversa.md +1 -0
  30. package/data/text/Piperia-unalascensis.md +1 -0
  31. package/data/text/Taraxacum-officinale.md +1 -1
  32. package/data/text/Wyethia-angustifolia.md +1 -1
  33. package/data/text/Wyethia-glabra.md +1 -1
  34. package/data/text/Wyethia-helenioides.md +1 -1
  35. package/jekyll/_includes/glossary.html +0 -0
  36. package/jekyll/_layouts/html.html +3 -0
  37. package/jekyll/glossary.md +5 -0
  38. package/lib/basepagerenderer.js +5 -0
  39. package/lib/ebook/ebook.js +24 -0
  40. package/lib/ebook/ebookpage.js +4 -2
  41. package/lib/ebook/glossarypages.js +101 -0
  42. package/lib/ebook/images.js +86 -0
  43. package/lib/ebook/pages/taxonpage.js +2 -3
  44. package/lib/ebook/pages/tocpage.js +1 -0
  45. package/lib/ebook/plantbook.js +17 -67
  46. package/lib/genericpage.js +20 -4
  47. package/lib/html.js +1 -1
  48. package/lib/index.d.ts +18 -12
  49. package/lib/jekyll.js +11 -0
  50. package/lib/markdown.js +18 -0
  51. package/lib/pagerenderer.js +2 -3
  52. package/lib/plants/glossary.js +52 -0
  53. package/lib/web/glossarypages.js +52 -0
  54. package/lib/{pagetaxon.js → web/pagetaxon.js} +6 -6
  55. package/package.json +1 -1
  56. /package/{ebook/i → data/illustrations/optimized}/f-blue.svg +0 -0
  57. /package/{ebook/i → data/illustrations/optimized}/f-orange.svg +0 -0
  58. /package/{ebook/i → data/illustrations/optimized}/f-pink.svg +0 -0
  59. /package/{ebook/i → data/illustrations/optimized}/f-red.svg +0 -0
  60. /package/{ebook/i → data/illustrations/optimized}/f-white.svg +0 -0
  61. /package/{ebook/i → data/illustrations/optimized}/f-yellow.svg +0 -0
  62. /package/data/text/{Vicia-americana.md → Vicia-americana-subsp-americana.md} +0 -0
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
  }
@@ -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.5",
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": {