@ca-plant-list/ca-plant-list 0.3.4 → 0.3.5
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 +293 -294
- package/data/text/Agoseris-grandiflora-var-grandiflora.md +1 -0
- package/data/text/Agoseris-heterophylla-var-cryptopleura.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 +6 -1
- package/jekyll/assets/css/main.css +6 -1
- package/lib/ebook/image.js +6 -4
- package/lib/ebook/pages/taxonpage.js +9 -36
- package/lib/html.js +70 -41
- package/lib/htmltaxon.js +51 -0
- package/lib/index.js +1 -0
- package/lib/taxa.js +2 -3
- package/lib/taxon.js +6 -0
- package/lib/textutils.js +10 -0
- package/lib/web/pagetaxon.js +107 -82
- package/package.json +3 -3
- /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,64 +2,50 @@ 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(
|
42
|
+
if (rpiLink) {
|
43
|
+
links.push(rpiLink);
|
58
44
|
}
|
59
|
-
if (
|
45
|
+
if (this.#taxon.isNative()) {
|
60
46
|
links.push(
|
61
47
|
HTML.getLink(
|
62
|
-
ExternalSites.getCalscapeLink(
|
48
|
+
ExternalSites.getCalscapeLink(this.#taxon.getName()),
|
63
49
|
"Calscape",
|
64
50
|
undefined,
|
65
51
|
true
|
@@ -73,25 +59,27 @@ class PageTaxon extends GenericPage {
|
|
73
59
|
const links = [];
|
74
60
|
links.push(
|
75
61
|
HTML.getLink(
|
76
|
-
"https://www.calflora.org/entry/observ.html?track=m#srch=t&grezc=5&cols=b&lpcli=t&cc="
|
77
|
-
|
78
|
-
|
62
|
+
"https://www.calflora.org/entry/observ.html?track=m#srch=t&grezc=5&cols=b&lpcli=t&cc=" +
|
63
|
+
this.#config.getCountyCodes().join("!") +
|
64
|
+
"&incobs=f&taxon=" +
|
65
|
+
this.#taxon.getCalfloraName().replaceAll(" ", "+"),
|
79
66
|
"Calflora",
|
80
67
|
{},
|
81
68
|
true
|
82
69
|
)
|
83
70
|
);
|
84
71
|
const iNatID = this.#taxon.getINatID();
|
85
|
-
if (
|
72
|
+
if (iNatID) {
|
86
73
|
links.push(
|
87
74
|
HTML.getLink(
|
88
|
-
ExternalSites.getInatObsLink(
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
75
|
+
ExternalSites.getInatObsLink({
|
76
|
+
project_id: this.#config.getConfigValue(
|
77
|
+
"inat",
|
78
|
+
"project_id"
|
79
|
+
),
|
80
|
+
subview: "map",
|
81
|
+
taxon_id: iNatID,
|
82
|
+
}),
|
95
83
|
"iNaturalist",
|
96
84
|
{},
|
97
85
|
true
|
@@ -102,13 +90,18 @@ class PageTaxon extends GenericPage {
|
|
102
90
|
return links;
|
103
91
|
}
|
104
92
|
|
105
|
-
|
93
|
+
/**
|
94
|
+
* @param {string[]} list
|
95
|
+
* @param {string} header
|
96
|
+
* @param {string} className
|
97
|
+
*/
|
98
|
+
#getListSectionHTML(list, header, className) {
|
106
99
|
let html = "";
|
107
|
-
if (
|
108
|
-
html +=
|
109
|
-
html += HTML.textElement(
|
100
|
+
if (list.length > 0) {
|
101
|
+
html += '<div class="section ' + className + '">';
|
102
|
+
html += HTML.textElement("h2", header);
|
110
103
|
html += "<ul>";
|
111
|
-
html += HTML.arrayToLI(
|
104
|
+
html += HTML.arrayToLI(list);
|
112
105
|
html += "</ul>";
|
113
106
|
html += "</div>";
|
114
107
|
}
|
@@ -117,32 +110,44 @@ class PageTaxon extends GenericPage {
|
|
117
110
|
|
118
111
|
#getRarityInfo() {
|
119
112
|
const cnpsRank = this.#taxon.getRPIRankAndThreat();
|
120
|
-
if (
|
113
|
+
if (!cnpsRank) {
|
121
114
|
return "";
|
122
115
|
}
|
123
116
|
const ranks = [];
|
124
117
|
|
125
|
-
ranks.push(
|
126
|
-
|
127
|
-
|
128
|
-
|
118
|
+
ranks.push(
|
119
|
+
HTML.textElement("span", "CNPS Rare Plant Rank:", {
|
120
|
+
class: "label",
|
121
|
+
}) +
|
122
|
+
HTML.getToolTip(
|
123
|
+
cnpsRank,
|
124
|
+
this.#taxon.getRPIRankAndThreatTooltip()
|
125
|
+
)
|
126
|
+
);
|
127
|
+
if (this.#taxon.getCESA()) {
|
128
|
+
ranks.push(
|
129
|
+
HTML.textElement("span", "CESA:", { class: "label" }) +
|
130
|
+
RarePlants.getCESADescription(this.#taxon.getCESA())
|
131
|
+
);
|
129
132
|
}
|
130
133
|
|
131
|
-
return HTML.wrap(
|
132
|
-
"
|
133
|
-
|
134
|
-
{ class: "section" }
|
135
|
-
);
|
134
|
+
return HTML.wrap("div", "<ul>" + HTML.arrayToLI(ranks) + "</ul>", {
|
135
|
+
class: "section",
|
136
|
+
});
|
136
137
|
}
|
137
138
|
|
138
139
|
#getRelatedTaxaLinks() {
|
139
140
|
const links = [];
|
140
141
|
const genus = this.#taxon.getGenus();
|
141
|
-
if (
|
142
|
+
if (genus) {
|
142
143
|
const taxa = genus.getTaxa();
|
143
|
-
if (
|
144
|
-
for (
|
145
|
-
links.push(
|
144
|
+
if (taxa.length > 1) {
|
145
|
+
for (const taxon of taxa) {
|
146
|
+
links.push(
|
147
|
+
taxon.getHTMLLink(
|
148
|
+
taxon.getName() !== this.#taxon.getName()
|
149
|
+
)
|
150
|
+
);
|
146
151
|
}
|
147
152
|
}
|
148
153
|
}
|
@@ -154,22 +159,28 @@ class PageTaxon extends GenericPage {
|
|
154
159
|
}
|
155
160
|
|
156
161
|
render() {
|
157
|
-
|
158
162
|
let html = this.getFrontMatter();
|
159
163
|
|
160
|
-
html +=
|
164
|
+
html += '<div class="wrapper">';
|
161
165
|
|
162
166
|
const cn = this.#taxon.getCommonNames();
|
163
|
-
if (
|
164
|
-
html += HTML.textElement(
|
167
|
+
if (cn.length > 0) {
|
168
|
+
html += HTML.textElement("div", cn.join(", "), {
|
169
|
+
class: "section common-names",
|
170
|
+
});
|
165
171
|
}
|
166
172
|
|
167
|
-
html += HTML.textElement(
|
173
|
+
html += HTML.textElement(
|
174
|
+
"div",
|
175
|
+
this.#taxon.getStatusDescription(this.#config),
|
176
|
+
{ class: "section native-status" }
|
177
|
+
);
|
168
178
|
|
169
179
|
const family = this.#taxon.getFamily();
|
170
180
|
html += HTML.wrap(
|
171
181
|
"div",
|
172
|
-
HTML.textElement(
|
182
|
+
HTML.textElement("span", "Family:", { class: "label" }) +
|
183
|
+
HTML.getLink("./" + family.getFileName(), family.getName()),
|
173
184
|
{ class: "section" }
|
174
185
|
);
|
175
186
|
|
@@ -177,21 +188,35 @@ class PageTaxon extends GenericPage {
|
|
177
188
|
|
178
189
|
html += "</div>";
|
179
190
|
|
180
|
-
html +=
|
191
|
+
html += HTMLTaxon.getFlowerInfo(this.#taxon);
|
181
192
|
|
182
193
|
html += this.getMarkdown();
|
183
194
|
|
184
|
-
html +=
|
185
|
-
html += this.#getListSectionHTML(
|
186
|
-
|
187
|
-
|
188
|
-
|
195
|
+
html += '<div class="grid borders">';
|
196
|
+
html += this.#getListSectionHTML(
|
197
|
+
this.#getInfoLinks(),
|
198
|
+
"References",
|
199
|
+
"info"
|
200
|
+
);
|
201
|
+
html += this.#getListSectionHTML(
|
202
|
+
this.#getObsLinks(),
|
203
|
+
"Observations",
|
204
|
+
"obs"
|
205
|
+
);
|
206
|
+
html += this.#getListSectionHTML(
|
207
|
+
this.#getRelatedTaxaLinks(),
|
208
|
+
"Related Species",
|
209
|
+
"rel-taxa"
|
210
|
+
);
|
211
|
+
html += this.#getListSectionHTML(
|
212
|
+
this.#getSynonyms(),
|
213
|
+
"Synonyms",
|
214
|
+
"synonyms"
|
215
|
+
);
|
189
216
|
html += "</div>";
|
190
217
|
|
191
|
-
this.writeFile(
|
192
|
-
|
218
|
+
this.writeFile(html);
|
193
219
|
}
|
194
|
-
|
195
220
|
}
|
196
221
|
|
197
|
-
export { PageTaxon };
|
222
|
+
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.5",
|
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",
|
@@ -36,4 +36,4 @@
|
|
36
36
|
"eslint": "^8.26.0",
|
37
37
|
"typescript": "^5.3.3"
|
38
38
|
}
|
39
|
-
}
|
39
|
+
}
|
File without changes
|
File without changes
|