@ca-plant-list/ca-plant-list 0.3.5 → 0.3.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.
- package/data/synonyms.csv +24 -1
- package/data/taxa.csv +117 -99
- package/data/text/Antirrhinum-thompsonii.md +1 -0
- package/data/text/Calyptridium-monospermum.md +1 -0
- package/data/text/Calyptridium-ubellatum.md +1 -0
- package/data/text/Clarkia-affinis.md +1 -0
- package/data/text/Clarkia-breweri.md +1 -0
- package/data/text/Clarkia-concinna-subsp-automixa.md +1 -0
- package/data/text/Clarkia-modesta.md +1 -0
- package/data/text/Clarkia-purpurea-subsp-quadrivulnera.md +1 -0
- package/data/text/Clarkia-rubicunda.md +1 -0
- package/data/text/Delphinium-californicum-subsp-californicum.md +1 -1
- package/data/text/Delphinium-californicum-subsp-interius.md +1 -0
- package/data/text/Delphinium-hesperium-subsp-hesperium.md +1 -1
- package/data/text/Delphinium-hesperium-subsp-pallescens.md +1 -0
- package/data/text/Delphinium-parryi-subsp-parryi.md +1 -0
- package/data/text/Delphinium-variegatum-subsp-variegatum.md +1 -0
- package/data/text/Erythranthe-moschata.md +1 -0
- package/data/text/Erythranthe-primuloides.md +1 -0
- package/data/text/Erythranthe-tilingii.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/Lilium-pardalinum-subsp-shastense.md +1 -0
- package/data/text/Logfia-filaginoides.md +1 -0
- package/data/text/Logfia-gallica.md +1 -0
- package/data/text/Malacothamnus-arcuatus-var-elmeri.md +1 -0
- package/data/text/Malacothamnus-fremontii-var-fremontii.md +1 -0
- package/data/text/Trifolium-obtusiflorum.md +1 -0
- package/data/text/Trifolium-willdenovii.md +1 -0
- package/ebook/css/main.css +4 -0
- package/jekyll/assets/css/main.css +4 -0
- package/lib/ebook/images.js +49 -40
- package/lib/ebook/pages/page_list_species.js +15 -9
- package/lib/ebook/pages/taxonpage.js +3 -6
- package/lib/ebook/xhtml.js +3 -5
- package/lib/externalsites.js +14 -21
- package/lib/families.js +0 -2
- package/lib/genera.js +1 -3
- package/lib/genericpage.js +26 -18
- package/lib/generictaxaloader.js +1 -1
- package/lib/htmltaxon.js +35 -17
- package/lib/markdown.js +7 -9
- package/lib/pagerenderer.js +127 -82
- package/lib/plants/glossary.js +9 -14
- package/lib/taxa.js +14 -15
- package/lib/taxaloader.js +3 -1
- package/lib/taxon.js +2 -4
- package/lib/web/glossarypages.js +31 -18
- package/lib/web/pagetaxon.js +0 -10
- package/package.json +2 -3
- package/scripts/build-ebook.js +1 -1
- package/scripts/build-site.js +34 -24
- package/types/classes.d.ts +26 -0
package/lib/pagerenderer.js
CHANGED
@@ -1,71 +1,93 @@
|
|
1
|
-
import {
|
2
|
-
import { TAXA_LIST_COLS } from "./taxa.js";
|
1
|
+
import { Taxa, TAXA_LIST_COLS } from "./taxa.js";
|
3
2
|
import { PageTaxon } from "./web/pagetaxon.js";
|
4
3
|
import { RarePlants } from "./rareplants.js";
|
5
4
|
import { BasePageRenderer } from "./basepagerenderer.js";
|
6
5
|
import { GenericPage } from "./genericpage.js";
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
import { Files } from "./files.js";
|
7
|
+
import { HTML } from "./html.js";
|
8
|
+
|
9
|
+
const ENDANGERED_COLS = [
|
10
|
+
TAXA_LIST_COLS.SPECIES,
|
11
|
+
TAXA_LIST_COLS.COMMON_NAME,
|
12
|
+
TAXA_LIST_COLS.CESA,
|
13
|
+
TAXA_LIST_COLS.FESA,
|
14
|
+
];
|
15
|
+
const RPI_COLUMNS = [
|
16
|
+
TAXA_LIST_COLS.SPECIES_BARE,
|
17
|
+
TAXA_LIST_COLS.COMMON_NAME,
|
18
|
+
TAXA_LIST_COLS.CNPS_RANK,
|
19
|
+
];
|
10
20
|
|
11
21
|
class PageRenderer extends BasePageRenderer {
|
22
|
+
static render(outputDir, config, taxa) {
|
23
|
+
super.render(outputDir, taxa);
|
12
24
|
|
13
|
-
|
14
|
-
|
15
|
-
super.render( outputDir, taxa );
|
16
|
-
|
17
|
-
this.renderLists( outputDir, config, taxa );
|
25
|
+
this.renderLists(outputDir, config, taxa);
|
18
26
|
|
19
27
|
const taxonList = taxa.getTaxonList();
|
20
|
-
for (
|
21
|
-
new PageTaxon(
|
28
|
+
for (const taxon of taxonList) {
|
29
|
+
new PageTaxon(outputDir, config, taxon).render();
|
22
30
|
}
|
23
|
-
|
24
31
|
}
|
25
32
|
|
26
|
-
static renderLists(
|
27
|
-
|
28
|
-
function getListArray( listInfo, attributes = {}, columns ) {
|
29
|
-
|
33
|
+
static renderLists(outputDir, config, taxa) {
|
34
|
+
function getListArray(listInfo, attributes = {}, columns) {
|
30
35
|
const listArray = [];
|
31
|
-
for (
|
36
|
+
for (const list of listInfo) {
|
32
37
|
const listTaxa = [];
|
33
38
|
const calfloraTaxa = [];
|
34
39
|
const iNatTaxa = [];
|
35
|
-
for (
|
36
|
-
if (
|
37
|
-
listTaxa.push(
|
38
|
-
calfloraTaxa.push(
|
39
|
-
iNatTaxa.push(
|
40
|
+
for (const taxon of taxa.getTaxonList()) {
|
41
|
+
if (list.include(taxon)) {
|
42
|
+
listTaxa.push(taxon);
|
43
|
+
calfloraTaxa.push(taxon.getCalfloraName());
|
44
|
+
iNatTaxa.push(taxon.getINatName());
|
40
45
|
}
|
41
46
|
}
|
42
47
|
|
43
|
-
if (
|
48
|
+
if (listTaxa.length === 0) {
|
44
49
|
continue;
|
45
50
|
}
|
46
51
|
|
47
|
-
Files.write(
|
48
|
-
|
52
|
+
Files.write(
|
53
|
+
outputDir + "/calflora_" + list.filename + ".txt",
|
54
|
+
calfloraTaxa.join("\n")
|
55
|
+
);
|
56
|
+
Files.write(
|
57
|
+
outputDir + "/inat_" + list.filename + ".txt",
|
58
|
+
iNatTaxa.join("\n")
|
59
|
+
);
|
49
60
|
|
50
61
|
const cols = columns ? columns : list.columns;
|
51
|
-
new PageTaxonList(
|
62
|
+
new PageTaxonList(outputDir, list.name, list.filename).render(
|
63
|
+
listTaxa,
|
64
|
+
cols
|
65
|
+
);
|
52
66
|
|
53
67
|
// Check for sublists.
|
54
|
-
const subListHTML = list.listInfo
|
55
|
-
|
56
|
-
|
68
|
+
const subListHTML = list.listInfo
|
69
|
+
? getListArray(list.listInfo, { class: "indent" }, cols)
|
70
|
+
: "";
|
71
|
+
|
72
|
+
listArray.push(
|
73
|
+
HTML.getLink("./" + list.filename + ".html", list.name) +
|
74
|
+
" (" +
|
75
|
+
listTaxa.length +
|
76
|
+
")" +
|
77
|
+
subListHTML
|
78
|
+
);
|
57
79
|
}
|
58
80
|
|
59
|
-
return renderList(
|
81
|
+
return renderList(listArray, attributes);
|
60
82
|
}
|
61
83
|
|
62
|
-
function renderList(
|
63
|
-
return HTML.wrap(
|
84
|
+
function renderList(listsHTML, attributes = {}) {
|
85
|
+
return HTML.wrap("ul", HTML.arrayToLI(listsHTML), attributes);
|
64
86
|
}
|
65
87
|
|
66
|
-
function renderSection(
|
67
|
-
let html =
|
68
|
-
html += HTML.textElement(
|
88
|
+
function renderSection(title, listsHTML) {
|
89
|
+
let html = '<div class="section">';
|
90
|
+
html += HTML.textElement("h2", title);
|
69
91
|
html += listsHTML;
|
70
92
|
html += "</div>";
|
71
93
|
return html;
|
@@ -75,10 +97,22 @@ class PageRenderer extends BasePageRenderer {
|
|
75
97
|
{
|
76
98
|
title: "All Species",
|
77
99
|
listInfo: [
|
78
|
-
{
|
79
|
-
|
80
|
-
|
81
|
-
|
100
|
+
{
|
101
|
+
name: config.getLabel("native", "Native"),
|
102
|
+
filename: "list_native",
|
103
|
+
include: (t) => t.isNative(),
|
104
|
+
},
|
105
|
+
{
|
106
|
+
name: config.getLabel("introduced", "Introduced"),
|
107
|
+
filename: "list_introduced",
|
108
|
+
include: (t) => !t.isNative(),
|
109
|
+
},
|
110
|
+
{
|
111
|
+
name: "All Plants",
|
112
|
+
filename: "list_all",
|
113
|
+
include: () => true,
|
114
|
+
},
|
115
|
+
],
|
82
116
|
},
|
83
117
|
{
|
84
118
|
title: "Rare Plants",
|
@@ -86,101 +120,112 @@ class PageRenderer extends BasePageRenderer {
|
|
86
120
|
{
|
87
121
|
name: "CNPS Ranked Plants",
|
88
122
|
filename: "list_rpi",
|
89
|
-
include: (
|
123
|
+
include: (t) => t.getRPIRank() !== undefined,
|
90
124
|
columns: RPI_COLUMNS,
|
91
125
|
listInfo: [
|
92
126
|
{
|
93
|
-
name: RarePlants.getRPIRankDescription(
|
127
|
+
name: RarePlants.getRPIRankDescription("1A"),
|
94
128
|
filename: "list_rpi_1a",
|
95
|
-
include: (
|
129
|
+
include: (t) => t.getRPIRank() === "1A",
|
96
130
|
},
|
97
131
|
{
|
98
|
-
name: RarePlants.getRPIRankDescription(
|
132
|
+
name: RarePlants.getRPIRankDescription("1B"),
|
99
133
|
filename: "list_rpi_1b",
|
100
|
-
include: (
|
134
|
+
include: (t) => t.getRPIRank() === "1B",
|
101
135
|
},
|
102
136
|
{
|
103
|
-
name: RarePlants.getRPIRankDescription(
|
137
|
+
name: RarePlants.getRPIRankDescription("2A"),
|
104
138
|
filename: "list_rpi_2a",
|
105
|
-
include: (
|
139
|
+
include: (t) => t.getRPIRank() === "2A",
|
106
140
|
},
|
107
141
|
{
|
108
|
-
name: RarePlants.getRPIRankDescription(
|
142
|
+
name: RarePlants.getRPIRankDescription("2B"),
|
109
143
|
filename: "list_rpi_2b",
|
110
|
-
include: (
|
144
|
+
include: (t) => t.getRPIRank() === "2B",
|
111
145
|
},
|
112
146
|
{
|
113
|
-
name: RarePlants.getRPIRankDescription(
|
147
|
+
name: RarePlants.getRPIRankDescription("3"),
|
114
148
|
filename: "list_rpi_3",
|
115
|
-
include: (
|
149
|
+
include: (t) => t.getRPIRank() === "3",
|
116
150
|
},
|
117
151
|
{
|
118
|
-
name: RarePlants.getRPIRankDescription(
|
152
|
+
name: RarePlants.getRPIRankDescription("4"),
|
119
153
|
filename: "list_rpi_4",
|
120
|
-
include: (
|
154
|
+
include: (t) => t.getRPIRank() === "4",
|
121
155
|
},
|
122
|
-
]
|
156
|
+
],
|
123
157
|
},
|
124
158
|
{
|
125
159
|
name: "Endangered Species",
|
126
160
|
filename: "list_endangered",
|
127
|
-
include: (
|
161
|
+
include: (t) => t.getCESA() || t.getFESA(),
|
128
162
|
columns: ENDANGERED_COLS,
|
129
163
|
},
|
130
|
-
]
|
164
|
+
],
|
131
165
|
},
|
132
166
|
];
|
133
167
|
|
134
|
-
let html =
|
135
|
-
for (
|
168
|
+
let html = '<div class="wrapper">';
|
169
|
+
for (const section of sections) {
|
170
|
+
const listHTML = getListArray(
|
171
|
+
section.listInfo,
|
172
|
+
section.listInfo.columns
|
173
|
+
);
|
136
174
|
|
137
|
-
|
138
|
-
|
139
|
-
if ( listHTML.length > 0 ) {
|
140
|
-
html += renderSection( section.title, listHTML );
|
175
|
+
if (listHTML.length > 0) {
|
176
|
+
html += renderSection(section.title, listHTML);
|
141
177
|
}
|
142
|
-
|
143
178
|
}
|
144
|
-
html += renderSection(
|
179
|
+
html += renderSection(
|
180
|
+
"Taxonomy",
|
181
|
+
renderList([HTML.getLink("./list_families.html", "Plant Families")])
|
182
|
+
);
|
145
183
|
|
146
184
|
html += "</div>";
|
147
185
|
|
148
186
|
// Write lists to includes directory so it can be inserted into pages.
|
149
|
-
Files.write(
|
150
|
-
|
187
|
+
Files.write(outputDir + "/_includes/plantlists.html", html);
|
151
188
|
}
|
152
|
-
|
153
189
|
}
|
154
190
|
|
155
191
|
class PageTaxonList extends GenericPage {
|
156
|
-
|
157
|
-
|
158
|
-
super( outputDir, title, baseName );
|
192
|
+
constructor(outputDir, title, baseName) {
|
193
|
+
super(outputDir, title, baseName);
|
159
194
|
}
|
160
195
|
|
161
|
-
render(
|
162
|
-
|
196
|
+
render(taxa, columns) {
|
163
197
|
let html = this.getDefaultIntro();
|
164
198
|
|
165
|
-
html +=
|
199
|
+
html += '<div class="wrapper">';
|
166
200
|
|
167
|
-
html +=
|
168
|
-
html += Taxa.getHTMLTable(
|
201
|
+
html += '<div class="section">';
|
202
|
+
html += Taxa.getHTMLTable(taxa, columns);
|
169
203
|
html += "</div>";
|
170
204
|
|
171
|
-
html +=
|
172
|
-
html += HTML.textElement(
|
205
|
+
html += '<div class="section">';
|
206
|
+
html += HTML.textElement("h2", "Download");
|
173
207
|
html += "<ul>";
|
174
|
-
html +=
|
175
|
-
|
208
|
+
html +=
|
209
|
+
"<li>" +
|
210
|
+
HTML.getLink(
|
211
|
+
"./calflora_" + this.getBaseFileName() + ".txt",
|
212
|
+
"Calflora List"
|
213
|
+
) +
|
214
|
+
"</li>";
|
215
|
+
html +=
|
216
|
+
"<li>" +
|
217
|
+
HTML.getLink(
|
218
|
+
"./inat_" + this.getBaseFileName() + ".txt",
|
219
|
+
"iNaturalist List"
|
220
|
+
) +
|
221
|
+
"</li>";
|
176
222
|
html += "</ul>";
|
177
223
|
html += "</div>";
|
178
224
|
|
179
225
|
html += "</div>";
|
180
226
|
|
181
|
-
this.writeFile(
|
182
|
-
|
227
|
+
this.writeFile(html);
|
183
228
|
}
|
184
229
|
}
|
185
230
|
|
186
|
-
export { PageRenderer };
|
231
|
+
export { PageRenderer };
|
package/lib/plants/glossary.js
CHANGED
@@ -1,38 +1,34 @@
|
|
1
|
-
import { Config
|
1
|
+
import { Config } from "../config.js";
|
2
|
+
import { Files } from "../files.js";
|
2
3
|
|
3
4
|
class Glossary {
|
4
|
-
|
5
5
|
#srcPath;
|
6
6
|
#srcEntries = [];
|
7
7
|
|
8
8
|
constructor() {
|
9
|
-
|
10
9
|
this.#srcPath = Config.getPackageDir() + "/data/glossary";
|
11
10
|
|
12
11
|
// Find all entries in the glossary directory.
|
13
|
-
const entries = Files.getDirEntries(
|
14
|
-
for (
|
15
|
-
this.#srcEntries.push(
|
12
|
+
const entries = Files.getDirEntries(this.#srcPath).sort();
|
13
|
+
for (const entry of entries) {
|
14
|
+
this.#srcEntries.push(new GlossaryEntry(this.#srcPath, entry));
|
16
15
|
}
|
17
|
-
|
18
16
|
}
|
19
17
|
|
20
18
|
getEntries() {
|
21
19
|
return this.#srcEntries;
|
22
20
|
}
|
23
|
-
|
24
21
|
}
|
25
22
|
|
26
23
|
class GlossaryEntry {
|
27
|
-
|
28
24
|
#srcPath;
|
29
25
|
#fileName;
|
30
26
|
#term;
|
31
27
|
|
32
|
-
constructor(
|
28
|
+
constructor(srcPath, fileName) {
|
33
29
|
this.#srcPath = srcPath;
|
34
30
|
this.#fileName = fileName;
|
35
|
-
this.#term = fileName.split(
|
31
|
+
this.#term = fileName.split(".")[0];
|
36
32
|
}
|
37
33
|
|
38
34
|
getHTMLFileName() {
|
@@ -40,13 +36,12 @@ class GlossaryEntry {
|
|
40
36
|
}
|
41
37
|
|
42
38
|
getMarkdown() {
|
43
|
-
return Files.read(
|
39
|
+
return Files.read(this.#srcPath + "/" + this.#fileName);
|
44
40
|
}
|
45
41
|
|
46
42
|
getTermName() {
|
47
43
|
return this.#term;
|
48
44
|
}
|
49
|
-
|
50
45
|
}
|
51
46
|
|
52
|
-
export { Glossary };
|
47
|
+
export { Glossary };
|
package/lib/taxa.js
CHANGED
@@ -2,23 +2,25 @@ import { Config } from "./config.js";
|
|
2
2
|
import { HTML } from "./html.js";
|
3
3
|
import { CSV } from "./csv.js";
|
4
4
|
import { RarePlants } from "./rareplants.js";
|
5
|
-
import { ErrorLog, Families, Taxon } from "./index.js";
|
6
5
|
import { Genera } from "./genera.js";
|
7
6
|
import { TextUtils } from "./textutils.js";
|
7
|
+
import { Taxon } from "./taxon.js";
|
8
|
+
import { Families } from "./families.js";
|
8
9
|
|
9
10
|
const FLOWER_COLORS = [
|
10
11
|
{ name: "white", color: "white" },
|
11
12
|
{ name: "red", color: "red" },
|
12
|
-
{ name: "pink", color: "
|
13
|
+
{ name: "pink", color: "#ff69b4" },
|
13
14
|
{ name: "orange", color: "orange" },
|
14
15
|
{ name: "yellow", color: "yellow" },
|
15
16
|
{ name: "blue", color: "blue" },
|
16
17
|
{ name: "purple", color: "purple" },
|
17
18
|
{ name: "green", color: "green" },
|
19
|
+
{ name: "brown", color: "brown" },
|
18
20
|
];
|
19
21
|
|
20
22
|
/**
|
21
|
-
* @type {Object
|
23
|
+
* @type {Object<string,{title:string,data:function (Taxon):string}>}
|
22
24
|
*/
|
23
25
|
const TAXA_LIST_COLS = {
|
24
26
|
CESA: {
|
@@ -97,14 +99,10 @@ class Taxa {
|
|
97
99
|
#isSubset;
|
98
100
|
|
99
101
|
/**
|
100
|
-
*
|
101
|
-
* @param {*} inclusionList
|
102
|
+
* @param {string[]|boolean} inclusionList
|
102
103
|
* @param {ErrorLog} errorLog
|
103
|
-
* @param {
|
104
|
-
* @param {
|
105
|
-
* @param {*} taxonClass
|
106
|
-
* @param {*} extraTaxa
|
107
|
-
* @param {*} extraSynonyms
|
104
|
+
* @param {boolean} showFlowerErrors
|
105
|
+
* @param {Taxon} taxonClass
|
108
106
|
*/
|
109
107
|
constructor(
|
110
108
|
inclusionList,
|
@@ -161,7 +159,7 @@ class Taxa {
|
|
161
159
|
|
162
160
|
/**
|
163
161
|
* @param {Taxon[]} taxa
|
164
|
-
* @param {
|
162
|
+
* @param {TaxaCol} columns
|
165
163
|
*/
|
166
164
|
static getHTMLTable(taxa, columns = DEFAULT_COLUMNS) {
|
167
165
|
let html = "<table><thead>";
|
@@ -258,9 +256,7 @@ class Taxa {
|
|
258
256
|
}
|
259
257
|
|
260
258
|
/**
|
261
|
-
* @param {
|
262
|
-
* @param {*} inclusionList
|
263
|
-
* @param {*} taxaMeta
|
259
|
+
* @param {TaxonData[]} taxaCSV
|
264
260
|
* @param {Taxon} taxonClass
|
265
261
|
* @param {boolean} showFlowerErrors
|
266
262
|
*/
|
@@ -293,7 +289,10 @@ class Taxa {
|
|
293
289
|
const color = this.#flower_colors[colorName];
|
294
290
|
if (!color) {
|
295
291
|
throw new Error(
|
296
|
-
'flower color "' +
|
292
|
+
'flower color "' +
|
293
|
+
colorName +
|
294
|
+
'" not found for ' +
|
295
|
+
name
|
297
296
|
);
|
298
297
|
}
|
299
298
|
color.addTaxon(taxon);
|
package/lib/taxaloader.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
import { CSV } from "./csv.js";
|
2
|
+
import { Files } from "./files.js";
|
1
3
|
import { GenericTaxaLoader } from "./generictaxaloader.js";
|
2
|
-
import {
|
4
|
+
import { Taxa } from "./taxa.js";
|
3
5
|
|
4
6
|
class TaxaLoader extends GenericTaxaLoader {
|
5
7
|
/**
|
package/lib/taxon.js
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
import { HTML } from "./
|
1
|
+
import { HTML } from "./html.js";
|
2
2
|
import { RarePlants } from "./rareplants.js";
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
4
|
-
import { Genera } from "./genera.js";
|
5
3
|
|
6
4
|
const TAXA_COLNAMES = {
|
7
5
|
BLOOM_START: "bloom_start",
|
@@ -38,7 +36,7 @@ class Taxon {
|
|
38
36
|
#synonyms = [];
|
39
37
|
|
40
38
|
/**
|
41
|
-
* @param {
|
39
|
+
* @param {TaxonData} data
|
42
40
|
* @param {Genera} genera
|
43
41
|
*/
|
44
42
|
constructor(data, genera) {
|
package/lib/web/glossarypages.js
CHANGED
@@ -1,46 +1,60 @@
|
|
1
|
-
import { Files, HTML } from "@ca-plant-list/ca-plant-list";
|
2
1
|
import { Glossary } from "../plants/glossary.js";
|
3
2
|
import { Markdown } from "../markdown.js";
|
3
|
+
import { HTML } from "../html.js";
|
4
|
+
import { Files } from "../files.js";
|
4
5
|
|
5
6
|
const ENTRY_DIR = "g";
|
6
7
|
|
7
8
|
class GlossaryPages {
|
8
|
-
|
9
9
|
#siteGenerator;
|
10
10
|
#glossary;
|
11
11
|
|
12
|
-
constructor(
|
12
|
+
constructor(siteGenerator) {
|
13
13
|
this.#siteGenerator = siteGenerator;
|
14
14
|
this.#glossary = new Glossary();
|
15
15
|
}
|
16
16
|
|
17
|
-
#generateEntryPage(
|
17
|
+
#generateEntryPage(entry) {
|
18
18
|
const title = entry.getTermName();
|
19
|
-
let html = HTML.textElement(
|
20
|
-
html += HTML.wrap(
|
21
|
-
|
19
|
+
let html = HTML.textElement("h1", title);
|
20
|
+
html += HTML.wrap("div", Markdown.strToHTML(entry.getMarkdown()), {
|
21
|
+
class: "glossary",
|
22
|
+
});
|
23
|
+
this.#siteGenerator.writeTemplate(
|
24
|
+
html,
|
25
|
+
{ title: title },
|
26
|
+
Files.join(ENTRY_DIR, title + ".html")
|
27
|
+
);
|
22
28
|
}
|
23
29
|
|
24
30
|
#generateEntryPages() {
|
25
|
-
|
26
31
|
// Make sure output directory exists.
|
27
|
-
this.#siteGenerator.mkdir(
|
32
|
+
this.#siteGenerator.mkdir(ENTRY_DIR);
|
28
33
|
|
29
34
|
const entries = this.#glossary.getEntries();
|
30
|
-
for (
|
31
|
-
this.#generateEntryPage(
|
35
|
+
for (const entry of entries) {
|
36
|
+
this.#generateEntryPage(entry);
|
32
37
|
}
|
33
38
|
}
|
34
39
|
|
35
40
|
#generateIndexPage() {
|
36
41
|
const links = [];
|
37
42
|
const entries = this.#glossary.getEntries();
|
38
|
-
for (
|
39
|
-
links.push(
|
43
|
+
for (const entry of entries) {
|
44
|
+
links.push(
|
45
|
+
HTML.getLink(
|
46
|
+
Files.join(ENTRY_DIR, entry.getHTMLFileName()),
|
47
|
+
entry.getTermName()
|
48
|
+
)
|
49
|
+
);
|
40
50
|
}
|
41
|
-
let html = HTML.wrap(
|
42
|
-
html += HTML.wrap(
|
43
|
-
this.#siteGenerator.writeTemplate(
|
51
|
+
let html = HTML.wrap("h1", "Glossary");
|
52
|
+
html += HTML.wrap("ol", HTML.arrayToLI(links));
|
53
|
+
this.#siteGenerator.writeTemplate(
|
54
|
+
html,
|
55
|
+
{ title: "Glossary" },
|
56
|
+
"glossary.html"
|
57
|
+
);
|
44
58
|
}
|
45
59
|
|
46
60
|
getGlossary() {
|
@@ -51,7 +65,6 @@ class GlossaryPages {
|
|
51
65
|
this.#generateIndexPage();
|
52
66
|
this.#generateEntryPages();
|
53
67
|
}
|
54
|
-
|
55
68
|
}
|
56
69
|
|
57
|
-
export { GlossaryPages };
|
70
|
+
export { GlossaryPages };
|
package/lib/web/pagetaxon.js
CHANGED
@@ -42,16 +42,6 @@ class PageTaxon extends GenericPage {
|
|
42
42
|
if (rpiLink) {
|
43
43
|
links.push(rpiLink);
|
44
44
|
}
|
45
|
-
if (this.#taxon.isNative()) {
|
46
|
-
links.push(
|
47
|
-
HTML.getLink(
|
48
|
-
ExternalSites.getCalscapeLink(this.#taxon.getName()),
|
49
|
-
"Calscape",
|
50
|
-
undefined,
|
51
|
-
true
|
52
|
-
)
|
53
|
-
);
|
54
|
-
}
|
55
45
|
return links;
|
56
46
|
}
|
57
47
|
|
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.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": {
|
@@ -12,7 +12,6 @@
|
|
12
12
|
"exports": {
|
13
13
|
".": "./lib/index.js"
|
14
14
|
},
|
15
|
-
"types": "./lib/index.d.ts",
|
16
15
|
"bin": {
|
17
16
|
"ca-plant-list": "scripts/build-site.js",
|
18
17
|
"ca-plant-book": "scripts/build-ebook.js"
|
@@ -36,4 +35,4 @@
|
|
36
35
|
"eslint": "^8.26.0",
|
37
36
|
"typescript": "^5.3.3"
|
38
37
|
}
|
39
|
-
}
|
38
|
+
}
|
package/scripts/build-ebook.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
|
3
|
-
import { PlantBook } from "@ca-plant-list/ca-plant-list";
|
4
3
|
import { Config } from "../lib/config.js";
|
5
4
|
import { Files } from "../lib/files.js";
|
5
|
+
import { PlantBook } from "../lib/ebook/plantbook.js";
|
6
6
|
import { TaxaProcessor } from "../lib/taxaprocessor.js";
|
7
7
|
import { CommandProcessor } from "../lib/commandprocessor.js";
|
8
8
|
|