@ca-plant-list/ca-plant-list 0.1.16 → 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/data/genera.json CHANGED
@@ -2163,6 +2163,10 @@
2163
2163
  "family": "Caryophyllaceae",
2164
2164
  "id": "10842"
2165
2165
  },
2166
+ "Sabulina": {
2167
+ "family": "Caryophyllaceae",
2168
+ "id": "69193"
2169
+ },
2166
2170
  "Sagina": {
2167
2171
  "family": "Caryophyllaceae",
2168
2172
  "id": "10854"
@@ -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 = "lists/" + this.#baseFileName + "-intro.md";
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
  }
@@ -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 RPI_CESA = [ TAXA_LIST_COLS.SPECIES, TAXA_LIST_COLS.COMMON_NAME, TAXA_LIST_COLS.CESA ];
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: "California Endangered Species Act",
128
- filename: "list_cesa",
129
- include: ( t ) => t.getCESA() !== undefined,
130
- columns: RPI_CESA,
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: "CESA",
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
 
@@ -70,18 +74,18 @@ class Taxon {
70
74
  if ( !calfloraID ) {
71
75
  return;
72
76
  }
73
- return HTML.getLink(
74
- "https://www.calflora.org/app/taxon?crn=" + calfloraID,
75
- "Calflora",
76
- {},
77
- true
78
- );
77
+ const link = HTML.getLink( "https://www.calflora.org/app/taxon?crn=" + calfloraID, "Calflora", {}, true );
78
+ return this.#cfSyn ? ( link + " (" + this.#cfSyn + ")" ) : link;
79
79
  }
80
80
 
81
81
  getCESA() {
82
82
  return this.#cesa;
83
83
  }
84
84
 
85
+ getCNDDBRank() {
86
+ return this.#rankCNDDB;
87
+ }
88
+
85
89
  getCommonNames() {
86
90
  return this.#commonNames;
87
91
  }
@@ -106,6 +110,10 @@ class Taxon {
106
110
  return this.#genus;
107
111
  }
108
112
 
113
+ getGlobalRank() {
114
+ return this.#rankGlobal;
115
+ }
116
+
109
117
  getHTMLLink( href = true, includeRPI = true ) {
110
118
  href = href ? ( "./" + this.getFileName() ) : undefined;
111
119
  let className = this.isNative() ? "native" : "non-native";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ca-plant-list/ca-plant-list",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
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": {