@ca-plant-list/ca-plant-list 0.1.4 → 0.1.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/lib/basepagerenderer.js +1 -1
- package/lib/index.js +3 -1
- package/lib/pagetaxon.js +7 -10
- package/lib/taxon.js +26 -19
- package/package.json +1 -1
package/lib/basepagerenderer.js
CHANGED
@@ -6,7 +6,7 @@ class BasePageRenderer {
|
|
6
6
|
static render( outputDir, Taxa ) {
|
7
7
|
|
8
8
|
// Copy static files
|
9
|
-
fs.rmSync( outputDir, { force: true, recursive: true, maxRetries: 2, retryDelay:
|
9
|
+
fs.rmSync( outputDir, { force: true, recursive: true, maxRetries: 2, retryDelay: 300 } );
|
10
10
|
// First copy default Jekyll files from package.
|
11
11
|
fs.cpSync( Config.getPackageDir() + "/jekyll", outputDir, { recursive: true } );
|
12
12
|
// Then copy Jekyll files from current dir (which may override default files).
|
package/lib/index.js
CHANGED
@@ -4,7 +4,9 @@ import { CSV } from "./csv.js";
|
|
4
4
|
import { DataLoader } from "./dataloader.js";
|
5
5
|
import { ErrorLog } from "./errorlog.js";
|
6
6
|
import { Exceptions } from "./exceptions.js";
|
7
|
+
import { Files } from "./files.js";
|
7
8
|
import { HTML, HTML_OPTIONS } from "./html.js";
|
9
|
+
import { Taxa } from "./taxa.js";
|
8
10
|
import { Taxon } from "./taxon.js";
|
9
11
|
|
10
|
-
export { BasePageRenderer, Config, CSV, DataLoader, ErrorLog, Exceptions, HTML, HTML_OPTIONS, Taxon };
|
12
|
+
export { BasePageRenderer, Config, CSV, DataLoader, ErrorLog, Exceptions, Files, HTML, HTML_OPTIONS, Taxa, Taxon };
|
package/lib/pagetaxon.js
CHANGED
@@ -20,21 +20,18 @@ class PageTaxon extends HTMLPage {
|
|
20
20
|
if ( jepsonID ) {
|
21
21
|
links.push( Jepson.getEFloraLink( jepsonID ) );
|
22
22
|
}
|
23
|
-
const
|
24
|
-
if (
|
25
|
-
links.push(
|
26
|
-
HTML.getLink(
|
27
|
-
"https://www.calflora.org/app/taxon?crn=" + calRecNum,
|
28
|
-
"Calflora",
|
29
|
-
{},
|
30
|
-
HTML_OPTIONS.OPEN_NEW
|
31
|
-
)
|
32
|
-
);
|
23
|
+
const cfLink = this.#taxon.getCalfloraTaxonLink();
|
24
|
+
if ( cfLink ) {
|
25
|
+
links.push( cfLink );
|
33
26
|
}
|
34
27
|
const iNatLink = this.#taxon.getINatTaxonLink();
|
35
28
|
if ( iNatLink ) {
|
36
29
|
links.push( iNatLink );
|
37
30
|
}
|
31
|
+
const rpiLink = this.#taxon.getRPITaxonLink();
|
32
|
+
if ( rpiLink ) {
|
33
|
+
links.push( rpiLink );
|
34
|
+
}
|
38
35
|
return links;
|
39
36
|
}
|
40
37
|
|
package/lib/taxon.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Config } from "./config.js";
|
2
|
-
import { ErrorLog } from "./errorlog.js";
|
3
2
|
import { Genera } from "./genera.js";
|
4
3
|
import { HTML, HTML_OPTIONS } from "./html.js";
|
5
4
|
import { RarePlants } from "./rareplants.js";
|
@@ -32,12 +31,6 @@ class Taxon {
|
|
32
31
|
this.#rankRPI = rankRPI;
|
33
32
|
this.#cesa = cesa;
|
34
33
|
Genera.addTaxon( this );
|
35
|
-
if ( !calRecNum ) {
|
36
|
-
ErrorLog.log( this.getName(), "has no Calflora ID" );
|
37
|
-
}
|
38
|
-
if ( !iNatID ) {
|
39
|
-
ErrorLog.log( this.getName(), "has no iNat ID" );
|
40
|
-
}
|
41
34
|
}
|
42
35
|
|
43
36
|
addSynonym( syn, type ) {
|
@@ -65,6 +58,19 @@ class Taxon {
|
|
65
58
|
return this.#calRecNum;
|
66
59
|
}
|
67
60
|
|
61
|
+
getCalfloraTaxonLink() {
|
62
|
+
const calfloraID = this.getCalfloraID();
|
63
|
+
if ( !calfloraID ) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
return HTML.getLink(
|
67
|
+
"https://www.calflora.org/app/taxon?crn=" + calfloraID,
|
68
|
+
"Calflora",
|
69
|
+
{},
|
70
|
+
HTML_OPTIONS.OPEN_NEW
|
71
|
+
);
|
72
|
+
}
|
73
|
+
|
68
74
|
getCESA() {
|
69
75
|
return this.#cesa;
|
70
76
|
}
|
@@ -145,6 +151,15 @@ class Taxon {
|
|
145
151
|
return this.#rankRPI;
|
146
152
|
}
|
147
153
|
|
154
|
+
getRPITaxonLink() {
|
155
|
+
const rpiID = this.getRPIID();
|
156
|
+
if ( !rpiID ) {
|
157
|
+
return "";
|
158
|
+
}
|
159
|
+
const link = HTML.getLink( "https://rareplants.cnps.org/Plants/Details/" + rpiID, "CNPS Rare Plant Inventory", {}, HTML_OPTIONS.OPEN_NEW );
|
160
|
+
return link;
|
161
|
+
}
|
162
|
+
|
148
163
|
getStatus() {
|
149
164
|
return this.#status;
|
150
165
|
}
|
@@ -165,6 +180,10 @@ class Taxon {
|
|
165
180
|
return this.#synonyms;
|
166
181
|
}
|
167
182
|
|
183
|
+
isCANative() {
|
184
|
+
return this.#status === "N" || this.#status === "NC";
|
185
|
+
}
|
186
|
+
|
168
187
|
isNative() {
|
169
188
|
return this.#status === "N";
|
170
189
|
}
|
@@ -173,18 +192,6 @@ class Taxon {
|
|
173
192
|
return this.getRPIRank() !== undefined;
|
174
193
|
}
|
175
194
|
|
176
|
-
setCalfloraID( id ) {
|
177
|
-
this.#calRecNum = id;
|
178
|
-
}
|
179
|
-
|
180
|
-
setINatID( id ) {
|
181
|
-
this.#iNatID = id;
|
182
|
-
}
|
183
|
-
|
184
|
-
setJepsonID( id ) {
|
185
|
-
this.#jepsonID = id;
|
186
|
-
}
|
187
|
-
|
188
195
|
}
|
189
196
|
|
190
197
|
export { Taxon };
|