@ca-plant-list/ca-plant-list 0.2.1 → 0.2.3
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/exceptions.json +43 -1
- package/data/photos.csv +9 -6
- package/data/taxa.csv +164 -164
- package/data/text/Bromus-catharticus-var-catharticus.md +1 -0
- package/data/text/Bromus-catharticus-var-elatus.md +1 -0
- package/data/text/Bromus-sitchensis-var-carinatus.md +1 -0
- package/data/text/Bromus-sitchensis-var-marginatus.md +1 -0
- package/data/text/Castilleja-foliolosa.md +1 -0
- package/data/text/Grindelia-camporum.md +1 -0
- package/data/text/Grindelia-hirsutula.md +1 -0
- package/data/text/Hypochaeris-glabra.md +1 -0
- package/data/text/Hypochaeris-radicata.md +1 -0
- package/data/text/Layia-chrysanthemoides.md +1 -0
- package/data/text/Layia-gaillardioides.md +1 -0
- package/data/text/Layia-hieracioides.md +1 -0
- package/data/text/Layia-platyglossa.md +1 -0
- package/data/text/Lithophragma-affine.md +1 -0
- package/data/text/Lithophragma-heterophyllum.md +1 -0
- package/data/text/Lithophragma-parviflorum-var-parviflorum.md +1 -0
- package/data/text/Lupinus-formosus-var-formosus.md +1 -0
- package/data/text/Lupinus-latifolius-var-latifolius.md +1 -0
- package/data/text/Lupinus-microcarpus-var-densiflorus.md +1 -0
- package/data/text/Lupinus-microcarpus-var-microcarpus.md +1 -0
- package/data/text/Lupinus-succulentus.md +1 -0
- package/data/text/Pseudotsuga-menziesii-var-menziesii.md +1 -0
- package/data/text/Rosa-californica.md +1 -0
- package/data/text/Rosa-gymnocarpa-var-gymnocarpa.md +1 -0
- package/data/text/Sequoia-sempervirens.md +1 -0
- package/data/text/Symphoricarpos-albus-var-laevigatus.md +1 -0
- package/data/text/Symphoricarpos-mollis.md +1 -0
- package/data/text/Taraxacum-officinale.md +1 -0
- package/data/text/Wyethia-angustifolia.md +1 -0
- package/data/text/Wyethia-glabra.md +1 -0
- package/data/text/Wyethia-helenioides.md +1 -0
- package/ebook/css/main.css +9 -52
- package/ebook/i/f-blue.svg +5 -0
- package/ebook/i/f-orange.svg +5 -0
- package/ebook/i/f-pink.svg +5 -0
- package/ebook/i/f-red.svg +5 -0
- package/ebook/i/f-white.svg +5 -0
- package/ebook/i/f-yellow.svg +5 -0
- package/jekyll/assets/css/main.css +6 -0
- package/lib/ebook/ebook.js +3 -3
- package/lib/ebook/ebookpage.js +4 -0
- package/lib/ebook/pages/page_list_families.js +27 -0
- package/lib/ebook/pages/page_list_flower_color.js +26 -0
- package/lib/ebook/pages/page_list_species.js +26 -0
- package/lib/ebook/pages/taxonpage.js +4 -2
- package/lib/ebook/pages/tocpage.js +18 -11
- package/lib/ebook/plantbook.js +67 -10
- package/lib/exceptions.js +14 -4
- package/lib/families.js +4 -0
- package/lib/index.d.ts +10 -6
- package/lib/pagetaxon.js +2 -2
- package/lib/taxa.js +53 -2
- package/package.json +1 -1
package/lib/pagetaxon.js
CHANGED
@@ -153,8 +153,8 @@ class PageTaxon extends GenericPage {
|
|
153
153
|
|
154
154
|
html += "</div>";
|
155
155
|
|
156
|
-
html += "<div class=\"grid\">";
|
157
|
-
html += this.#getListSectionHTML( this.#getInfoLinks(), "
|
156
|
+
html += "<div class=\"grid borders\">";
|
157
|
+
html += this.#getListSectionHTML( this.#getInfoLinks(), "References", "info" );
|
158
158
|
html += this.#getListSectionHTML( this.#getObsLinks(), "Observations", "obs" );
|
159
159
|
html += this.#getListSectionHTML( this.#getRelatedTaxaLinks(), "Related Species", "rel-taxa" );
|
160
160
|
html += this.#getListSectionHTML( this.#getSynonyms(), "Synonyms", "synonyms" );
|
package/lib/taxa.js
CHANGED
@@ -5,6 +5,8 @@ import { HTML } from "./html.js";
|
|
5
5
|
import { CSV } from "./csv.js";
|
6
6
|
import { RarePlants } from "./rareplants.js";
|
7
7
|
|
8
|
+
const FLOWER_COLOR_NAMES = [ "white", "red", "pink", "orange", "yellow", "blue" ];
|
9
|
+
|
8
10
|
const TAXA_LIST_COLS = {
|
9
11
|
CESA: {
|
10
12
|
title: "California",
|
@@ -34,11 +36,45 @@ const TAXA_LIST_COLS = {
|
|
34
36
|
|
35
37
|
const DEFAULT_COLUMNS = [ TAXA_LIST_COLS.SPECIES, TAXA_LIST_COLS.COMMON_NAME ];
|
36
38
|
|
39
|
+
class FlowerColor {
|
40
|
+
|
41
|
+
#color;
|
42
|
+
#taxa = [];
|
43
|
+
|
44
|
+
constructor( color ) {
|
45
|
+
this.#color = color;
|
46
|
+
}
|
47
|
+
|
48
|
+
addTaxon( taxon ) {
|
49
|
+
this.#taxa.push( taxon );
|
50
|
+
}
|
51
|
+
|
52
|
+
getColorName( uc = false ) {
|
53
|
+
return uc ? ( this.#color[ 0 ].toUpperCase() + this.#color.substring( 1 ) ) : this.#color;
|
54
|
+
}
|
55
|
+
|
56
|
+
getFileName() {
|
57
|
+
return "list_fc_" + this.#color + ".html";
|
58
|
+
}
|
59
|
+
|
60
|
+
getTaxa() {
|
61
|
+
return this.#taxa;
|
62
|
+
}
|
63
|
+
|
64
|
+
}
|
65
|
+
|
37
66
|
class Taxa {
|
38
67
|
|
39
68
|
static #taxa = {};
|
69
|
+
static #flower_colors = {};
|
40
70
|
static #sortedTaxa;
|
41
71
|
|
72
|
+
static {
|
73
|
+
for ( const color of FLOWER_COLOR_NAMES ) {
|
74
|
+
this.#flower_colors[ color ] = new FlowerColor( color );
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
42
78
|
static getHTMLTable( taxa, columns = DEFAULT_COLUMNS ) {
|
43
79
|
|
44
80
|
let html = "<table><thead>";
|
@@ -67,6 +103,10 @@ class Taxa {
|
|
67
103
|
return html;
|
68
104
|
}
|
69
105
|
|
106
|
+
static getFlowerColor( name ) {
|
107
|
+
return this.#flower_colors[ name ];
|
108
|
+
}
|
109
|
+
|
70
110
|
static getTaxa() {
|
71
111
|
return this.#sortedTaxa;
|
72
112
|
}
|
@@ -134,7 +174,18 @@ class Taxa {
|
|
134
174
|
if ( status !== undefined ) {
|
135
175
|
row[ "status" ] = status;
|
136
176
|
}
|
137
|
-
|
177
|
+
const taxon = new taxonClass( row, taxaMeta[ name ] );
|
178
|
+
this.#taxa[ name ] = taxon;
|
179
|
+
const colors = taxon.getFlowerColors();
|
180
|
+
if ( colors ) {
|
181
|
+
for ( const colorName of colors ) {
|
182
|
+
const color = this.#flower_colors[ colorName ];
|
183
|
+
if ( !color ) {
|
184
|
+
throw new Error( "flower color \"" + colorName + "\" not found" );
|
185
|
+
}
|
186
|
+
color.addTaxon( taxon );
|
187
|
+
}
|
188
|
+
}
|
138
189
|
|
139
190
|
}
|
140
191
|
|
@@ -143,4 +194,4 @@ class Taxa {
|
|
143
194
|
|
144
195
|
}
|
145
196
|
|
146
|
-
export { Taxa, TAXA_LIST_COLS };
|
197
|
+
export { FLOWER_COLOR_NAMES, Taxa, TAXA_LIST_COLS };
|