@ca-plant-list/ca-plant-list 0.4.26 → 0.4.27
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/taxa.csv +1 -0
- package/generators/eleventy/layouts/h1.njk +6 -0
- package/generators/eleventy/layouts/html.njk +55 -0
- package/lib/basepagerenderer.js +35 -15
- package/lib/config.js +5 -3
- package/lib/ebook/ebookpage.js +1 -4
- package/lib/ebook/ebooksitegenerator.js +4 -12
- package/lib/ebook/glossarypages.js +1 -3
- package/lib/ebook/plantbook.js +1 -1
- package/lib/files.js +1 -0
- package/lib/htmltaxon.js +8 -19
- package/lib/index.d.ts +20 -8
- package/lib/index.js +4 -2
- package/lib/jekyll.js +40 -59
- package/lib/markdown.js +3 -5
- package/lib/sitegenerator.js +68 -12
- package/lib/types.js +4 -0
- package/lib/utils/eleventyGenerator.js +82 -0
- package/lib/utils/htmlFragments.js +19 -0
- package/lib/web/glossarypages.js +6 -10
- package/lib/web/pageFamily.js +14 -14
- package/lib/web/pageGeneric.js +78 -0
- package/lib/web/{pagetaxon.js → pageTaxon.js} +4 -4
- package/lib/web/pageTaxonList.js +53 -0
- package/lib/{pagerenderer.js → web/renderAllPages.js} +38 -80
- package/package.json +12 -10
- package/scripts/build-site.js +20 -52
- package/static/assets/js/nameSearchData.js +2 -0
- package/{jekyll → static}/assets/js/name_search.js +12 -14
- package/static/name_search.html +15 -0
- package/jekyll/_includes/glossary.html +0 -0
- package/jekyll/name_search.html +0 -17
- package/lib/genericpage.js +0 -88
- /package/{jekyll → generators}/_includes/analytics.html +0 -0
- /package/{jekyll → generators}/_includes/menu_extra.html +0 -0
- /package/{jekyll → generators/jekyll}/_config.yml +0 -0
- /package/{jekyll → generators/jekyll}/_layouts/default.html +0 -0
- /package/{jekyll → generators/jekyll}/_layouts/html.html +0 -0
- /package/{jekyll → static}/assets/css/main.css +0 -0
- /package/{jekyll → static}/assets/js/ui.js +0 -0
- /package/{jekyll → static}/assets/js/utils.js +0 -0
- /package/{jekyll → static}/index.md +0 -0
package/lib/types.js
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
/**
|
2
|
+
* Types
|
3
|
+
* @typedef {{t:string,c?:string,s?:string[]}} NameSearchData
|
4
|
+
*
|
2
5
|
* Classes
|
3
6
|
* @typedef {import("./config.js").Config} Config
|
4
7
|
* @typedef {import("./taxonomy/families.js").Families} Families
|
5
8
|
* @typedef {import("./taxonomy/families.js").Family} Family
|
9
|
+
* @typedef {import("./sitegenerator.js").SiteGenerator} SiteGenerator
|
6
10
|
* @typedef {import("./taxonomy/taxa.js").Taxa} Taxa
|
7
11
|
* @typedef {import("./index.js").TaxaColDef<import("./types.js").Taxon>} TaxaColDef
|
8
12
|
* @typedef {import("./taxonomy/taxon.js").Taxon} Taxon
|
@@ -0,0 +1,82 @@
|
|
1
|
+
// @ts-ignore
|
2
|
+
import { Eleventy } from "@11ty/eleventy";
|
3
|
+
import { SiteGenerator } from "../sitegenerator.js";
|
4
|
+
import path from "node:path";
|
5
|
+
import { Files } from "../files.js";
|
6
|
+
import { Config } from "../config.js";
|
7
|
+
|
8
|
+
export class EleventyGenerator extends SiteGenerator {
|
9
|
+
copyGeneratorFiles() {
|
10
|
+
// First copy default files from package.
|
11
|
+
const layoutSrc = "./generators/eleventy/layouts";
|
12
|
+
const commonSrc = "./generators/_includes";
|
13
|
+
const dest = path.join(this.getBaseDir(), "_includes");
|
14
|
+
|
15
|
+
Files.copyDir(path.join(Config.getPackageDir(), commonSrc), dest);
|
16
|
+
Files.copyDir(path.join(Config.getPackageDir(), layoutSrc), dest);
|
17
|
+
|
18
|
+
// Then copy files from current dir (which may override default files).
|
19
|
+
if (Files.isDir(commonSrc)) {
|
20
|
+
Files.copyDir(commonSrc, dest);
|
21
|
+
}
|
22
|
+
if (Files.isDir(layoutSrc)) {
|
23
|
+
Files.copyDir(layoutSrc, dest);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
/**
|
28
|
+
* @param {string} webDir
|
29
|
+
*/
|
30
|
+
async generate(webDir) {
|
31
|
+
const srcDir = this.getBaseDir();
|
32
|
+
const config = this.getConfig();
|
33
|
+
const generator = this;
|
34
|
+
let elev = new Eleventy(srcDir, webDir, {
|
35
|
+
quietMode: true,
|
36
|
+
config:
|
37
|
+
// @ts-ignore
|
38
|
+
function (eleventyConfig) {
|
39
|
+
// Not running in project root, so using .gitignore will break things.
|
40
|
+
eleventyConfig.setUseGitIgnore(false);
|
41
|
+
|
42
|
+
// Don't change file system structure when writing output files.
|
43
|
+
eleventyConfig.addGlobalData("permalink", () => {
|
44
|
+
// @ts-ignore
|
45
|
+
return (data) => {
|
46
|
+
// Include directories in the generated content.
|
47
|
+
const inputPath = path.relative(
|
48
|
+
srcDir,
|
49
|
+
data.page.inputPath,
|
50
|
+
);
|
51
|
+
// Remove the file extension.
|
52
|
+
const parsed = path.parse(inputPath);
|
53
|
+
return path.join(parsed.dir, `${parsed.name}.html`);
|
54
|
+
};
|
55
|
+
});
|
56
|
+
|
57
|
+
// Use layout with <h1> by default.
|
58
|
+
eleventyConfig.addGlobalData("layout", "h1.njk");
|
59
|
+
|
60
|
+
// Set site name for use in nav bar.
|
61
|
+
eleventyConfig.addGlobalData(
|
62
|
+
"siteName",
|
63
|
+
config.getSiteName(),
|
64
|
+
);
|
65
|
+
|
66
|
+
const passThroughPatterns = [
|
67
|
+
"assets",
|
68
|
+
"i",
|
69
|
+
"errors.tsv",
|
70
|
+
...generator.getPassThroughPatterns(),
|
71
|
+
];
|
72
|
+
for (const pattern of passThroughPatterns) {
|
73
|
+
eleventyConfig.addPassthroughCopy(
|
74
|
+
// Eleventy apparently can't handle windows paths in globs, so change it.
|
75
|
+
path.join(srcDir, pattern).replaceAll("\\", "/"),
|
76
|
+
);
|
77
|
+
}
|
78
|
+
},
|
79
|
+
});
|
80
|
+
await elev.write();
|
81
|
+
}
|
82
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { HTML } from "../html.js";
|
2
|
+
import { Markdown } from "../markdown.js";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Utilities to create HTML fragments specific to ca-plant-list.
|
6
|
+
*/
|
7
|
+
export class HTMLFragments {
|
8
|
+
/**
|
9
|
+
* @param {string} filePath
|
10
|
+
* @returns {string}
|
11
|
+
*/
|
12
|
+
static getMarkdownSection(filePath) {
|
13
|
+
const footerMarkdown = Markdown.fileToHTML(filePath);
|
14
|
+
if (footerMarkdown) {
|
15
|
+
return HTML.wrap("div", footerMarkdown, "section");
|
16
|
+
}
|
17
|
+
return "";
|
18
|
+
}
|
19
|
+
}
|
package/lib/web/glossarypages.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { Glossary } from "../plants/glossary.js";
|
2
2
|
import { Markdown } from "../markdown.js";
|
3
3
|
import { HTML } from "../html.js";
|
4
|
-
import
|
4
|
+
import path from "node:path";
|
5
5
|
|
6
6
|
const ENTRY_DIR = "g";
|
7
7
|
|
8
|
-
class GlossaryPages {
|
8
|
+
export class GlossaryPages {
|
9
9
|
#siteGenerator;
|
10
10
|
#glossary;
|
11
11
|
|
@@ -22,14 +22,13 @@ class GlossaryPages {
|
|
22
22
|
*/
|
23
23
|
#generateEntryPage(entry) {
|
24
24
|
const title = entry.getTermName();
|
25
|
-
let html = HTML.
|
26
|
-
html += HTML.wrap("div", Markdown.strToHTML(entry.getMarkdown()), {
|
25
|
+
let html = HTML.wrap("div", Markdown.strToHTML(entry.getMarkdown()), {
|
27
26
|
class: "glossary",
|
28
27
|
});
|
29
28
|
this.#siteGenerator.writeTemplate(
|
30
29
|
html,
|
31
30
|
{ title: title },
|
32
|
-
|
31
|
+
path.posix.join(ENTRY_DIR, title + ".html"),
|
33
32
|
);
|
34
33
|
}
|
35
34
|
|
@@ -49,13 +48,12 @@ class GlossaryPages {
|
|
49
48
|
for (const entry of entries) {
|
50
49
|
links.push(
|
51
50
|
HTML.getLink(
|
52
|
-
|
51
|
+
path.posix.join(ENTRY_DIR, entry.getHTMLFileName()),
|
53
52
|
entry.getTermName(),
|
54
53
|
),
|
55
54
|
);
|
56
55
|
}
|
57
|
-
|
58
|
-
html += HTML.wrap("ol", HTML.arrayToLI(links));
|
56
|
+
const html = HTML.wrap("ol", HTML.arrayToLI(links));
|
59
57
|
this.#siteGenerator.writeTemplate(
|
60
58
|
html,
|
61
59
|
{ title: "Glossary" },
|
@@ -72,5 +70,3 @@ class GlossaryPages {
|
|
72
70
|
this.#generateEntryPages();
|
73
71
|
}
|
74
72
|
}
|
75
|
-
|
76
|
-
export { GlossaryPages };
|
package/lib/web/pageFamily.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ExternalSites } from "../externalsites.js";
|
2
|
-
import { GenericPage } from "
|
2
|
+
import { GenericPage } from "./pageGeneric.js";
|
3
3
|
import { HTML } from "../html.js";
|
4
4
|
import { HTMLTaxon } from "../htmltaxon.js";
|
5
5
|
import { Sections } from "../taxonomy/families.js";
|
@@ -8,11 +8,11 @@ export class PageFamilyList extends GenericPage {
|
|
8
8
|
#families;
|
9
9
|
|
10
10
|
/**
|
11
|
-
* @param {
|
11
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
12
12
|
* @param {import("../types.js").Family[]} families
|
13
13
|
*/
|
14
|
-
constructor(
|
15
|
-
super(
|
14
|
+
constructor(siteGenerator, families) {
|
15
|
+
super(siteGenerator, "Families", "list_families");
|
16
16
|
this.#families = families;
|
17
17
|
}
|
18
18
|
|
@@ -28,7 +28,7 @@ export class PageFamilyList extends GenericPage {
|
|
28
28
|
const taxa = sections[name];
|
29
29
|
|
30
30
|
// Render the section page.
|
31
|
-
new PageSection(this.
|
31
|
+
new PageSection(this.getSiteGenerator(), name, taxa).render(
|
32
32
|
taxaColumns,
|
33
33
|
);
|
34
34
|
|
@@ -69,13 +69,13 @@ export class PageFamilyList extends GenericPage {
|
|
69
69
|
}
|
70
70
|
|
71
71
|
/**
|
72
|
-
* @param {
|
72
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
73
73
|
* @param {import("../types.js").TaxaColDef[]} [taxaColumns]
|
74
74
|
*/
|
75
|
-
renderPages(
|
75
|
+
renderPages(siteGenerator, taxaColumns) {
|
76
76
|
for (const family of this.#families) {
|
77
77
|
if (family.getTaxa()) {
|
78
|
-
new PageFamily(
|
78
|
+
new PageFamily(siteGenerator, family).render(taxaColumns);
|
79
79
|
}
|
80
80
|
}
|
81
81
|
}
|
@@ -85,11 +85,11 @@ class PageFamily extends GenericPage {
|
|
85
85
|
#family;
|
86
86
|
|
87
87
|
/**
|
88
|
-
* @param {
|
88
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
89
89
|
* @param {import("../types.js").Family} family
|
90
90
|
*/
|
91
|
-
constructor(
|
92
|
-
super(
|
91
|
+
constructor(siteGenerator, family) {
|
92
|
+
super(siteGenerator, family.getName(), family.getBaseFileName());
|
93
93
|
this.#family = family;
|
94
94
|
}
|
95
95
|
|
@@ -124,12 +124,12 @@ class PageSection extends GenericPage {
|
|
124
124
|
#taxa;
|
125
125
|
|
126
126
|
/**
|
127
|
-
* @param {
|
127
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
128
128
|
* @param {string} name
|
129
129
|
* @param {import("../types.js").Taxon[]} taxa
|
130
130
|
*/
|
131
|
-
constructor(
|
132
|
-
super(
|
131
|
+
constructor(siteGenerator, name, taxa) {
|
132
|
+
super(siteGenerator, name, name);
|
133
133
|
this.#taxa = taxa;
|
134
134
|
}
|
135
135
|
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import path from "node:path";
|
2
|
+
import { Config } from "../config.js";
|
3
|
+
import { Files } from "../files.js";
|
4
|
+
import { HTMLFragments } from "../utils/htmlFragments.js";
|
5
|
+
|
6
|
+
export class GenericPage {
|
7
|
+
#siteGenerator;
|
8
|
+
#title;
|
9
|
+
#baseFileName;
|
10
|
+
#js;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
14
|
+
* @param {string} title
|
15
|
+
* @param {string} baseFileName
|
16
|
+
* @param {string} [js]
|
17
|
+
*/
|
18
|
+
constructor(siteGenerator, title, baseFileName, js) {
|
19
|
+
this.#siteGenerator = siteGenerator;
|
20
|
+
this.#title = title;
|
21
|
+
this.#baseFileName = baseFileName;
|
22
|
+
this.#js = js;
|
23
|
+
}
|
24
|
+
|
25
|
+
getBaseFileName() {
|
26
|
+
return this.#baseFileName;
|
27
|
+
}
|
28
|
+
|
29
|
+
getDefaultIntro() {
|
30
|
+
let html = this.getFrontMatter();
|
31
|
+
return html + this.getMarkdown();
|
32
|
+
}
|
33
|
+
|
34
|
+
getFrontMatter() {
|
35
|
+
return this.#siteGenerator.getFrontMatter({
|
36
|
+
title: this.#title,
|
37
|
+
js: this.#js,
|
38
|
+
});
|
39
|
+
}
|
40
|
+
|
41
|
+
getMarkdown() {
|
42
|
+
const localTextPath = path.join(
|
43
|
+
"./data/intros",
|
44
|
+
`${this.#baseFileName}.md`,
|
45
|
+
);
|
46
|
+
const globalTextPath = path.join(
|
47
|
+
Config.getPackageDir(),
|
48
|
+
"./data/text/",
|
49
|
+
`${this.#baseFileName}.md`,
|
50
|
+
);
|
51
|
+
return (
|
52
|
+
HTMLFragments.getMarkdownSection(localTextPath) +
|
53
|
+
HTMLFragments.getMarkdownSection(globalTextPath)
|
54
|
+
);
|
55
|
+
}
|
56
|
+
|
57
|
+
getOutputDir() {
|
58
|
+
return this.#siteGenerator.getBaseDir();
|
59
|
+
}
|
60
|
+
|
61
|
+
getSiteGenerator() {
|
62
|
+
return this.#siteGenerator;
|
63
|
+
}
|
64
|
+
|
65
|
+
getTitle() {
|
66
|
+
return this.#title;
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* @param {string} html
|
71
|
+
*/
|
72
|
+
writeFile(html) {
|
73
|
+
Files.write(
|
74
|
+
path.join(this.getOutputDir(), `${this.#baseFileName}.html`),
|
75
|
+
html,
|
76
|
+
);
|
77
|
+
}
|
78
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { RarePlants } from "../rareplants.js";
|
2
|
-
import { GenericPage } from "
|
2
|
+
import { GenericPage } from "./pageGeneric.js";
|
3
3
|
import { HTML } from "../html.js";
|
4
4
|
import { HTMLTaxon } from "../htmltaxon.js";
|
5
5
|
|
@@ -8,12 +8,12 @@ export class PageTaxon extends GenericPage {
|
|
8
8
|
#taxon;
|
9
9
|
|
10
10
|
/**
|
11
|
-
* @param {
|
11
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
12
12
|
* @param {import("../config.js").Config} config
|
13
13
|
* @param {import("../types.js").Taxon} taxon
|
14
14
|
*/
|
15
|
-
constructor(
|
16
|
-
super(
|
15
|
+
constructor(siteGenerator, config, taxon) {
|
16
|
+
super(siteGenerator, taxon.getName(), taxon.getBaseFileName());
|
17
17
|
this.#config = config;
|
18
18
|
this.#taxon = taxon;
|
19
19
|
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { GenericPage } from "./pageGeneric.js";
|
2
|
+
import { HTML } from "../html.js";
|
3
|
+
import { HTMLTaxon } from "../htmltaxon.js";
|
4
|
+
|
5
|
+
export class PageTaxonList extends GenericPage {
|
6
|
+
/**
|
7
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
8
|
+
* @param {string} title
|
9
|
+
* @param {string} baseName
|
10
|
+
*/
|
11
|
+
constructor(siteGenerator, title, baseName) {
|
12
|
+
super(siteGenerator, title, baseName);
|
13
|
+
}
|
14
|
+
|
15
|
+
/**
|
16
|
+
*
|
17
|
+
* @param {import("../types.js").Taxon[]} taxa
|
18
|
+
* @param {import("../types.js").TaxaColDef[]|undefined} columns
|
19
|
+
*/
|
20
|
+
render(taxa, columns) {
|
21
|
+
let html = this.getDefaultIntro();
|
22
|
+
|
23
|
+
html += '<div class="wrapper">';
|
24
|
+
|
25
|
+
html += '<div class="section">';
|
26
|
+
html += HTMLTaxon.getTaxaTable(taxa, columns);
|
27
|
+
html += "</div>";
|
28
|
+
|
29
|
+
html += '<div class="section nobullet">';
|
30
|
+
html += HTML.textElement("h2", "Download");
|
31
|
+
html += "<ul>";
|
32
|
+
html +=
|
33
|
+
"<li>" +
|
34
|
+
HTML.getLink(
|
35
|
+
"./calflora_" + this.getBaseFileName() + ".txt",
|
36
|
+
"Calflora List",
|
37
|
+
) +
|
38
|
+
"</li>";
|
39
|
+
html +=
|
40
|
+
"<li>" +
|
41
|
+
HTML.getLink(
|
42
|
+
"./inat_" + this.getBaseFileName() + ".txt",
|
43
|
+
"iNaturalist List",
|
44
|
+
) +
|
45
|
+
"</li>";
|
46
|
+
html += "</ul>";
|
47
|
+
html += "</div>";
|
48
|
+
|
49
|
+
html += "</div>";
|
50
|
+
|
51
|
+
this.writeFile(html);
|
52
|
+
}
|
53
|
+
}
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
1
|
+
import { RarePlants } from "../rareplants.js";
|
2
|
+
import { BasePageRenderer } from "../basepagerenderer.js";
|
3
|
+
import { Files } from "../files.js";
|
4
|
+
import { HTML } from "../html.js";
|
5
|
+
import { TAXA_LIST_COLS } from "../htmltaxon.js";
|
6
|
+
import { PageTaxonList } from "./pageTaxonList.js";
|
7
|
+
import { HTMLFragments } from "../utils/htmlFragments.js";
|
8
|
+
import { PageTaxon } from "./pageTaxon.js";
|
8
9
|
|
9
10
|
const ENDANGERED_COLS = [
|
10
11
|
TAXA_LIST_COLS.SPECIES,
|
@@ -18,33 +19,33 @@ const RPI_COLUMNS = [
|
|
18
19
|
TAXA_LIST_COLS.CNPS_RANK,
|
19
20
|
];
|
20
21
|
|
21
|
-
class PageRenderer extends BasePageRenderer {
|
22
|
+
export class PageRenderer extends BasePageRenderer {
|
22
23
|
/**
|
23
|
-
* @param {
|
24
|
-
* @param {import('
|
25
|
-
* @param {import("
|
24
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
25
|
+
* @param {import('../config.js').Config} config
|
26
|
+
* @param {import("../types.js").Taxa} taxa
|
26
27
|
*/
|
27
|
-
static
|
28
|
-
super.renderBasePages(
|
28
|
+
static renderAll(siteGenerator, config, taxa) {
|
29
|
+
super.renderBasePages(siteGenerator, taxa);
|
29
30
|
|
30
|
-
this.renderLists(
|
31
|
+
this.renderLists(siteGenerator, config, taxa);
|
31
32
|
|
32
33
|
const taxonList = taxa.getTaxonList();
|
33
34
|
for (const taxon of taxonList) {
|
34
|
-
new PageTaxon(
|
35
|
+
new PageTaxon(siteGenerator, config, taxon).render();
|
35
36
|
}
|
36
37
|
}
|
37
38
|
|
38
39
|
/**
|
39
|
-
* @param {
|
40
|
-
* @param {import('
|
41
|
-
* @param {import("
|
40
|
+
* @param {import("../types.js").SiteGenerator} siteGenerator
|
41
|
+
* @param {import('../config.js').Config} config
|
42
|
+
* @param {import("../types.js").Taxa} taxa
|
42
43
|
*/
|
43
|
-
static renderLists(
|
44
|
+
static renderLists(siteGenerator, config, taxa) {
|
44
45
|
/**
|
45
46
|
* @param {ListInfo[]} listInfo
|
46
47
|
* @param {Object<string,string>} attributes
|
47
|
-
* @param {import("
|
48
|
+
* @param {import("../types.js").TaxaColDef[]} [columns]
|
48
49
|
* @returns {string}
|
49
50
|
*/
|
50
51
|
function getListArray(listInfo, attributes = {}, columns) {
|
@@ -75,10 +76,11 @@ class PageRenderer extends BasePageRenderer {
|
|
75
76
|
);
|
76
77
|
|
77
78
|
const cols = columns ? columns : list.columns;
|
78
|
-
new PageTaxonList(
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
new PageTaxonList(
|
80
|
+
siteGenerator,
|
81
|
+
list.name,
|
82
|
+
list.filename,
|
83
|
+
).render(listTaxa, cols);
|
82
84
|
|
83
85
|
// Check for sublists.
|
84
86
|
const subListHTML = list.listInfo
|
@@ -117,7 +119,9 @@ class PageRenderer extends BasePageRenderer {
|
|
117
119
|
return html;
|
118
120
|
}
|
119
121
|
|
120
|
-
|
122
|
+
const outputDir = siteGenerator.getBaseDir();
|
123
|
+
|
124
|
+
/** @typedef {{name:string,filename:string,include:function(import("../types.js").Taxon):boolean,columns?:import("../types.js").TaxaColDef[],listInfo?:ListInfo[]}} ListInfo */
|
121
125
|
/** @type {{title:string,listInfo:ListInfo[]}[]} */
|
122
126
|
const sections = [
|
123
127
|
{
|
@@ -191,7 +195,10 @@ class PageRenderer extends BasePageRenderer {
|
|
191
195
|
},
|
192
196
|
];
|
193
197
|
|
194
|
-
let html =
|
198
|
+
let html =
|
199
|
+
HTMLFragments.getMarkdownSection("./data/intros/index_lists.md") +
|
200
|
+
'<div class="wrapper">';
|
201
|
+
|
195
202
|
for (const section of sections) {
|
196
203
|
const listHTML = getListArray(section.listInfo);
|
197
204
|
|
@@ -208,59 +215,10 @@ class PageRenderer extends BasePageRenderer {
|
|
208
215
|
|
209
216
|
html += "</div>";
|
210
217
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
class PageTaxonList extends GenericPage {
|
217
|
-
/**
|
218
|
-
* @param {string} outputDir
|
219
|
-
* @param {string} title
|
220
|
-
* @param {string} baseName
|
221
|
-
*/
|
222
|
-
constructor(outputDir, title, baseName) {
|
223
|
-
super(outputDir, title, baseName);
|
224
|
-
}
|
225
|
-
|
226
|
-
/**
|
227
|
-
*
|
228
|
-
* @param {import("./types.js").Taxon[]} taxa
|
229
|
-
* @param {import("./types.js").TaxaColDef[]|undefined} columns
|
230
|
-
*/
|
231
|
-
render(taxa, columns) {
|
232
|
-
let html = this.getDefaultIntro();
|
233
|
-
|
234
|
-
html += '<div class="wrapper">';
|
235
|
-
|
236
|
-
html += '<div class="section">';
|
237
|
-
html += HTMLTaxon.getTaxaTable(taxa, columns);
|
238
|
-
html += "</div>";
|
239
|
-
|
240
|
-
html += '<div class="section nobullet">';
|
241
|
-
html += HTML.textElement("h2", "Download");
|
242
|
-
html += "<ul>";
|
243
|
-
html +=
|
244
|
-
"<li>" +
|
245
|
-
HTML.getLink(
|
246
|
-
"./calflora_" + this.getBaseFileName() + ".txt",
|
247
|
-
"Calflora List",
|
248
|
-
) +
|
249
|
-
"</li>";
|
250
|
-
html +=
|
251
|
-
"<li>" +
|
252
|
-
HTML.getLink(
|
253
|
-
"./inat_" + this.getBaseFileName() + ".txt",
|
254
|
-
"iNaturalist List",
|
255
|
-
) +
|
256
|
-
"</li>";
|
257
|
-
html += "</ul>";
|
258
|
-
html += "</div>";
|
259
|
-
|
260
|
-
html += "</div>";
|
261
|
-
|
262
|
-
this.writeFile(html);
|
218
|
+
siteGenerator.writeTemplate(
|
219
|
+
html,
|
220
|
+
{ title: "Plant lists" },
|
221
|
+
"index_lists.html",
|
222
|
+
);
|
263
223
|
}
|
264
224
|
}
|
265
|
-
|
266
|
-
export { PageRenderer };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ca-plant-list/ca-plant-list",
|
3
|
-
"version": "0.4.
|
4
|
-
"description": "Tools to create
|
3
|
+
"version": "0.4.27",
|
4
|
+
"description": "Tools to create files for a website listing plants in an area of California.",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -12,9 +12,10 @@
|
|
12
12
|
"files": [
|
13
13
|
"data",
|
14
14
|
"ebook",
|
15
|
-
"
|
15
|
+
"generators",
|
16
16
|
"lib",
|
17
|
-
"scripts"
|
17
|
+
"scripts",
|
18
|
+
"static"
|
18
19
|
],
|
19
20
|
"exports": {
|
20
21
|
".": "./lib/index.js"
|
@@ -22,10 +23,10 @@
|
|
22
23
|
"types": "./lib/index.d.ts",
|
23
24
|
"scripts": {
|
24
25
|
"check": "npm run eslint && npm run tsc && npm run jest",
|
25
|
-
"eslint": "
|
26
|
+
"eslint": "eslint",
|
26
27
|
"jest": "node --experimental-vm-modules node_modules/jest/bin/jest.js tests",
|
27
|
-
"prettier": "
|
28
|
-
"tsc": "
|
28
|
+
"prettier": "prettier -l .",
|
29
|
+
"tsc": "tsc"
|
29
30
|
},
|
30
31
|
"bin": {
|
31
32
|
"ca-plant-list": "scripts/build-site.js",
|
@@ -35,10 +36,11 @@
|
|
35
36
|
"inatobsphotos": "scripts/inatobsphotos.js"
|
36
37
|
},
|
37
38
|
"dependencies": {
|
39
|
+
"@11ty/eleventy": "^3.0.0",
|
38
40
|
"@htmltools/scrape": "^0.1.1",
|
39
41
|
"archiver": "^5.3.1",
|
40
42
|
"cli-progress": "^3.12.0",
|
41
|
-
"commander": "^
|
43
|
+
"commander": "^13.1.0",
|
42
44
|
"csv-parse": "^5.6.0",
|
43
45
|
"csv-stringify": "^6.5.2",
|
44
46
|
"exceljs": "^4.4.0",
|
@@ -55,9 +57,9 @@
|
|
55
57
|
"@types/markdown-it": "^14.1.2",
|
56
58
|
"@types/node": "^22.10.7",
|
57
59
|
"@types/unzipper": "^0.10.9",
|
58
|
-
"eslint": "^9.
|
60
|
+
"eslint": "^9.20.1",
|
59
61
|
"jest": "^29.7.0",
|
60
|
-
"prettier": "^3.
|
62
|
+
"prettier": "^3.5.1",
|
61
63
|
"puppeteer": "^24.1.1",
|
62
64
|
"typescript": "^5.7.3"
|
63
65
|
}
|