@ca-plant-list/ca-plant-list 0.2.6 → 0.2.7
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/glossary/pappus.md +3 -0
- package/data/glossary/petiole.md +1 -0
- package/data/glossary/phyllary.md +1 -0
- package/data/glossary/stipule.md +1 -0
- package/data/illustrations/inkscape/asteraceae_floret.svg +157 -0
- package/data/illustrations/optimized/asteraceae_floret.svg +28 -0
- package/data/taxa.csv +142 -141
- package/data/text/Clematis-ligusticifolia.md +1 -0
- package/data/text/Grindelia-camporum.md +1 -1
- package/data/text/Grindelia-hirsutula.md +1 -1
- package/data/text/Lonicera-interrupta.md +1 -0
- package/data/text/Lonicera-subspicata-var-denudata.md +1 -0
- package/data/text/Taraxacum-officinale.md +1 -1
- package/data/text/Wyethia-angustifolia.md +1 -1
- package/data/text/Wyethia-glabra.md +1 -1
- package/data/text/Wyethia-helenioides.md +1 -1
- package/jekyll/_includes/glossary.html +0 -0
- package/jekyll/_layouts/html.html +3 -0
- package/jekyll/glossary.md +5 -0
- package/lib/basepagerenderer.js +5 -0
- package/lib/ebook/ebook.js +24 -0
- package/lib/ebook/ebookpage.js +4 -2
- package/lib/ebook/glossarypages.js +101 -0
- package/lib/ebook/images.js +86 -0
- package/lib/ebook/pages/taxonpage.js +2 -3
- package/lib/ebook/pages/tocpage.js +1 -0
- package/lib/ebook/plantbook.js +17 -67
- package/lib/genericpage.js +20 -4
- package/lib/html.js +1 -1
- package/lib/index.d.ts +18 -12
- package/lib/jekyll.js +11 -0
- package/lib/markdown.js +18 -0
- package/lib/pagerenderer.js +2 -3
- package/lib/plants/glossary.js +52 -0
- package/lib/web/glossarypages.js +52 -0
- package/lib/{pagetaxon.js → web/pagetaxon.js} +6 -6
- package/package.json +1 -1
- /package/{ebook/i → data/illustrations/optimized}/f-blue.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-orange.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-pink.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-red.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-white.svg +0 -0
- /package/{ebook/i → data/illustrations/optimized}/f-yellow.svg +0 -0
package/lib/markdown.js
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
import markdownIt from "markdown-it";
|
2
|
+
import { Files } from "@ca-plant-list/ca-plant-list";
|
3
|
+
|
4
|
+
class Markdown {
|
5
|
+
|
6
|
+
static #md = new markdownIt( { xhtmlOut: true } );
|
7
|
+
|
8
|
+
static fileToHTML( filePath ) {
|
9
|
+
return this.strToHTML( Files.read( filePath ) );
|
10
|
+
}
|
11
|
+
|
12
|
+
static strToHTML( str ) {
|
13
|
+
return this.#md.render( str );
|
14
|
+
}
|
15
|
+
|
16
|
+
}
|
17
|
+
|
18
|
+
export { Markdown };
|
package/lib/pagerenderer.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
import { HTML } from "
|
1
|
+
import { Files, HTML } from "@ca-plant-list/ca-plant-list";
|
2
2
|
import { Taxa, TAXA_LIST_COLS } from "./taxa.js";
|
3
|
-
import { PageTaxon } from "./pagetaxon.js";
|
3
|
+
import { PageTaxon } from "./web/pagetaxon.js";
|
4
4
|
import { Config } from "./config.js";
|
5
5
|
import { RarePlants } from "./rareplants.js";
|
6
6
|
import { BasePageRenderer } from "./basepagerenderer.js";
|
7
|
-
import { Files } from "./files.js";
|
8
7
|
import { GenericPage } from "./genericpage.js";
|
9
8
|
|
10
9
|
const ENDANGERED_COLS = [ TAXA_LIST_COLS.SPECIES, TAXA_LIST_COLS.COMMON_NAME, TAXA_LIST_COLS.CESA, TAXA_LIST_COLS.FESA ];
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { Config, Files } from "@ca-plant-list/ca-plant-list";
|
2
|
+
|
3
|
+
class Glossary {
|
4
|
+
|
5
|
+
#srcPath;
|
6
|
+
#srcEntries = [];
|
7
|
+
|
8
|
+
constructor() {
|
9
|
+
|
10
|
+
this.#srcPath = Config.getPackageDir() + "/data/glossary";
|
11
|
+
|
12
|
+
// Find all entries in the glossary directory.
|
13
|
+
const entries = Files.getDirEntries( this.#srcPath ).sort();
|
14
|
+
for ( const entry of entries ) {
|
15
|
+
this.#srcEntries.push( new GlossaryEntry( this.#srcPath, entry ) );
|
16
|
+
}
|
17
|
+
|
18
|
+
}
|
19
|
+
|
20
|
+
getEntries() {
|
21
|
+
return this.#srcEntries;
|
22
|
+
}
|
23
|
+
|
24
|
+
}
|
25
|
+
|
26
|
+
class GlossaryEntry {
|
27
|
+
|
28
|
+
#srcPath;
|
29
|
+
#fileName;
|
30
|
+
#term;
|
31
|
+
|
32
|
+
constructor( srcPath, fileName ) {
|
33
|
+
this.#srcPath = srcPath;
|
34
|
+
this.#fileName = fileName;
|
35
|
+
this.#term = fileName.split( "." )[ 0 ];
|
36
|
+
}
|
37
|
+
|
38
|
+
getHTMLFileName() {
|
39
|
+
return this.#term + ".html";
|
40
|
+
}
|
41
|
+
|
42
|
+
getMarkdown() {
|
43
|
+
return Files.read( this.#srcPath + "/" + this.#fileName );
|
44
|
+
}
|
45
|
+
|
46
|
+
getTermName() {
|
47
|
+
return this.#term;
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
export { Glossary };
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { Files, HTML } from "@ca-plant-list/ca-plant-list";
|
2
|
+
import { Glossary } from "../plants/glossary.js";
|
3
|
+
import { Jekyll } from "../jekyll.js";
|
4
|
+
|
5
|
+
class GlossaryPages {
|
6
|
+
|
7
|
+
#outputDir;
|
8
|
+
#entryDir;
|
9
|
+
#glossary;
|
10
|
+
|
11
|
+
constructor( outputDir ) {
|
12
|
+
this.#outputDir = outputDir;
|
13
|
+
this.#entryDir = outputDir + "/g";
|
14
|
+
this.#glossary = new Glossary();
|
15
|
+
}
|
16
|
+
|
17
|
+
#generateEntryPage( entry ) {
|
18
|
+
const front = Jekyll.getFrontMatter( { title: entry.getTermName() } );
|
19
|
+
const markdown = entry.getMarkdown();
|
20
|
+
Files.write( this.#entryDir + "/" + entry.getTermName() + ".md", front + markdown );
|
21
|
+
}
|
22
|
+
|
23
|
+
#generateEntryPages() {
|
24
|
+
const entries = this.#glossary.getEntries();
|
25
|
+
for ( const entry of entries ) {
|
26
|
+
this.#generateEntryPage( entry );
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
#generateIncludeFile() {
|
31
|
+
|
32
|
+
const links = [];
|
33
|
+
const entries = this.#glossary.getEntries();
|
34
|
+
for ( const entry of entries ) {
|
35
|
+
links.push( HTML.getLink( "g/" + entry.getHTMLFileName(), entry.getTermName() ) );
|
36
|
+
}
|
37
|
+
|
38
|
+
Files.write( this.#outputDir + "/_includes/glossary.html", HTML.arrayToLI( links ), true );
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
renderPages() {
|
43
|
+
// Make sure output directory exists.
|
44
|
+
Files.mkdir( this.#entryDir );
|
45
|
+
|
46
|
+
this.#generateIncludeFile();
|
47
|
+
this.#generateEntryPages();
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
export { GlossaryPages };
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { HTML } from "
|
2
|
-
import { Jepson } from "
|
3
|
-
import { Config } from "
|
4
|
-
import { RarePlants } from "
|
5
|
-
import { GenericPage } from "
|
6
|
-
import { ExternalSites } from "
|
1
|
+
import { HTML } from "@ca-plant-list/ca-plant-list";
|
2
|
+
import { Jepson } from "../jepson.js";
|
3
|
+
import { Config } from "../config.js";
|
4
|
+
import { RarePlants } from "../rareplants.js";
|
5
|
+
import { GenericPage } from "../genericpage.js";
|
6
|
+
import { ExternalSites } from "../externalsites.js";
|
7
7
|
|
8
8
|
class PageTaxon extends GenericPage {
|
9
9
|
|
package/package.json
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|