Compare commits
2 Commits
cf7d304474
...
c91c09e606
Author | SHA1 | Date |
---|---|---|
yellows111 | c91c09e606 | |
yellows111 | f2fc7e360c |
|
@ -19,13 +19,14 @@
|
|||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
MARKER = node compile
|
||||
SITEMAPGEN = node sitemap-gen
|
||||
BUILD_DIR = ./build
|
||||
SRC_DIRS = ./docs
|
||||
|
||||
MARKDOWN_L = $(patsubst %.md,%.html,$(shell find $(SRC_DIRS) -name "*.md"))
|
||||
COPY_L = $(patsubst %.css,%.justcopytobuilddir,$(shell find $(SRC_DIRS) -name "*.css"))
|
||||
|
||||
all: $(MARKDOWN_L) $(COPY_L)
|
||||
all: $(MARKDOWN_L) $(COPY_L) make_sitemap
|
||||
|
||||
$(MARKDOWN_L): %.html: %.md
|
||||
$(COPY_L): %.justcopytobuilddir: %.css
|
||||
|
@ -38,4 +39,7 @@ $(COPY_L): %.justcopytobuilddir: %.css
|
|||
%.justcopytobuilddir:
|
||||
cp -f $< $(BUILD_DIR)
|
||||
|
||||
make_sitemap:
|
||||
$(SITEMAPGEN) $(BUILD_DIR) $(subst $(SRC_DIRS),$(BUILD_DIR),$(MARKDOWN_L))
|
||||
|
||||
# end of GNUmakefile
|
||||
|
|
|
@ -42,6 +42,10 @@ for the `yiki.css` and the `index.html` files.
|
|||
|
||||
Example: `gmake VPREFIX:="/yiki/"`
|
||||
|
||||
`DOMAIN` Specifiy the domain name that your sitemap.xml links to.
|
||||
|
||||
Example `gmake DOMAIN:="example.com"`
|
||||
|
||||
## Contributing
|
||||
|
||||
I request (but not require) that you modify files without Carriage Returns,
|
||||
|
|
|
@ -69,6 +69,9 @@ function format(data, name) {
|
|||
.replace( /* multitag suffix fix for special characters. */
|
||||
/(<\/(?:a|code)>)\n\t*([.)\];:,])/g,
|
||||
"$1$2"
|
||||
).replace( /* fix tag attached to word and not whitespace */
|
||||
/(\w+)(<[a-zA-Z]\w*>)/g,
|
||||
"$1 $2"
|
||||
);
|
||||
}
|
||||
// probably should bring in a better templating engine but whatever
|
||||
|
@ -78,7 +81,8 @@ function format(data, name) {
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=2.0">
|
||||
<meta name="description" content="${name} on ${wikiName}">
|
||||
<title>${name} - Documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="${rootPrefix}yiki.css">
|
||||
</head>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "yiki",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "yiki",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@liquify/prettify": "^0.5.5-beta.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "yiki",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.7",
|
||||
"description": "The yellows111 wiki system",
|
||||
"main": "compile.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright (c) 2024 yellows111
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// natives
|
||||
const Process = require("process");
|
||||
const Filesystem = require("fs");
|
||||
|
||||
// required vars
|
||||
const fileList = Process.argv.slice(3);
|
||||
const currentDir = Process.argv[2];
|
||||
var rootPrefix = "/";
|
||||
if(process.env["VPREFIX"]) {
|
||||
rootPrefix = process.env["VPREFIX"];
|
||||
}
|
||||
rootPrefix = rootPrefix.substring(0, rootPrefix.length - 1);
|
||||
var targetDomain = "localhost";
|
||||
if(process.env["DOMAIN"]) {
|
||||
targetDomain = process.env["DOMAIN"];
|
||||
}
|
||||
var outputTemp = "";
|
||||
|
||||
function renderSiteMap() {
|
||||
return ( /* eslint-disable indent */
|
||||
`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
${outputTemp}
|
||||
</urlset>
|
||||
`
|
||||
); /* eslint-enable indent */
|
||||
}
|
||||
|
||||
for (let file of fileList) {
|
||||
outputTemp = outputTemp.concat( /* eslint-disable indent */
|
||||
` <url>
|
||||
<loc>https://${targetDomain}${rootPrefix}${file.replace(currentDir, "")}</loc>
|
||||
<lastmod>${Filesystem.statSync(file).mtime.toISOString().substring(0, 10)}</lastmod>
|
||||
</url>`
|
||||
); /* eslint-enable indent */
|
||||
}
|
||||
|
||||
Filesystem.writeFileSync(`${Process.argv[2]}/sitemap.xml`, renderSiteMap());
|
Loading…
Reference in New Issue