Skip to content

Commit 16bed2c

Browse files
committed
remove node_modules-folder
1 parent b705515 commit 16bed2c

File tree

321 files changed

+169
-90778
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+169
-90778
lines changed

.gitignore

Whitespace-only changes.

_layouts/form.hbs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!DOCTYPE HTML>
2+
<html lang="{{ config.language }}" {% if page.dir == "rtl" %}dir="rtl"{% endif %}>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>{% block title %}{{ config.title|d("HonKit", true) }}{% endblock %}</title>
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
7+
<meta name="description" content="{% block description %}{% endblock %}">
8+
<script src="./pretty-print-json"></script>
9+
<meta name="generator" content="HonKit {{ gitbook.version }}">
10+
{% if config.author %}<meta name="author" content="{{ config.author }}">{% endif %}
11+
{% if config.isbn %}<meta name="identifier" content="{{ config.isbn }}" scheme="ISBN">{% endif %}
12+
{% block style %}
13+
{% for resource in plugins.resources.css %}
14+
{% if resource.url %}
15+
<link rel="stylesheet" href="{{ resource.url }}">
16+
{% else %}
17+
<link rel="stylesheet" href="{{ resource.path|resolveAsset }}">
18+
{% endif %}
19+
{% endfor %}
20+
{% endblock %}
21+
{% block head %}{% endblock %}
22+
</head>
23+
<body>
24+
<!-- form.html -->
25+
<form id="json-form">
26+
<label for="json-input">JSON Input:</label><br>
27+
<textarea id="json-input" name="json-input" rows="10" cols="30" required></textarea><br><br>
28+
<input type="submit" value="Submit">
29+
</form>
30+
<pre id="json-output"></pre>
31+
32+
<script>
33+
const runExamples = () => {
34+
// Cat in a Box
35+
const catInABox = ['🐈'];
36+
console.log(divider);
37+
console.log(catInABox);
38+
console.log('HTML:');
39+
console.log(prettyPrintJson.toHtml(catInABox));
40+
41+
// Striped
42+
const striped = { striped: ['🦓', '🐅', '🦨'] };
43+
const stripedOptions = { indent: 8, lineNumbers: true };
44+
console.log(divider);
45+
console.log(striped, '👉', stripedOptions);
46+
console.log('HTML:');
47+
console.log(prettyPrintJson.toHtml(striped, stripedOptions));
48+
49+
// Railway Car
50+
const railwayCar = {
51+
active: true,
52+
mode: '🚃',
53+
codes: [48348, 28923, 39080],
54+
city: 'London',
55+
web: 'https://london.gov.uk',
56+
};
57+
const railwayCarOptions = { };
58+
console.log(divider);
59+
console.log(railwayCar);
60+
console.log('HTML:');
61+
console.log(prettyPrintJson.toHtml(railwayCar, railwayCarOptions));
62+
};
63+
64+
console.log('Examples');
65+
console.log('========');
66+
console.log('pretty-print-json v' + prettyPrintJson.version);
67+
const divider = '\n----------------';
68+
runExamples();
69+
</script>
70+
</body>
71+
</html>
72+
73+
74+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2+
(function (global){(function (){
3+
global.prettyPrintJson = require('pretty-print-json');
4+
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5+
},{"pretty-print-json":2}],2:[function(require,module,exports){
6+
//! pretty-print-json v2.0.4 ~~ https://pretty-print-json.js.org ~~ MIT License
7+
8+
(function (factory) {
9+
if (typeof module === "object" && typeof module.exports === "object") {
10+
var v = factory(require, exports);
11+
if (v !== undefined) module.exports = v;
12+
}
13+
else if (typeof define === "function" && define.amd) {
14+
define(["require", "exports"], factory);
15+
}
16+
})(function (require, exports) {
17+
"use strict";
18+
Object.defineProperty(exports, "__esModule", { value: true });
19+
exports.prettyPrintJson = void 0;
20+
const prettyPrintJson = {
21+
version: '2.0.4',
22+
toHtml(data, options) {
23+
if (!''.at)
24+
String.prototype.at = function (i) { return this.charAt(i + (i < 0 ? this.length : 0)); };
25+
const defaults = {
26+
indent: 3,
27+
lineNumbers: false,
28+
linkUrls: true,
29+
linksNewTab: true,
30+
quoteKeys: false,
31+
trailingComma: true,
32+
};
33+
const settings = { ...defaults, ...options };
34+
const invalidHtml = /[<>&]|\\"/g;
35+
const toHtml = (char) => char === '<' ? '&lt;' :
36+
char === '>' ? '&gt;' :
37+
char === '&' ? '&amp;' :
38+
'&bsol;&quot;';
39+
const spanTag = (type, display) => display ? '<span class=json-' + type + '>' + display + '</span>' : '';
40+
const buildValueHtml = (value) => {
41+
const strType = /^"/.test(value) && 'string';
42+
const boolType = ['true', 'false'].includes(value) && 'boolean';
43+
const nullType = value === 'null' && 'null';
44+
const type = boolType || nullType || strType || 'number';
45+
const urlPattern = /https?:\/\/[^\s"]+/g;
46+
const target = settings.linksNewTab ? ' target=_blank' : '';
47+
const makeLink = (link) => `<a class=json-link href="${link}"${target}>${link}</a>`;
48+
const display = strType && settings.linkUrls ? value.replace(urlPattern, makeLink) : value;
49+
return spanTag(type, display);
50+
};
51+
const replacer = (match, ...parts) => {
52+
const part = { indent: parts[0], key: parts[1], value: parts[2], end: parts[3] };
53+
const findName = settings.quoteKeys ? /(.*)(): / : /"([\w$]+)": |(.*): /;
54+
const indentHtml = part.indent || '';
55+
const keyName = part.key && part.key.replace(findName, '$1$2');
56+
const keyHtml = part.key ? spanTag('key', keyName) + spanTag('mark', ': ') : '';
57+
const valueHtml = part.value ? buildValueHtml(part.value) : '';
58+
const noComma = !part.end || [']', '}'].includes(match.at(-1));
59+
const addComma = settings.trailingComma && match.at(0) === ' ' && noComma;
60+
const endHtml = spanTag('mark', addComma ? (part.end ?? '') + ',' : part.end);
61+
return indentHtml + keyHtml + valueHtml + endHtml;
62+
};
63+
const jsonLine = /^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([{}[\],]*)?$/mg;
64+
const json = JSON.stringify(data, null, settings.indent) || 'undefined';
65+
const html = json.replace(invalidHtml, toHtml).replace(jsonLine, replacer);
66+
const makeLine = (line) => ` <li>${line}</li>`;
67+
const addLineNumbers = (html) => ['<ol class=json-lines>', ...html.split('\n').map(makeLine), '</ol>'].join('\n');
68+
return settings.lineNumbers ? addLineNumbers(html) : html;
69+
},
70+
};
71+
exports.prettyPrintJson = prettyPrintJson;
72+
});
73+
74+
},{}]},{},[1]);

bundle.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
global.prettyPrintJson = require('pretty-print-json');

form.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import { prettyPrintJson } from 'pretty-print-json';

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const fs = require('fs');
22
const Handlebars = require('handlebars');
33
const path = require('path');
4+
const pretty = require('pretty-print-json')
45

56
// Read and compile the template
6-
const templateSource = fs.readFileSync(path.join(__dirname, '_layouts', 'dynamic_template.hbs'), 'utf8');
7+
const templateSource = fs.readFileSync(path.join(__dirname, '_layouts', 'dynamic_template.hbs', 'form.html'), 'utf8');
78
console.log("Template Source:", templateSource);
89

910
Handlebars.registerHelper('renderProperties', function(properties, options) {
@@ -48,7 +49,7 @@ const template = Handlebars.compile(templateSource);
4849
module.exports = {
4950
book: {
5051
assets: './assets',
51-
js: [],
52+
js: ['js/pretty-print-json-bundle.js'],
5253
css: ['style.css']
5354
},
5455
hooks: {

node_modules/.bin/handlebars

Lines changed: 0 additions & 1 deletion
This file was deleted.

node_modules/.bin/uglifyjs

Lines changed: 0 additions & 1 deletion
This file was deleted.

node_modules/.package-lock.json

Lines changed: 0 additions & 66 deletions
This file was deleted.

node_modules/handlebars/LICENSE

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)