0.0.5 "commit submitted by yellows111"
* Modified reformatter to also handle code tags. + Anchor prefixes for ( and [ are now handled correctly. + Multiple tags suffixes for ], ), commas, periods and (semi-)colons. + Added a "page rendered by yiki (VERSION) on (DATE)" to the bottom of the default template * Fixed titles since I forgot about it in the .htm to .html conversion * Underscores are now converted to spaces in the page title AC: "not much to say here other than this being the second release of the day"
This commit is contained in:
parent
bd537bbb4d
commit
cf7d304474
23
compile.js
23
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");
|
||||||
|
@ -55,9 +58,17 @@ function format(data, name) {
|
||||||
return HTMLFormatter(data, formatterRules)
|
return HTMLFormatter(data, formatterRules)
|
||||||
.split("\n") /* split by every newline */
|
.split("\n") /* split by every newline */
|
||||||
.join("\n\t\t\t") /* then add padding and convert back into string */
|
.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) */
|
.replace( /* multitag text node fix (should really just encase all text with <span>, but whatever) */
|
||||||
/(\t*)(<a href=".*">)\n\t*(.*)\n\t*(<\/a>)/g,
|
/(\t*)(<(?:code|a href=".*")>)\n\t*(.*)\n\t*(<\/(?:code|a)>)/g,
|
||||||
"$1 $2$3$4 "
|
"$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
|
||||||
|
@ -81,10 +92,14 @@ function format(data, name) {
|
||||||
<main>
|
<main>
|
||||||
${render()}
|
${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.4",
|
"version": "0.0.5",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "yiki",
|
"name": "yiki",
|
||||||
"version": "0.0.4",
|
"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.4",
|
"version": "0.0.5",
|
||||||
"description": "The yellows111 wiki system",
|
"description": "The yellows111 wiki system",
|
||||||
"main": "compile.js",
|
"main": "compile.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue