@ca-plant-list/ca-plant-list 0.2.6 → 0.2.8
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.
- package/data/glossary/pappus.md +3 -0
- package/data/glossary/petiole.md +1 -0
- package/data/glossary/phyllary.md +1 -0
- package/data/glossary/stipule.md +1 -0
- package/data/illustrations/inkscape/asteraceae_floret.svg +157 -0
- package/data/illustrations/optimized/asteraceae_floret.svg +28 -0
- package/data/synonyms.csv +12 -0
- package/data/taxa.csv +149 -146
- package/data/text/Clematis-ligusticifolia.md +1 -0
- package/data/text/Erythranthe-arvensis.md +1 -0
- package/data/text/Erythranthe-grandis.md +1 -0
- package/data/text/Erythranthe-guttata.md +1 -0
- package/data/text/Grindelia-camporum.md +1 -1
- package/data/text/Grindelia-hirsutula.md +1 -1
- package/data/text/Lonicera-interrupta.md +1 -0
- package/data/text/Lonicera-subspicata-var-denudata.md +1 -0
- package/data/text/Taraxacum-officinale.md +1 -1
- package/data/text/Wyethia-angustifolia.md +1 -1
- package/data/text/Wyethia-glabra.md +1 -1
- package/data/text/Wyethia-helenioides.md +1 -1
- package/jekyll/_includes/glossary.html +0 -0
- package/jekyll/_layouts/html.html +3 -0
- package/jekyll/assets/css/main.css +9 -0
- package/jekyll/glossary.md +5 -0
- package/lib/basepagerenderer.js +5 -0
- package/lib/dateutils.js +24 -0
- package/lib/ebook/ebook.js +24 -0
- package/lib/ebook/ebookpage.js +4 -2
- package/lib/ebook/glossarypages.js +101 -0
- package/lib/ebook/images.js +86 -0
- package/lib/ebook/pages/taxonpage.js +2 -3
- package/lib/ebook/pages/tocpage.js +1 -0
- package/lib/ebook/plantbook.js +17 -67
- package/lib/genericpage.js +26 -8
- package/lib/html.js +1 -1
- package/lib/index.d.ts +24 -12
- package/lib/jekyll.js +11 -0
- package/lib/markdown.js +18 -0
- package/lib/pagerenderer.js +2 -3
- package/lib/plants/glossary.js +52 -0
- package/lib/taxon.js +14 -0
- package/lib/web/glossarypages.js +52 -0
- package/lib/{pagetaxon.js → web/pagetaxon.js} +34 -7
- package/package.json +1 -1
- /package/{ebook/i → data/illustrations/optimized}/f-blue.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-orange.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-pink.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-red.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-white.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-yellow.svg +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 "__#
|
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 "__#
|
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 "__#
|
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 "__#
|
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 "__#
|
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;
|
@@ -83,6 +83,8 @@ export class GenericPage {
|
|
83
83
|
constructor(outputDir: any, title: any, baseFileName: any, js: any);
|
84
84
|
getBaseFileName(): any;
|
85
85
|
getDefaultIntro(): string;
|
86
|
+
getFrontMatter(): string;
|
87
|
+
getMarkdown(): any;
|
86
88
|
getOutputDir(): any;
|
87
89
|
getTitle(): any;
|
88
90
|
writeFile(html: any): void;
|
@@ -101,7 +103,7 @@ export class HTML {
|
|
101
103
|
* @deprecated
|
102
104
|
*/
|
103
105
|
static getElement(elName: any, text: any, attributes?: {}, options?: number): string;
|
104
|
-
static "__#
|
106
|
+
static "__#4@#getElement"(elName: any, text: any, attributes: any, escape: any): string;
|
105
107
|
/**
|
106
108
|
* Generate HTML for an <a> element.
|
107
109
|
* @param {string|undefined} href
|
@@ -143,6 +145,7 @@ import { TAXA_COLNAMES } from "./taxon.js";
|
|
143
145
|
import { Taxon } from "./taxon.js";
|
144
146
|
export { BasePageRenderer, Config, CSV, DataLoader, ErrorLog, Exceptions, Families, Files, HTML, Jekyll, PlantBook, Taxa, TAXA_COLNAMES, Taxon };
|
145
147
|
export class Jekyll {
|
148
|
+
static getFrontMatter(atts: any): string;
|
146
149
|
static hasInclude(baseDir: any, path: any): boolean;
|
147
150
|
static include(path: any): string;
|
148
151
|
static writeInclude(baseDir: any, path: any, data: any): void;
|
@@ -150,6 +153,11 @@ export class Jekyll {
|
|
150
153
|
export class Jepson {
|
151
154
|
static getEFloraLink(id: any): string;
|
152
155
|
}
|
156
|
+
export class Markdown {
|
157
|
+
static "__#2@#md": any;
|
158
|
+
static fileToHTML(filePath: any): any;
|
159
|
+
static strToHTML(str: any): any;
|
160
|
+
}
|
153
161
|
export class RarePlants {
|
154
162
|
static getCESADescription(cesa: any): any;
|
155
163
|
static getFESADescription(fesa: any): any;
|
@@ -158,9 +166,9 @@ export class RarePlants {
|
|
158
166
|
}
|
159
167
|
export const FLOWER_COLOR_NAMES: string[];
|
160
168
|
export class Taxa {
|
161
|
-
static "__#
|
162
|
-
static "__#
|
163
|
-
static "__#
|
169
|
+
static "__#11@#taxa": {};
|
170
|
+
static "__#11@#flower_colors": {};
|
171
|
+
static "__#11@#sortedTaxa": any;
|
164
172
|
static getHTMLTable(taxa: any, columns?: {
|
165
173
|
title: string;
|
166
174
|
data: (t: any) => any;
|
@@ -169,8 +177,8 @@ export class Taxa {
|
|
169
177
|
static getTaxa(): any;
|
170
178
|
static getTaxon(name: any): any;
|
171
179
|
static init(inclusionList: any, taxaMeta?: {}, taxonClass?: typeof Taxon, extraTaxa?: any[], extraSynonyms?: any[]): void;
|
172
|
-
static "__#
|
173
|
-
static "__#
|
180
|
+
static "__#11@#loadSyns"(synCSV: any, inclusionList: any): void;
|
181
|
+
static "__#11@#loadTaxa"(taxaCSV: any, inclusionList: any, taxaMeta: any, taxonClass: any): void;
|
174
182
|
}
|
175
183
|
export namespace TAXA_LIST_COLS {
|
176
184
|
namespace CESA {
|
@@ -210,6 +218,8 @@ export namespace TAXA_LIST_COLS {
|
|
210
218
|
}
|
211
219
|
import { Taxon } from "./taxon.js";
|
212
220
|
export namespace TAXA_COLNAMES {
|
221
|
+
const BLOOM_START: string;
|
222
|
+
const BLOOM_END: string;
|
213
223
|
const COMMON_NAME: string;
|
214
224
|
const FLOWER_COLOR: string;
|
215
225
|
}
|
@@ -217,6 +227,8 @@ export class Taxon {
|
|
217
227
|
constructor(data: any);
|
218
228
|
addSynonym(syn: any, type: any): void;
|
219
229
|
getBaseFileName(): any;
|
230
|
+
getBloomEnd(): any;
|
231
|
+
getBloomStart(): any;
|
220
232
|
getCalfloraName(): any;
|
221
233
|
getCalfloraID(): any;
|
222
234
|
getCalfloraTaxonLink(): string;
|
@@ -228,7 +240,7 @@ export class Taxon {
|
|
228
240
|
getFileName(ext?: string): string;
|
229
241
|
getFlowerColors(): any;
|
230
242
|
getGenus(): {
|
231
|
-
"__#
|
243
|
+
"__#6@#data": any;
|
232
244
|
getTaxa(): any;
|
233
245
|
};
|
234
246
|
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
|
}
|
package/lib/markdown.js
ADDED
@@ -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 };
|
package/lib/pagerenderer.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
import { HTML } from "
|
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 };
|
package/lib/taxon.js
CHANGED
@@ -4,6 +4,8 @@ import { HTML } from "./html.js";
|
|
4
4
|
import { RarePlants } from "./rareplants.js";
|
5
5
|
|
6
6
|
const TAXA_COLNAMES = {
|
7
|
+
BLOOM_START: "bloom_start",
|
8
|
+
BLOOM_END: "bloom_end",
|
7
9
|
COMMON_NAME: "common name",
|
8
10
|
FLOWER_COLOR: "flower_color",
|
9
11
|
};
|
@@ -20,6 +22,8 @@ class Taxon {
|
|
20
22
|
#iNatID;
|
21
23
|
#iNatSyn;
|
22
24
|
#flowerColors;
|
25
|
+
#bloomStart;
|
26
|
+
#bloomEnd;
|
23
27
|
#rpiID;
|
24
28
|
#rankRPI;
|
25
29
|
#cesa;
|
@@ -44,6 +48,8 @@ class Taxon {
|
|
44
48
|
this.#iNatID = data[ "inat id" ];
|
45
49
|
const colors = data[ TAXA_COLNAMES.FLOWER_COLOR ];
|
46
50
|
this.#flowerColors = colors ? colors.split( "," ) : undefined;
|
51
|
+
this.#bloomStart = data[ TAXA_COLNAMES.BLOOM_START ];
|
52
|
+
this.#bloomEnd = data[ TAXA_COLNAMES.BLOOM_END ];
|
47
53
|
this.#rpiID = data[ "RPI ID" ];
|
48
54
|
this.#rankRPI = data[ "CRPR" ];
|
49
55
|
this.#cesa = cesa ? cesa : undefined;
|
@@ -72,6 +78,14 @@ class Taxon {
|
|
72
78
|
return this.#name.replaceAll( " ", "-" ).replaceAll( ".", "" );
|
73
79
|
}
|
74
80
|
|
81
|
+
getBloomEnd() {
|
82
|
+
return this.#bloomEnd;
|
83
|
+
}
|
84
|
+
|
85
|
+
getBloomStart() {
|
86
|
+
return this.#bloomStart;
|
87
|
+
}
|
88
|
+
|
75
89
|
getCalfloraName() {
|
76
90
|
if ( this.#cfSyn ) {
|
77
91
|
return this.#cfSyn;
|
@@ -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,10 @@
|
|
1
|
-
import { HTML } from "
|
2
|
-
import { Jepson } from "
|
3
|
-
import { Config } from "
|
4
|
-
import { RarePlants } from "
|
5
|
-
import { GenericPage } from "
|
6
|
-
import { ExternalSites } from "
|
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
|
+
import { DateUtils } from "../dateutils.js";
|
7
8
|
|
8
9
|
class PageTaxon extends GenericPage {
|
9
10
|
|
@@ -14,6 +15,28 @@ class PageTaxon extends GenericPage {
|
|
14
15
|
this.#taxon = taxon;
|
15
16
|
}
|
16
17
|
|
18
|
+
getFlowerInfo() {
|
19
|
+
|
20
|
+
const colors = this.#taxon.getFlowerColors();
|
21
|
+
const monthStart = this.#taxon.getBloomStart();
|
22
|
+
const monthEnd = this.#taxon.getBloomEnd();
|
23
|
+
|
24
|
+
if ( !colors && !monthStart ) {
|
25
|
+
return "";
|
26
|
+
}
|
27
|
+
|
28
|
+
let html = "Flowers: ";
|
29
|
+
if ( colors ) {
|
30
|
+
for ( const color of colors ) {
|
31
|
+
html += HTML.textElement( "img", "", { src: "/i/f-" + color + ".svg", alt: color + " flowers", title: color, class: "flower-color" } );
|
32
|
+
}
|
33
|
+
}
|
34
|
+
if ( monthStart ) {
|
35
|
+
html += DateUtils.getMonthName( monthStart ) + "-" + DateUtils.getMonthName( monthEnd );
|
36
|
+
}
|
37
|
+
return HTML.wrap( "div", html, { class: "section" } );
|
38
|
+
}
|
39
|
+
|
17
40
|
#getInfoLinks() {
|
18
41
|
const links = [];
|
19
42
|
const jepsonID = this.#taxon.getJepsonID();
|
@@ -131,7 +154,7 @@ class PageTaxon extends GenericPage {
|
|
131
154
|
|
132
155
|
render() {
|
133
156
|
|
134
|
-
let html = this.
|
157
|
+
let html = this.getFrontMatter();
|
135
158
|
|
136
159
|
html += "<div class=\"wrapper\">";
|
137
160
|
|
@@ -153,6 +176,10 @@ class PageTaxon extends GenericPage {
|
|
153
176
|
|
154
177
|
html += "</div>";
|
155
178
|
|
179
|
+
html += this.getFlowerInfo();
|
180
|
+
|
181
|
+
html += this.getMarkdown();
|
182
|
+
|
156
183
|
html += "<div class=\"grid borders\">";
|
157
184
|
html += this.#getListSectionHTML( this.#getInfoLinks(), "References", "info" );
|
158
185
|
html += this.#getListSectionHTML( this.#getObsLinks(), "Observations", "obs" );
|
package/package.json
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|