Compare commits

..

No commits in common. "cf7d304474fccae6c89f9486e5f0d7e2eeb92eb4" and "f931edbfa5b89b839fdac5532110d48be273fb5a" have entirely different histories.

7 changed files with 9 additions and 42 deletions

View File

@ -37,5 +37,3 @@ $(COPY_L): %.justcopytobuilddir: %.css
%.justcopytobuilddir:
cp -f $< $(BUILD_DIR)
# end of GNUmakefile

View File

@ -18,9 +18,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// local
const Package = require("./package.json");
// npm
const Remarkable = require("remarkable").Remarkable; // remove .Remarkable if you're using Remarkable ^1.0.0!
const TOCGenerator = require("markdown-toc");
@ -54,23 +51,6 @@ function format(data, name) {
}
// 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}};
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
return ( /* eslint-disable indent */
`<!doctype html>
@ -90,16 +70,12 @@ function format(data, name) {
</nav>
<hr>
<main>
${render()}
${HTMLFormatter(data, formatterRules).split("\n").join("\n\t\t\t")}
</main>
<hr>
<footer>
<span>page rendered by ${Package.name} ${Package.version} on ${new Date().toGMTString()}</span>
</footer>
</body>
</html>`
); /* eslint-enable indent */
}
let content = render(Filesystem.readFileSync(Process.argv[2]).toString());
Filesystem.writeFileSync(Process.argv[3], format(content, Path.basename(Process.argv[3], ".html").replace(/_/g, " ")));
Filesystem.writeFileSync(Process.argv[3], format(content, Path.basename(Process.argv[3], ".htm")));

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "yiki",
"version": "0.0.5",
"version": "0.0.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "yiki",
"version": "0.0.5",
"version": "0.0.3",
"license": "MIT",
"dependencies": {
"@liquify/prettify": "^0.5.5-beta.1",

View File

@ -1,6 +1,6 @@
{
"name": "yiki",
"version": "0.0.5",
"version": "0.0.3",
"description": "The yellows111 wiki system",
"main": "compile.js",
"scripts": {

View File

@ -25,7 +25,7 @@ nav {
font-family: monospace;
}
a.header-anchor {
.header-anchor {
color: gray;
text-decoration: none;
}
@ -53,10 +53,6 @@ a.header-anchor:hover {
a:active {
text-decoration: underline teal;
}
a.header-anchor:hover {
color: black;
}
}
@media only print {
body {
@ -70,7 +66,4 @@ a.header-anchor:hover {
color: black;
text-decoration: underline black;
}
a.header-anchor {
display: none;
}
}