@ca-plant-list/ca-plant-list 0.2.8 → 0.2.10
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 +8 -1
- package/data/taxa.csv +5 -3
- package/ebook/css/main.css +5 -0
- package/lib/dateutils.js +20 -1
- package/lib/ebook/pages/page_list_flowers.js +108 -0
- package/lib/ebook/pages/taxonpage.js +12 -5
- package/lib/ebook/pages/tocpage.js +8 -0
- package/lib/ebook/plantbook.js +7 -0
- package/lib/index.d.ts +4 -0
- package/package.json +1 -1
package/data/synonyms.csv
CHANGED
@@ -924,7 +924,6 @@ Jussiaea repens var. peploides,Ludwigia peploides subsp. peploides
|
|
924
924
|
Kali australis,Salsola australis
|
925
925
|
Keckiella breviflora subsp. breviflora,Keckiella breviflora var. breviflora
|
926
926
|
Koeleria cristata var. longifolia,Koeleria macrantha
|
927
|
-
Koeleria gerardii,Koeleria gerardi,INAT
|
928
927
|
Koeleria nitida,Koeleria macrantha
|
929
928
|
Kohlrauschia velutina,Petrorhagia dubia
|
930
929
|
Lachnagrostis filiformis,Agrostis avenacea,INAT
|
@@ -1102,6 +1101,7 @@ Mahonia dictyota,Berberis aquifolium var. dictyota
|
|
1102
1101
|
Mahonia nervosa var. mendocinensis,Berberis nervosa
|
1103
1102
|
Mahonia pinnata subsp. pinnata,Berberis pinnata subsp. pinnata
|
1104
1103
|
Maianthemum racemosum subsp. amplexicaule,Maianthemum racemosum
|
1104
|
+
Malacothamnus arcuatus var. elmeri,Malacothamnus hallii,INAT
|
1105
1105
|
Malacothamnus fremontii subsp. cercophorus,Malacothamnus fremontii
|
1106
1106
|
Malacothamnus helleri,Malacothamnus fremontii
|
1107
1107
|
Malacothamnus howellii,Malacothamnus fremontii
|
@@ -1312,6 +1312,7 @@ Oloptum miliaceum,Stipa miliacea var. miliacea,INAT
|
|
1312
1312
|
Onychium densum,Aspidotis densa
|
1313
1313
|
Orobanche bulbosa,Aphyllon tuberosum
|
1314
1314
|
Orobanche californica subsp. jepsonii,Aphyllon californicum subsp. jepsonii
|
1315
|
+
Orobanche fasciculata var. franciscana,Aphyllon franciscanum
|
1315
1316
|
Orobanche fasciculata var. lutea,Aphyllon fasciculatum
|
1316
1317
|
Orobanche fasciculata var. subulata,Aphyllon fasciculatum
|
1317
1318
|
Orobanche fasciculata,Aphyllon fasciculatum
|
@@ -1618,6 +1619,7 @@ Rorippa palustris var. occidentalis,Rorippa palustris subsp. palustris
|
|
1618
1619
|
Rosa eglanteria,Rosa rubiginosa
|
1619
1620
|
Rosa spithamea var. sonomensis,Rosa spithamea
|
1620
1621
|
Rostraria cristata,Koeleria gerardi
|
1622
|
+
Rostraria cristata,Koeleria gerardi,INAT
|
1621
1623
|
Rottboellia cylindrica,Hainardia cylindrica
|
1622
1624
|
Rubacer parviflorum,Rubus parviflorus
|
1623
1625
|
Rubus almus,Rubus pensilvanicus
|
@@ -1799,6 +1801,7 @@ Smilacina racemosa var. glabra,Maianthemum racemosum
|
|
1799
1801
|
Smilacina racemosa,Maianthemum racemosum
|
1800
1802
|
Smilacina stellata var. sessilifolia,Maianthemum stellatum
|
1801
1803
|
Smilacina stellata,Maianthemum stellatum
|
1804
|
+
Solanum nitidibaccatum,Solanum physalifolium var. nitidibaccatum,INAT
|
1802
1805
|
Solanum nodiflorum,Solanum americanum
|
1803
1806
|
Solanum tenuilobatum,Solanum xanti
|
1804
1807
|
Solanum umbelliferum var. glabrescens,Solanum umbelliferum
|
@@ -1942,8 +1945,12 @@ Tropidocarpum gracile var. dubium,Tropidocarpum gracile
|
|
1942
1945
|
Ulmus carpinifolia,Ulmus minor
|
1943
1946
|
Ulmus procera,Ulmus minor
|
1944
1947
|
Umbellularia californica var. fresnensis,Umbellularia californica
|
1948
|
+
Urtica californica,Urtica dioica subsp. gracilis
|
1945
1949
|
Urtica gracilis subsp. holosericea,Urtica dioica subsp. holosericea,INAT
|
1950
|
+
Urtica gracilis,Urtica dioica subsp. gracilis
|
1951
|
+
Urtica gracilis,Urtica dioica subsp. gracilis,INAT
|
1946
1952
|
Urtica holosericea,Urtica dioica subsp. holosericea
|
1953
|
+
Urtica lyallii,Urtica dioica subsp. gracilis
|
1947
1954
|
Vaccinium ovatum var. saporosum,Vaccinium ovatum
|
1948
1955
|
Vancouveria parviflora,Vancouveria planipetala
|
1949
1956
|
Veatchia crystallina,Triteleia hyacinthina
|
package/data/taxa.csv
CHANGED
@@ -113,6 +113,7 @@ Aphanes occidentalis,,N,13608,420,866483
|
|
113
113
|
Aphyllon californicum subsp. jepsonii,,N,103325,13438,802459
|
114
114
|
Aphyllon epigalium subsp. epigalium,,N,103327,13527,809377
|
115
115
|
Aphyllon fasciculatum,clustered broom-rape,N,100018,13441,802543
|
116
|
+
Aphyllon franciscanum,"yellow clustered broom-rape,Franciscan broom-rape",N,84892,14625,1303043
|
116
117
|
Aphyllon pinorum,pinewoods broom-rape,N,13618,13445,802557
|
117
118
|
Aphyllon purpureum,naked broom-rape,N,103312,13529,739040
|
118
119
|
Aphyllon tuberosum,bulbous broom-rape,N,13614,13446,809373
|
@@ -940,7 +941,7 @@ Keckiella corymbosa,,N,29883,4523,62043
|
|
940
941
|
Kickxia elatine,fluellin,X,29898,4532,64332
|
941
942
|
Kickxia spuria,fluellin,X,29899,4533,64191
|
942
943
|
Kniphofia uvaria,,X,29921,8635,56035
|
943
|
-
Koeleria gerardi,annual junegrass,X,29957,13237,
|
944
|
+
Koeleria gerardi,annual junegrass,X,29957,13237,167999
|
944
945
|
Koeleria macrantha,junegrass,N,29951,4539,57183
|
945
946
|
Kopsiopsis strobilacea,California ground-cone,N,93802,11786,77612
|
946
947
|
Lactuca saligna,,X,3688,4549,53105
|
@@ -1101,7 +1102,7 @@ Madia sativa,coast tarweed,N,4055,5298,53143,yellow
|
|
1101
1102
|
Maianthemum racemosum,false Solomon's seal,N,32495,10096,51062
|
1102
1103
|
Maianthemum stellatum,,N,32497,9629,53268
|
1103
1104
|
Malacothamnus fremontii,white-coat mallow,N,32524,5312,70397
|
1104
|
-
Malacothamnus hallii,Hall's bush mallow,N,32519,5314,
|
1105
|
+
Malacothamnus hallii,Hall's bush mallow,N,32519,5314,1497404,,,,1065,1B.2,,,S2,G2
|
1105
1106
|
Malacothrix californica,,N,4059,5325,58026
|
1106
1107
|
Malacothrix clevelandii,Cleveland's malacothrix,N,4060,5326,58841
|
1107
1108
|
Malacothrix coulteri,snake's-head,N,4061,5327,58027
|
@@ -1622,7 +1623,7 @@ Solanum elaeagnifolium,white horse-nettle,X,44852,7654,79137
|
|
1622
1623
|
Solanum furcatum,,X,44856,7655,79138
|
1623
1624
|
Solanum lanceolatum,lanceleaf nightshade,X,44872,7656,79139
|
1624
1625
|
Solanum nigrum,black nightshade,X,44883,7658,79141
|
1625
|
-
Solanum physalifolium var. nitidibaccatum,nightshade,X,66519,11086,
|
1626
|
+
Solanum physalifolium var. nitidibaccatum,nightshade,X,66519,11086,406080
|
1626
1627
|
Solanum umbelliferum,blue witch,N,44919,7664,50639
|
1627
1628
|
Solanum xanti,,N,77308,7666,79146
|
1628
1629
|
Soleirolia soleirolii,baby's tears,X,44928,7667,79147
|
@@ -1782,6 +1783,7 @@ Ulmus minor,English elm,X,47478,8180,79461
|
|
1782
1783
|
Umbellularia californica,California bay,N,47489,8183,48807
|
1783
1784
|
Uropappus lindleyi,silver puffs,N,76212,8184,50806
|
1784
1785
|
Urospermum picroides,false hawkbit,X,5477,8185,59361
|
1786
|
+
Urtica dioica subsp. gracilis,American stinging nettle,N,53302,8186,141854
|
1785
1787
|
Urtica dioica subsp. holosericea,hoary nettle,N,53303,8187,141851
|
1786
1788
|
Urtica urens,dwarf nettle,X,47589,8188,53315
|
1787
1789
|
Vaccinium ovatum,"California huckleberry,evergreen huckleberry",N,47685,8200,48349
|
package/ebook/css/main.css
CHANGED
package/lib/dateutils.js
CHANGED
@@ -16,7 +16,26 @@ const MONTH_NAMES = [
|
|
16
16
|
class DateUtils {
|
17
17
|
|
18
18
|
static getMonthName( monthNum ) {
|
19
|
-
return MONTH_NAMES[ monthNum ];
|
19
|
+
return MONTH_NAMES[ monthNum - 1 ];
|
20
|
+
}
|
21
|
+
|
22
|
+
static monthRangesOverlap( r1, r2 ) {
|
23
|
+
|
24
|
+
function contains( r1, r2 ) {
|
25
|
+
function inRange( v, r ) {
|
26
|
+
return v >= r[ 0 ] && v <= r[ 1 ];
|
27
|
+
}
|
28
|
+
return inRange( r1[ 0 ], r2 ) || inRange( r1[ 1 ], r2 );
|
29
|
+
}
|
30
|
+
|
31
|
+
// If ranges cross into next year, split them in 2.
|
32
|
+
if ( r1[ 0 ] > r1[ 1 ] ) {
|
33
|
+
return this.monthRangesOverlap( [ r1[ 0 ], 12 ], r2 ) || this.monthRangesOverlap( [ 1, r1[ 1 ] ], r2 );
|
34
|
+
}
|
35
|
+
if ( r2[ 0 ] > r2[ 1 ] ) {
|
36
|
+
return this.monthRangesOverlap( r1, [ r2[ 0 ], 12 ] ) || this.monthRangesOverlap( r1, [ 1, r2[ 1 ] ] );
|
37
|
+
}
|
38
|
+
return contains( r1, r2 ) || contains( r2, r1 );
|
20
39
|
}
|
21
40
|
|
22
41
|
}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import { EBookPage } from "../ebookpage.js";
|
2
|
+
import { XHTML } from "../xhtml.js";
|
3
|
+
import { DateUtils } from "../../dateutils.js";
|
4
|
+
import { EBook } from "../ebook.js";
|
5
|
+
import { Taxa } from "../../taxa.js";
|
6
|
+
|
7
|
+
const FN_FLOWER_TIME_INDEX = "fm.html";
|
8
|
+
|
9
|
+
class PageListFlowers {
|
10
|
+
|
11
|
+
static createPages( contentDir ) {
|
12
|
+
new PageListFlowerTimeIndex( contentDir ).create();
|
13
|
+
for ( let m1 = 1; m1 < 13; m1++ ) {
|
14
|
+
new PageListFlowerTime( contentDir, m1 ).create();
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
static getManifestEntries() {
|
19
|
+
|
20
|
+
const manifestEntries = [];
|
21
|
+
|
22
|
+
manifestEntries.push( EBook.getManifestEntry( "fm0", FN_FLOWER_TIME_INDEX ) );
|
23
|
+
for ( let m1 = 1; m1 < 13; m1++ ) {
|
24
|
+
manifestEntries.push( EBook.getManifestEntry( "fm" + m1, PageListFlowerTime.getFileNameBloomTime( m1 ) ) );
|
25
|
+
}
|
26
|
+
|
27
|
+
return manifestEntries.join( "" );
|
28
|
+
}
|
29
|
+
|
30
|
+
static getSpineEntries() {
|
31
|
+
|
32
|
+
const spineEntries = [];
|
33
|
+
|
34
|
+
spineEntries.push( EBook.getSpineEntry( "fm0" ) );
|
35
|
+
for ( let m1 = 1; m1 < 13; m1++ ) {
|
36
|
+
spineEntries.push( EBook.getSpineEntry( "fm" + m1 ) );
|
37
|
+
}
|
38
|
+
|
39
|
+
return spineEntries.join( "" );
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
static renderMonthLinks() {
|
44
|
+
const links = [];
|
45
|
+
for ( let m1 = 1; m1 < 13; m1++ ) {
|
46
|
+
links.push(
|
47
|
+
XHTML.getLink(
|
48
|
+
PageListFlowerTime.getFileNameBloomTime( m1 ),
|
49
|
+
DateUtils.getMonthName( m1 ) + " - " + DateUtils.getMonthName( ( m1 ) % 12 + 1 )
|
50
|
+
)
|
51
|
+
);
|
52
|
+
}
|
53
|
+
return XHTML.wrap( "ol", XHTML.arrayToLI( links ) );
|
54
|
+
}
|
55
|
+
|
56
|
+
}
|
57
|
+
|
58
|
+
class PageListFlowerTimeIndex extends EBookPage {
|
59
|
+
|
60
|
+
constructor( outputDir ) {
|
61
|
+
super( outputDir + "/" + FN_FLOWER_TIME_INDEX, "Flowering Times" );
|
62
|
+
}
|
63
|
+
|
64
|
+
renderPageBody() {
|
65
|
+
const html = XHTML.textElement( "h1", this.getTitle() );
|
66
|
+
return html + PageListFlowers.renderMonthLinks();
|
67
|
+
}
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
class PageListFlowerTime extends EBookPage {
|
72
|
+
|
73
|
+
#m1;
|
74
|
+
#m2;
|
75
|
+
|
76
|
+
constructor( outputDir, month ) {
|
77
|
+
super(
|
78
|
+
outputDir + "/" + PageListFlowerTime.getFileNameBloomTime( month ),
|
79
|
+
"Flowering in " + DateUtils.getMonthName( month ) + " - " + DateUtils.getMonthName( month % 12 + 1 )
|
80
|
+
);
|
81
|
+
this.#m1 = month;
|
82
|
+
this.#m2 = month % 12 + 1;
|
83
|
+
}
|
84
|
+
|
85
|
+
static getFileNameBloomTime( m1 ) {
|
86
|
+
return "list_fm_" + m1 + ".html";
|
87
|
+
}
|
88
|
+
|
89
|
+
renderPageBody() {
|
90
|
+
|
91
|
+
const html = XHTML.textElement( "h1", this.getTitle() );
|
92
|
+
|
93
|
+
const range = [ this.#m1, this.#m2 ];
|
94
|
+
const links = [];
|
95
|
+
for ( const taxon of Taxa.getTaxa() ) {
|
96
|
+
const m1 = taxon.getBloomStart();
|
97
|
+
const m2 = taxon.getBloomEnd();
|
98
|
+
if ( m1 && DateUtils.monthRangesOverlap( range, [ m1, m2 ] ) ) {
|
99
|
+
links.push( XHTML.getLink( taxon.getFileName(), taxon.getName() ) );
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
return html + XHTML.wrap( "ol", XHTML.arrayToLI( links ) );
|
104
|
+
}
|
105
|
+
|
106
|
+
}
|
107
|
+
|
108
|
+
export { PageListFlowers, PageListFlowerTime };
|
@@ -3,6 +3,7 @@ import { Config, Files } from "@ca-plant-list/ca-plant-list";
|
|
3
3
|
import { EBookPage } from "../ebookpage.js";
|
4
4
|
import { XHTML } from "../xhtml.js";
|
5
5
|
import { Markdown } from "../../markdown.js";
|
6
|
+
import { DateUtils } from "../../dateutils.js";
|
6
7
|
|
7
8
|
class TaxonPage extends EBookPage {
|
8
9
|
|
@@ -19,16 +20,22 @@ class TaxonPage extends EBookPage {
|
|
19
20
|
|
20
21
|
renderPageBody() {
|
21
22
|
|
22
|
-
function
|
23
|
-
|
23
|
+
function renderBloomInfo( taxon ) {
|
24
|
+
const colors = taxon.getFlowerColors();
|
25
|
+
const monthStart = taxon.getBloomStart();
|
26
|
+
const monthEnd = taxon.getBloomEnd();
|
27
|
+
if ( !colors && !monthStart ) {
|
24
28
|
return "";
|
25
29
|
}
|
26
30
|
let html = "";
|
27
31
|
for ( const color of colors ) {
|
28
|
-
// html += XHTML.textElement( "span", "", { class: "color " + color } );
|
29
32
|
html += XHTML.textElement( "img", "", { src: "./i/f-" + color + ".svg", class: "flr" } );
|
30
33
|
}
|
31
|
-
|
34
|
+
if ( monthStart ) {
|
35
|
+
html += XHTML.textElement( "div", DateUtils.getMonthName( monthStart ) + "-" + DateUtils.getMonthName( monthEnd ) );
|
36
|
+
|
37
|
+
}
|
38
|
+
return XHTML.wrap( "div", html, { class: "flr" } );
|
32
39
|
}
|
33
40
|
|
34
41
|
|
@@ -53,7 +60,7 @@ class TaxonPage extends EBookPage {
|
|
53
60
|
html += XHTML.textElement( "p", cn.join( ", " ) );
|
54
61
|
}
|
55
62
|
|
56
|
-
html +=
|
63
|
+
html += renderBloomInfo( this.#taxon );
|
57
64
|
|
58
65
|
html += renderCustomText( this.#taxon.getBaseFileName() );
|
59
66
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { EBookPage } from "../ebookpage.js";
|
2
2
|
import { XHTML } from "../xhtml.js";
|
3
3
|
import { FLOWER_COLOR_NAMES } from "../../taxa.js";
|
4
|
+
import { PageListFlowers } from "./page_list_flowers.js";
|
4
5
|
|
5
6
|
class TOCPage extends EBookPage {
|
6
7
|
|
@@ -15,6 +16,7 @@ class TOCPage extends EBookPage {
|
|
15
16
|
|
16
17
|
const mainLinks = [];
|
17
18
|
mainLinks.push( this.#getFlowerColorLinks() );
|
19
|
+
mainLinks.push( this.#getFlowerTimeLinks() );
|
18
20
|
mainLinks.push( XHTML.getLink( "./list_families.html", "All Families" ) );
|
19
21
|
mainLinks.push( XHTML.getLink( "./list_species.html", "All Species" ) );
|
20
22
|
mainLinks.push( XHTML.getLink( "./glossary.html", "Glossary" ) );
|
@@ -33,6 +35,12 @@ class TOCPage extends EBookPage {
|
|
33
35
|
}
|
34
36
|
return html + XHTML.wrap( "ol", XHTML.arrayToLI( links ) );
|
35
37
|
}
|
38
|
+
|
39
|
+
#getFlowerTimeLinks() {
|
40
|
+
const html = XHTML.getLink( "fm.html", "Flowering Times" );
|
41
|
+
return html + PageListFlowers.renderMonthLinks();
|
42
|
+
}
|
43
|
+
|
36
44
|
}
|
37
45
|
|
38
46
|
export { TOCPage };
|
package/lib/ebook/plantbook.js
CHANGED
@@ -4,6 +4,7 @@ import { GlossaryPages } from "./glossarypages.js";
|
|
4
4
|
import { Images } from "./images.js";
|
5
5
|
import { PageListFamilies } from "./pages/page_list_families.js";
|
6
6
|
import { PageListFlowerColor } from "./pages/page_list_flower_color.js";
|
7
|
+
import { PageListFlowers } from "./pages/page_list_flowers.js";
|
7
8
|
import { PageListSpecies } from "./pages/page_list_species.js";
|
8
9
|
import { TaxonPage } from "./pages/taxonpage.js";
|
9
10
|
import { TOCPage } from "./pages/tocpage.js";
|
@@ -44,6 +45,9 @@ class PlantBook extends EBook {
|
|
44
45
|
for ( const colorName of FLOWER_COLOR_NAMES ) {
|
45
46
|
new PageListFlowerColor( contentDir, Taxa.getFlowerColor( colorName ) ).create();
|
46
47
|
}
|
48
|
+
|
49
|
+
PageListFlowers.createPages( contentDir );
|
50
|
+
|
47
51
|
new PageListFamilies( contentDir ).create();
|
48
52
|
for ( const family of Families.getFamilies() ) {
|
49
53
|
const taxa = family.getTaxa();
|
@@ -89,6 +93,7 @@ class PlantBook extends EBook {
|
|
89
93
|
xml += "<item id=\"t" + index + "\" href=\"" + taxon.getFileName() + "\" media-type=\"application/xhtml+xml\" />";
|
90
94
|
}
|
91
95
|
|
96
|
+
xml += PageListFlowers.getManifestEntries();
|
92
97
|
xml += this.#glossary.getManifestEntries();
|
93
98
|
xml += this.#images.getManifestEntries();
|
94
99
|
|
@@ -103,6 +108,8 @@ class PlantBook extends EBook {
|
|
103
108
|
const color = Taxa.getFlowerColor( colorName );
|
104
109
|
xml += "<itemref idref=\"l" + color.getColorName() + "\"/>";
|
105
110
|
}
|
111
|
+
xml += PageListFlowers.getSpineEntries();
|
112
|
+
|
106
113
|
xml += "<itemref idref=\"lfamilies\"/>";
|
107
114
|
xml += "<itemref idref=\"lspecies\"/>";
|
108
115
|
|
package/lib/index.d.ts
CHANGED
@@ -27,6 +27,10 @@ export class DataLoader {
|
|
27
27
|
static init(taxaDir: any): void;
|
28
28
|
static load(options: any): void;
|
29
29
|
}
|
30
|
+
export class DateUtils {
|
31
|
+
static getMonthName(monthNum: any): string;
|
32
|
+
static monthRangesOverlap(r1: any, r2: any): any;
|
33
|
+
}
|
30
34
|
export class ErrorLog {
|
31
35
|
static "__#8@#errors": any[];
|
32
36
|
static log(...args: any[]): void;
|