@ca-plant-list/ca-plant-list 0.1.17 → 0.1.18
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/genericpage.js +1 -1
- package/lib/pagerenderer.js +5 -5
- package/lib/pagetaxon.js +0 -9
- package/lib/rareplants.js +19 -0
- package/lib/taxa.js +7 -2
- package/lib/taxon.js +13 -1
- package/package.json +1 -1
package/lib/genericpage.js
CHANGED
@@ -21,7 +21,7 @@ class GenericPage {
|
|
21
21
|
getDefaultIntro() {
|
22
22
|
let html = this.#getFrontMatter();
|
23
23
|
html += HTML.textElement( "h1", this.#title );
|
24
|
-
const introPath = "
|
24
|
+
const introPath = "intros/" + this.#baseFileName + ".md";
|
25
25
|
if ( Jekyll.hasInclude( this.#outputDir, introPath ) ) {
|
26
26
|
html += HTML.wrap( "div", Jekyll.include( introPath ), { class: "section" } );
|
27
27
|
}
|
package/lib/pagerenderer.js
CHANGED
@@ -7,7 +7,7 @@ import { BasePageRenderer } from "./basepagerenderer.js";
|
|
7
7
|
import { Files } from "./files.js";
|
8
8
|
import { GenericPage } from "./genericpage.js";
|
9
9
|
|
10
|
-
const
|
10
|
+
const ENDANGERED_COLS = [ TAXA_LIST_COLS.SPECIES, TAXA_LIST_COLS.COMMON_NAME, TAXA_LIST_COLS.CESA, TAXA_LIST_COLS.FESA ];
|
11
11
|
const RPI_COLUMNS = [ TAXA_LIST_COLS.SPECIES_BARE, TAXA_LIST_COLS.COMMON_NAME, TAXA_LIST_COLS.CNPS_RANK ];
|
12
12
|
|
13
13
|
class PageRenderer extends BasePageRenderer {
|
@@ -124,10 +124,10 @@ class PageRenderer extends BasePageRenderer {
|
|
124
124
|
]
|
125
125
|
},
|
126
126
|
{
|
127
|
-
name: "
|
128
|
-
filename: "
|
129
|
-
include: ( t ) => t.getCESA()
|
130
|
-
columns:
|
127
|
+
name: "Endangered Species",
|
128
|
+
filename: "list_endangered",
|
129
|
+
include: ( t ) => ( t.getCESA() || t.getFESA() ),
|
130
|
+
columns: ENDANGERED_COLS,
|
131
131
|
},
|
132
132
|
]
|
133
133
|
},
|
package/lib/pagetaxon.js
CHANGED
@@ -138,15 +138,6 @@ class PageTaxon extends GenericPage {
|
|
138
138
|
|
139
139
|
html += "</div>";
|
140
140
|
|
141
|
-
const introName = "intros/" + this.#taxon.getFileName( "md" );
|
142
|
-
if ( Files.exists( "./jekyll/_includes/" + introName ) ) {
|
143
|
-
html += HTML.wrap(
|
144
|
-
"div",
|
145
|
-
"{% capture my_include %}{% include " + introName + "%}{% endcapture %}{{ my_include | markdownify }}",
|
146
|
-
{ class: "section" }
|
147
|
-
);
|
148
|
-
}
|
149
|
-
|
150
141
|
html += "<div class=\"grid\">";
|
151
142
|
html += this.#getListSectionHTML( this.#getInfoLinks(), "Information", "info" );
|
152
143
|
html += this.#getListSectionHTML( this.#getObsLinks(), "Observations", "obs" );
|
package/lib/rareplants.js
CHANGED
@@ -20,12 +20,31 @@ const CESA_DESCRIPS = {
|
|
20
20
|
"CT": "Threatened",
|
21
21
|
};
|
22
22
|
|
23
|
+
const FESA_DESCRIPS = {
|
24
|
+
"FE": "Endangered",
|
25
|
+
"FT": "Threatened",
|
26
|
+
"PE": "Proposed Endangered",
|
27
|
+
"PT": "Proposed Threatened",
|
28
|
+
"FC": "Candidate",
|
29
|
+
"FD": "Delisted",
|
30
|
+
};
|
31
|
+
|
23
32
|
class RarePlants {
|
24
33
|
|
25
34
|
static getCESADescription( cesa ) {
|
35
|
+
if ( !cesa ) {
|
36
|
+
return "";
|
37
|
+
}
|
26
38
|
return CESA_DESCRIPS[ cesa ];
|
27
39
|
}
|
28
40
|
|
41
|
+
static getFESADescription( fesa ) {
|
42
|
+
if ( !fesa ) {
|
43
|
+
return "";
|
44
|
+
}
|
45
|
+
return FESA_DESCRIPS[ fesa ];
|
46
|
+
}
|
47
|
+
|
29
48
|
static getRPIRankDescription( rank ) {
|
30
49
|
const pieces = rank.split( "." );
|
31
50
|
return RANK_DESCRIPS[ pieces[ 0 ] ];
|
package/lib/taxa.js
CHANGED
@@ -7,7 +7,7 @@ import { Exceptions } from "./exceptions.js";
|
|
7
7
|
|
8
8
|
const TAXA_LIST_COLS = {
|
9
9
|
CESA: {
|
10
|
-
title: "
|
10
|
+
title: "California",
|
11
11
|
data: ( t ) => RarePlants.getCESADescription( t.getCESA() )
|
12
12
|
},
|
13
13
|
COMMON_NAME: {
|
@@ -18,6 +18,10 @@ const TAXA_LIST_COLS = {
|
|
18
18
|
title: "CNPS Rank",
|
19
19
|
data: ( t ) => HTML.getToolTip( HTML.textElement( "span", t.getRPIRankAndThreat() ), t.getRPIRankAndThreatTooltip() )
|
20
20
|
},
|
21
|
+
FESA: {
|
22
|
+
title: "Federal",
|
23
|
+
data: ( t ) => RarePlants.getFESADescription( t.getFESA() )
|
24
|
+
},
|
21
25
|
SPECIES: {
|
22
26
|
title: "Species",
|
23
27
|
data: ( t ) => t.getHTMLLink( true, true )
|
@@ -94,7 +98,8 @@ class Taxa {
|
|
94
98
|
row[ "inat id" ],
|
95
99
|
row[ "RPI ID" ],
|
96
100
|
row[ "CRPR" ],
|
97
|
-
row[ "CESA" ]
|
101
|
+
row[ "CESA" ],
|
102
|
+
row[ "FESA" ]
|
98
103
|
);
|
99
104
|
if ( !jepsonID && !Exceptions.hasException( name, "jepson", "badjepsonid" ) ) {
|
100
105
|
ErrorLog.log( name, "has no Jepson ID" );
|
package/lib/taxon.js
CHANGED
@@ -18,9 +18,11 @@ class Taxon {
|
|
18
18
|
#rankRPI;
|
19
19
|
#cesa;
|
20
20
|
#fesa;
|
21
|
+
#rankCNDDB;
|
22
|
+
#rankGlobal;
|
21
23
|
#synonyms = [];
|
22
24
|
|
23
|
-
constructor( name, commonNames, status, jepsonID, calRecNum, iNatID, rpiID, rankRPI, cesa, fesa ) {
|
25
|
+
constructor( name, commonNames, status, jepsonID, calRecNum, iNatID, rpiID, rankRPI, cesa, fesa, rankCNDDB, rankGlobal ) {
|
24
26
|
this.#name = name;
|
25
27
|
this.#genus = name.split( " " )[ 0 ];
|
26
28
|
this.#commonNames = commonNames ? commonNames.split( "," ).map( t => t.trim() ) : [];
|
@@ -32,6 +34,8 @@ class Taxon {
|
|
32
34
|
this.#rankRPI = rankRPI;
|
33
35
|
this.#cesa = cesa ? cesa : undefined;
|
34
36
|
this.#fesa = fesa ? fesa : undefined;
|
37
|
+
this.#rankCNDDB = rankCNDDB ? rankCNDDB : undefined;
|
38
|
+
this.#rankGlobal = rankGlobal ? rankGlobal : undefined;
|
35
39
|
Genera.addTaxon( this );
|
36
40
|
}
|
37
41
|
|
@@ -78,6 +82,10 @@ class Taxon {
|
|
78
82
|
return this.#cesa;
|
79
83
|
}
|
80
84
|
|
85
|
+
getCNDDBRank() {
|
86
|
+
return this.#rankCNDDB;
|
87
|
+
}
|
88
|
+
|
81
89
|
getCommonNames() {
|
82
90
|
return this.#commonNames;
|
83
91
|
}
|
@@ -102,6 +110,10 @@ class Taxon {
|
|
102
110
|
return this.#genus;
|
103
111
|
}
|
104
112
|
|
113
|
+
getGlobalRank() {
|
114
|
+
return this.#rankGlobal;
|
115
|
+
}
|
116
|
+
|
105
117
|
getHTMLLink( href = true, includeRPI = true ) {
|
106
118
|
href = href ? ( "./" + this.getFileName() ) : undefined;
|
107
119
|
let className = this.isNative() ? "native" : "non-native";
|