@ca-plant-list/ca-plant-list 0.3.4 → 0.3.6
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/synonyms.csv +6 -3
- package/data/taxa.csv +345 -342
- package/data/text/Agoseris-grandiflora-var-grandiflora.md +1 -0
- package/data/text/Agoseris-heterophylla-var-cryptopleura.md +1 -0
- package/data/text/Delphinium-variegatum-subsp-variegatum.md +1 -0
- package/data/text/Fritillaria-affinis.md +1 -0
- package/data/text/Fritillaria-agrestis.md +1 -0
- package/data/text/Fritillaria-liliacea.md +1 -0
- package/data/text/Galium-aparine.md +1 -0
- package/data/text/Galium-triflorum.md +1 -0
- package/data/text/Hypochaeris-glabra.md +1 -1
- package/data/text/Hypochaeris-radicata.md +1 -1
- package/data/text/Lithophragma-affine.md +1 -1
- package/data/text/Lupinus-formosus-var-formosus.md +1 -1
- package/data/text/Lupinus-latifolius-var-latifolius.md +1 -1
- package/data/text/Lupinus-microcarpus-var-densiflorus.md +1 -1
- package/data/text/Lupinus-microcarpus-var-microcarpus.md +1 -1
- package/data/text/Lupinus-succulentus.md +1 -1
- package/data/text/Pinus-ponderosa-var-pacifica.md +1 -0
- package/data/text/Pinus-sabiniana.md +1 -0
- package/data/text/Quercus-douglasii.md +1 -0
- package/data/text/Quercus-kelloggii.md +1 -0
- package/data/text/Quercus-lobata.md +1 -0
- package/data/text/Sidalcea-diploscypha.md +1 -1
- package/ebook/css/main.css +10 -1
- package/jekyll/assets/css/main.css +10 -1
- package/lib/ebook/image.js +6 -4
- package/lib/ebook/pages/taxonpage.js +9 -36
- package/lib/externalsites.js +14 -21
- package/lib/html.js +70 -41
- package/lib/htmltaxon.js +52 -0
- package/lib/index.js +1 -0
- package/lib/taxa.js +9 -8
- package/lib/taxon.js +6 -0
- package/lib/textutils.js +10 -0
- package/lib/web/pagetaxon.js +105 -90
- package/package.json +2 -2
- /package/data/text/{Claytonia-parviflora.md → Claytonia-parviflora-subsp-parviflora.md} +0 -0
- /package/data/text/{Claytonia-perfoliata.md → Claytonia-perfoliata-subsp-perfoliata.md} +0 -0
package/lib/web/pagetaxon.js
CHANGED
@@ -2,69 +2,45 @@ import { Jepson } from "../jepson.js";
|
|
2
2
|
import { RarePlants } from "../rareplants.js";
|
3
3
|
import { GenericPage } from "../genericpage.js";
|
4
4
|
import { ExternalSites } from "../externalsites.js";
|
5
|
-
import { DateUtils } from "../dateutils.js";
|
6
5
|
import { HTML } from "../html.js";
|
6
|
+
// eslint-disable-next-line no-unused-vars
|
7
|
+
import { Config } from "../config.js";
|
8
|
+
// eslint-disable-next-line no-unused-vars
|
9
|
+
import { Taxon } from "../taxon.js";
|
10
|
+
import { HTMLTaxon } from "../htmltaxon.js";
|
7
11
|
|
8
12
|
class PageTaxon extends GenericPage {
|
9
|
-
|
10
13
|
#config;
|
11
14
|
#taxon;
|
12
15
|
|
13
|
-
|
14
|
-
|
16
|
+
/**
|
17
|
+
* @param {string} outputDir
|
18
|
+
* @param {Config} config
|
19
|
+
* @param {Taxon} taxon
|
20
|
+
*/
|
21
|
+
constructor(outputDir, config, taxon) {
|
22
|
+
super(outputDir, taxon.getName(), taxon.getBaseFileName());
|
15
23
|
this.#config = config;
|
16
24
|
this.#taxon = taxon;
|
17
25
|
}
|
18
26
|
|
19
|
-
getFlowerInfo() {
|
20
|
-
|
21
|
-
const colors = this.#taxon.getFlowerColors();
|
22
|
-
const monthStart = this.#taxon.getBloomStart();
|
23
|
-
const monthEnd = this.#taxon.getBloomEnd();
|
24
|
-
|
25
|
-
if ( !colors && !monthStart ) {
|
26
|
-
return "";
|
27
|
-
}
|
28
|
-
|
29
|
-
let html = "Flowers: ";
|
30
|
-
if ( colors ) {
|
31
|
-
for ( const color of colors ) {
|
32
|
-
html += HTML.textElement( "img", "", { src: "/i/f-" + color + ".svg", alt: color + " flowers", title: color, class: "flower-color" } );
|
33
|
-
}
|
34
|
-
}
|
35
|
-
if ( monthStart ) {
|
36
|
-
html += DateUtils.getMonthName( monthStart ) + "-" + DateUtils.getMonthName( monthEnd );
|
37
|
-
}
|
38
|
-
return HTML.wrap( "div", html, { class: "section" } );
|
39
|
-
}
|
40
|
-
|
41
27
|
#getInfoLinks() {
|
42
28
|
const links = [];
|
43
29
|
const jepsonID = this.#taxon.getJepsonID();
|
44
|
-
if (
|
45
|
-
links.push(
|
30
|
+
if (jepsonID) {
|
31
|
+
links.push(Jepson.getEFloraLink(jepsonID));
|
46
32
|
}
|
47
33
|
const cfLink = this.#taxon.getCalfloraTaxonLink();
|
48
|
-
if (
|
49
|
-
links.push(
|
34
|
+
if (cfLink) {
|
35
|
+
links.push(cfLink);
|
50
36
|
}
|
51
37
|
const iNatLink = this.#taxon.getINatTaxonLink();
|
52
|
-
if (
|
53
|
-
links.push(
|
38
|
+
if (iNatLink) {
|
39
|
+
links.push(iNatLink);
|
54
40
|
}
|
55
41
|
const rpiLink = this.#taxon.getRPITaxonLink();
|
56
|
-
if (
|
57
|
-
links.push(
|
58
|
-
}
|
59
|
-
if ( this.#taxon.isNative() ) {
|
60
|
-
links.push(
|
61
|
-
HTML.getLink(
|
62
|
-
ExternalSites.getCalscapeLink( this.#taxon.getName() ),
|
63
|
-
"Calscape",
|
64
|
-
undefined,
|
65
|
-
true
|
66
|
-
)
|
67
|
-
);
|
42
|
+
if (rpiLink) {
|
43
|
+
links.push(rpiLink);
|
68
44
|
}
|
69
45
|
return links;
|
70
46
|
}
|
@@ -73,25 +49,27 @@ class PageTaxon extends GenericPage {
|
|
73
49
|
const links = [];
|
74
50
|
links.push(
|
75
51
|
HTML.getLink(
|
76
|
-
"https://www.calflora.org/entry/observ.html?track=m#srch=t&grezc=5&cols=b&lpcli=t&cc="
|
77
|
-
|
78
|
-
|
52
|
+
"https://www.calflora.org/entry/observ.html?track=m#srch=t&grezc=5&cols=b&lpcli=t&cc=" +
|
53
|
+
this.#config.getCountyCodes().join("!") +
|
54
|
+
"&incobs=f&taxon=" +
|
55
|
+
this.#taxon.getCalfloraName().replaceAll(" ", "+"),
|
79
56
|
"Calflora",
|
80
57
|
{},
|
81
58
|
true
|
82
59
|
)
|
83
60
|
);
|
84
61
|
const iNatID = this.#taxon.getINatID();
|
85
|
-
if (
|
62
|
+
if (iNatID) {
|
86
63
|
links.push(
|
87
64
|
HTML.getLink(
|
88
|
-
ExternalSites.getInatObsLink(
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
65
|
+
ExternalSites.getInatObsLink({
|
66
|
+
project_id: this.#config.getConfigValue(
|
67
|
+
"inat",
|
68
|
+
"project_id"
|
69
|
+
),
|
70
|
+
subview: "map",
|
71
|
+
taxon_id: iNatID,
|
72
|
+
}),
|
95
73
|
"iNaturalist",
|
96
74
|
{},
|
97
75
|
true
|
@@ -102,13 +80,18 @@ class PageTaxon extends GenericPage {
|
|
102
80
|
return links;
|
103
81
|
}
|
104
82
|
|
105
|
-
|
83
|
+
/**
|
84
|
+
* @param {string[]} list
|
85
|
+
* @param {string} header
|
86
|
+
* @param {string} className
|
87
|
+
*/
|
88
|
+
#getListSectionHTML(list, header, className) {
|
106
89
|
let html = "";
|
107
|
-
if (
|
108
|
-
html +=
|
109
|
-
html += HTML.textElement(
|
90
|
+
if (list.length > 0) {
|
91
|
+
html += '<div class="section ' + className + '">';
|
92
|
+
html += HTML.textElement("h2", header);
|
110
93
|
html += "<ul>";
|
111
|
-
html += HTML.arrayToLI(
|
94
|
+
html += HTML.arrayToLI(list);
|
112
95
|
html += "</ul>";
|
113
96
|
html += "</div>";
|
114
97
|
}
|
@@ -117,32 +100,44 @@ class PageTaxon extends GenericPage {
|
|
117
100
|
|
118
101
|
#getRarityInfo() {
|
119
102
|
const cnpsRank = this.#taxon.getRPIRankAndThreat();
|
120
|
-
if (
|
103
|
+
if (!cnpsRank) {
|
121
104
|
return "";
|
122
105
|
}
|
123
106
|
const ranks = [];
|
124
107
|
|
125
|
-
ranks.push(
|
126
|
-
|
127
|
-
|
128
|
-
|
108
|
+
ranks.push(
|
109
|
+
HTML.textElement("span", "CNPS Rare Plant Rank:", {
|
110
|
+
class: "label",
|
111
|
+
}) +
|
112
|
+
HTML.getToolTip(
|
113
|
+
cnpsRank,
|
114
|
+
this.#taxon.getRPIRankAndThreatTooltip()
|
115
|
+
)
|
116
|
+
);
|
117
|
+
if (this.#taxon.getCESA()) {
|
118
|
+
ranks.push(
|
119
|
+
HTML.textElement("span", "CESA:", { class: "label" }) +
|
120
|
+
RarePlants.getCESADescription(this.#taxon.getCESA())
|
121
|
+
);
|
129
122
|
}
|
130
123
|
|
131
|
-
return HTML.wrap(
|
132
|
-
"
|
133
|
-
|
134
|
-
{ class: "section" }
|
135
|
-
);
|
124
|
+
return HTML.wrap("div", "<ul>" + HTML.arrayToLI(ranks) + "</ul>", {
|
125
|
+
class: "section",
|
126
|
+
});
|
136
127
|
}
|
137
128
|
|
138
129
|
#getRelatedTaxaLinks() {
|
139
130
|
const links = [];
|
140
131
|
const genus = this.#taxon.getGenus();
|
141
|
-
if (
|
132
|
+
if (genus) {
|
142
133
|
const taxa = genus.getTaxa();
|
143
|
-
if (
|
144
|
-
for (
|
145
|
-
links.push(
|
134
|
+
if (taxa.length > 1) {
|
135
|
+
for (const taxon of taxa) {
|
136
|
+
links.push(
|
137
|
+
taxon.getHTMLLink(
|
138
|
+
taxon.getName() !== this.#taxon.getName()
|
139
|
+
)
|
140
|
+
);
|
146
141
|
}
|
147
142
|
}
|
148
143
|
}
|
@@ -154,22 +149,28 @@ class PageTaxon extends GenericPage {
|
|
154
149
|
}
|
155
150
|
|
156
151
|
render() {
|
157
|
-
|
158
152
|
let html = this.getFrontMatter();
|
159
153
|
|
160
|
-
html +=
|
154
|
+
html += '<div class="wrapper">';
|
161
155
|
|
162
156
|
const cn = this.#taxon.getCommonNames();
|
163
|
-
if (
|
164
|
-
html += HTML.textElement(
|
157
|
+
if (cn.length > 0) {
|
158
|
+
html += HTML.textElement("div", cn.join(", "), {
|
159
|
+
class: "section common-names",
|
160
|
+
});
|
165
161
|
}
|
166
162
|
|
167
|
-
html += HTML.textElement(
|
163
|
+
html += HTML.textElement(
|
164
|
+
"div",
|
165
|
+
this.#taxon.getStatusDescription(this.#config),
|
166
|
+
{ class: "section native-status" }
|
167
|
+
);
|
168
168
|
|
169
169
|
const family = this.#taxon.getFamily();
|
170
170
|
html += HTML.wrap(
|
171
171
|
"div",
|
172
|
-
HTML.textElement(
|
172
|
+
HTML.textElement("span", "Family:", { class: "label" }) +
|
173
|
+
HTML.getLink("./" + family.getFileName(), family.getName()),
|
173
174
|
{ class: "section" }
|
174
175
|
);
|
175
176
|
|
@@ -177,21 +178,35 @@ class PageTaxon extends GenericPage {
|
|
177
178
|
|
178
179
|
html += "</div>";
|
179
180
|
|
180
|
-
html +=
|
181
|
+
html += HTMLTaxon.getFlowerInfo(this.#taxon);
|
181
182
|
|
182
183
|
html += this.getMarkdown();
|
183
184
|
|
184
|
-
html +=
|
185
|
-
html += this.#getListSectionHTML(
|
186
|
-
|
187
|
-
|
188
|
-
|
185
|
+
html += '<div class="grid borders">';
|
186
|
+
html += this.#getListSectionHTML(
|
187
|
+
this.#getInfoLinks(),
|
188
|
+
"References",
|
189
|
+
"info"
|
190
|
+
);
|
191
|
+
html += this.#getListSectionHTML(
|
192
|
+
this.#getObsLinks(),
|
193
|
+
"Observations",
|
194
|
+
"obs"
|
195
|
+
);
|
196
|
+
html += this.#getListSectionHTML(
|
197
|
+
this.#getRelatedTaxaLinks(),
|
198
|
+
"Related Species",
|
199
|
+
"rel-taxa"
|
200
|
+
);
|
201
|
+
html += this.#getListSectionHTML(
|
202
|
+
this.#getSynonyms(),
|
203
|
+
"Synonyms",
|
204
|
+
"synonyms"
|
205
|
+
);
|
189
206
|
html += "</div>";
|
190
207
|
|
191
|
-
this.writeFile(
|
192
|
-
|
208
|
+
this.writeFile(html);
|
193
209
|
}
|
194
|
-
|
195
210
|
}
|
196
211
|
|
197
|
-
export { PageTaxon };
|
212
|
+
export { PageTaxon };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ca-plant-list/ca-plant-list",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.6",
|
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": {
|
@@ -23,7 +23,7 @@
|
|
23
23
|
"command-line-args": "^5.2.1",
|
24
24
|
"command-line-usage": "^6.1.3",
|
25
25
|
"csv-parse": "^5.3.1",
|
26
|
-
"image-size": "^1.
|
26
|
+
"image-size": "^1.1.1",
|
27
27
|
"markdown-it": "^13.0.1",
|
28
28
|
"sharp": "^0.32.1",
|
29
29
|
"svgo": "^3.0.3",
|
File without changes
|
File without changes
|