0.0.4 - "styling it up"

* Fixed the light color scheme, since the header jumps were pretty bad.
* Implement a link text reformatter to fix spacing issues with URLs.
* Added terminating newlines to all commited files.
* Spun the HTML formatter into a subfunction.

AC: "Nothing really added this time, but whatever."
This commit is contained in:
yellows111 2024-04-18 11:02:01 +01:00
parent f931edbfa5
commit bd537bbb4d
7 changed files with 26 additions and 8 deletions

View File

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

View File

@ -51,6 +51,15 @@ 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( /* link text node fix (should really just encase all text with <span>, but whatever) */
/(\t*)(<a href=".*">)\n\t*(.*)\n\t*(<\/a>)/g,
"$1 $2$3$4 "
);
}
// 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,7 +79,7 @@ function format(data, name) {
</nav> </nav>
<hr> <hr>
<main> <main>
${HTMLFormatter(data, formatterRules).split("\n").join("\n\t\t\t")} ${render()}
</main> </main>
</body> </body>
</html>` </html>`

4
package-lock.json generated
View File

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

View File

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

View File

@ -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;
}
} }