@ca-plant-list/ca-plant-list 0.2.8 → 0.2.9
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 +3 -1
- package/data/taxa.csv +3 -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
|
@@ -1618,6 +1618,7 @@ Rorippa palustris var. occidentalis,Rorippa palustris subsp. palustris
|
|
1618
1618
|
Rosa eglanteria,Rosa rubiginosa
|
1619
1619
|
Rosa spithamea var. sonomensis,Rosa spithamea
|
1620
1620
|
Rostraria cristata,Koeleria gerardi
|
1621
|
+
Rostraria cristata,Koeleria gerardi,INAT
|
1621
1622
|
Rottboellia cylindrica,Hainardia cylindrica
|
1622
1623
|
Rubacer parviflorum,Rubus parviflorus
|
1623
1624
|
Rubus almus,Rubus pensilvanicus
|
@@ -1799,6 +1800,7 @@ Smilacina racemosa var. glabra,Maianthemum racemosum
|
|
1799
1800
|
Smilacina racemosa,Maianthemum racemosum
|
1800
1801
|
Smilacina stellata var. sessilifolia,Maianthemum stellatum
|
1801
1802
|
Smilacina stellata,Maianthemum stellatum
|
1803
|
+
Solanum nitidibaccatum,Solanum physalifolium var. nitidibaccatum,INAT
|
1802
1804
|
Solanum nodiflorum,Solanum americanum
|
1803
1805
|
Solanum tenuilobatum,Solanum xanti
|
1804
1806
|
Solanum umbelliferum var. glabrescens,Solanum umbelliferum
|
package/data/taxa.csv
CHANGED
@@ -940,7 +940,7 @@ Keckiella corymbosa,,N,29883,4523,62043
|
|
940
940
|
Kickxia elatine,fluellin,X,29898,4532,64332
|
941
941
|
Kickxia spuria,fluellin,X,29899,4533,64191
|
942
942
|
Kniphofia uvaria,,X,29921,8635,56035
|
943
|
-
Koeleria gerardi,annual junegrass,X,29957,13237,
|
943
|
+
Koeleria gerardi,annual junegrass,X,29957,13237,167999
|
944
944
|
Koeleria macrantha,junegrass,N,29951,4539,57183
|
945
945
|
Kopsiopsis strobilacea,California ground-cone,N,93802,11786,77612
|
946
946
|
Lactuca saligna,,X,3688,4549,53105
|
@@ -1101,7 +1101,7 @@ Madia sativa,coast tarweed,N,4055,5298,53143,yellow
|
|
1101
1101
|
Maianthemum racemosum,false Solomon's seal,N,32495,10096,51062
|
1102
1102
|
Maianthemum stellatum,,N,32497,9629,53268
|
1103
1103
|
Malacothamnus fremontii,white-coat mallow,N,32524,5312,70397
|
1104
|
-
Malacothamnus hallii,Hall's bush mallow,N,32519,5314,
|
1104
|
+
Malacothamnus hallii,Hall's bush mallow,N,32519,5314,1497404,,,,1065,1B.2,,,S2,G2
|
1105
1105
|
Malacothrix californica,,N,4059,5325,58026
|
1106
1106
|
Malacothrix clevelandii,Cleveland's malacothrix,N,4060,5326,58841
|
1107
1107
|
Malacothrix coulteri,snake's-head,N,4061,5327,58027
|
@@ -1622,7 +1622,7 @@ Solanum elaeagnifolium,white horse-nettle,X,44852,7654,79137
|
|
1622
1622
|
Solanum furcatum,,X,44856,7655,79138
|
1623
1623
|
Solanum lanceolatum,lanceleaf nightshade,X,44872,7656,79139
|
1624
1624
|
Solanum nigrum,black nightshade,X,44883,7658,79141
|
1625
|
-
Solanum physalifolium var. nitidibaccatum,nightshade,X,66519,11086,
|
1625
|
+
Solanum physalifolium var. nitidibaccatum,nightshade,X,66519,11086,406080
|
1626
1626
|
Solanum umbelliferum,blue witch,N,44919,7664,50639
|
1627
1627
|
Solanum xanti,,N,77308,7666,79146
|
1628
1628
|
Soleirolia soleirolii,baby's tears,X,44928,7667,79147
|
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;
|