Compare commits
2 Commits
f931edbfa5
...
cf7d304474
Author | SHA1 | Date |
---|---|---|
yellows111 | cf7d304474 | |
yellows111 | bd537bbb4d |
|
@ -29,4 +29,4 @@ node_modules/
|
||||||
|
|
||||||
# so i don't accidentally commit something
|
# so i don't accidentally commit something
|
||||||
|
|
||||||
*.htm
|
*.htm
|
||||||
|
|
|
@ -36,4 +36,6 @@ $(COPY_L): %.justcopytobuilddir: %.css
|
||||||
mv -f $@ $(subst $(SRC_DIRS),$(BUILD_DIR),./$(dir $@))
|
mv -f $@ $(subst $(SRC_DIRS),$(BUILD_DIR),./$(dir $@))
|
||||||
|
|
||||||
%.justcopytobuilddir:
|
%.justcopytobuilddir:
|
||||||
cp -f $< $(BUILD_DIR)
|
cp -f $< $(BUILD_DIR)
|
||||||
|
|
||||||
|
# end of GNUmakefile
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
28
compile.js
28
compile.js
|
@ -18,6 +18,9 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
// local
|
||||||
|
const Package = require("./package.json");
|
||||||
|
|
||||||
// npm
|
// npm
|
||||||
const Remarkable = require("remarkable").Remarkable; // remove .Remarkable if you're using Remarkable ^1.0.0!
|
const Remarkable = require("remarkable").Remarkable; // remove .Remarkable if you're using Remarkable ^1.0.0!
|
||||||
const TOCGenerator = require("markdown-toc");
|
const TOCGenerator = require("markdown-toc");
|
||||||
|
@ -51,6 +54,23 @@ function format(data, name) {
|
||||||
}
|
}
|
||||||
// forceIndent screws with text nodes pretty bad but the alternative is to not allow the full document to be formatted
|
// forceIndent screws with text nodes pretty bad but the alternative is to not allow the full document to be formatted
|
||||||
const formatterRules = {"indentChar": "\t", "indentSize": 1, "markup": {"forceAttribute": false, "forceIndent": true}};
|
const formatterRules = {"indentChar": "\t", "indentSize": 1, "markup": {"forceAttribute": false, "forceIndent": true}};
|
||||||
|
function render() {
|
||||||
|
return HTMLFormatter(data, formatterRules)
|
||||||
|
.split("\n") /* split by every newline */
|
||||||
|
.join("\n\t\t\t") /* then add padding and convert back into string */
|
||||||
|
.replace( /* multitag text node fix (should really just encase all text with <span>, but whatever) */
|
||||||
|
/(\t*)(<(?:code|a href=".*")>)\n\t*(.*)\n\t*(<\/(?:code|a)>)/g,
|
||||||
|
"$1$2$3$4"
|
||||||
|
)
|
||||||
|
.replace( /* link prefix spacing fix for ( and [ */
|
||||||
|
/([(\[])\n\t*(<a href=".*">.*<\/a>)/g,
|
||||||
|
"$1$2"
|
||||||
|
)
|
||||||
|
.replace( /* multitag suffix fix for special characters. */
|
||||||
|
/(<\/(?:a|code)>)\n\t*([.)\];:,])/g,
|
||||||
|
"$1$2"
|
||||||
|
);
|
||||||
|
}
|
||||||
// probably should bring in a better templating engine but whatever
|
// probably should bring in a better templating engine but whatever
|
||||||
return ( /* eslint-disable indent */
|
return ( /* eslint-disable indent */
|
||||||
`<!doctype html>
|
`<!doctype html>
|
||||||
|
@ -70,12 +90,16 @@ function format(data, name) {
|
||||||
</nav>
|
</nav>
|
||||||
<hr>
|
<hr>
|
||||||
<main>
|
<main>
|
||||||
${HTMLFormatter(data, formatterRules).split("\n").join("\n\t\t\t")}
|
${render()}
|
||||||
</main>
|
</main>
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<span>page rendered by ${Package.name} ${Package.version} on ${new Date().toGMTString()}</span>
|
||||||
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>`
|
</html>`
|
||||||
); /* eslint-enable indent */
|
); /* eslint-enable indent */
|
||||||
}
|
}
|
||||||
|
|
||||||
let content = render(Filesystem.readFileSync(Process.argv[2]).toString());
|
let content = render(Filesystem.readFileSync(Process.argv[2]).toString());
|
||||||
Filesystem.writeFileSync(Process.argv[3], format(content, Path.basename(Process.argv[3], ".htm")));
|
Filesystem.writeFileSync(Process.argv[3], format(content, Path.basename(Process.argv[3], ".html").replace(/_/g, " ")));
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "yiki",
|
"name": "yiki",
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "yiki",
|
"name": "yiki",
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@liquify/prettify": "^0.5.5-beta.1",
|
"@liquify/prettify": "^0.5.5-beta.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "yiki",
|
"name": "yiki",
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"description": "The yellows111 wiki system",
|
"description": "The yellows111 wiki system",
|
||||||
"main": "compile.js",
|
"main": "compile.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
9
yiki.css
9
yiki.css
|
@ -25,7 +25,7 @@ nav {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-anchor {
|
a.header-anchor {
|
||||||
color: gray;
|
color: gray;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,10 @@ a.header-anchor:hover {
|
||||||
a:active {
|
a:active {
|
||||||
text-decoration: underline teal;
|
text-decoration: underline teal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.header-anchor:hover {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media only print {
|
@media only print {
|
||||||
body {
|
body {
|
||||||
|
@ -66,4 +70,7 @@ a.header-anchor:hover {
|
||||||
color: black;
|
color: black;
|
||||||
text-decoration: underline black;
|
text-decoration: underline black;
|
||||||
}
|
}
|
||||||
|
a.header-anchor {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue