@kobalab/liulian 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.md +13 -0
- package/README.md +1 -0
- package/css/liulian.css +75 -3
- package/lib/module/core.js +50 -2
- package/lib/module/paiga.js +1 -1
- package/lib/resource/folder.js +2 -1
- package/lib/resource/index.js +1 -1
- package/package.json +1 -1
package/ChangeLog.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## v1.1.0 / 2022-04-15
|
|
2
|
+
|
|
3
|
+
- #7 nav モジュール(ナビゲーション用のリンクを生成する)を追加
|
|
4
|
+
|
|
5
|
+
### v1.0.2 / 2022-04-11
|
|
6
|
+
|
|
7
|
+
- iPhone で form がリサイズしないよう修正
|
|
8
|
+
- Windows用の等幅フォントを変更
|
|
9
|
+
|
|
10
|
+
### v1.0.1 / 2022-04-10
|
|
11
|
+
|
|
12
|
+
- paiga モジュールのMサイズの指定の誤りを修正
|
|
13
|
+
|
|
1
14
|
# v1.0.0 / 2022-04-09
|
|
2
15
|
|
|
3
16
|
- 正式バージョンリリース
|
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ $ liulian ~/Documents/LiuLian
|
|
|
33
33
|
- [コンテンツ作成](https://kobalab.net/liulian/man/contents)
|
|
34
34
|
- [LiuLian記法](https://kobalab.net/liulian/man/text-liulian)
|
|
35
35
|
- [モジュール](https://kobalab.net/liulian/man/module)
|
|
36
|
+
- [外部モジュール](https://kobalab.net/liulian/man/modules/)
|
|
36
37
|
- [README と index](https://kobalab.net/liulian/man/readme&index)
|
|
37
38
|
- [HEAD と TAIL](https://kobalab.net/liulian/man/head&tail)
|
|
38
39
|
- [リバースプロキシを使う](https://kobalab.net/liulian/man/proxy-setting)
|
package/css/liulian.css
CHANGED
|
@@ -95,7 +95,7 @@ pre {
|
|
|
95
95
|
background: #eee;
|
|
96
96
|
overflow: auto;
|
|
97
97
|
overflow-wrap: normal;
|
|
98
|
-
font-family: Osaka-Mono, "
|
|
98
|
+
font-family: Osaka-Mono, "BIZ UDゴシック", "MS ゴシック", Courier, monospace;
|
|
99
99
|
font-size: 100%;
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -133,6 +133,16 @@ div.l-footnote a[id] {
|
|
|
133
133
|
form {
|
|
134
134
|
margin: 1em auto;
|
|
135
135
|
}
|
|
136
|
+
@media screen and (max-width: 640px) {
|
|
137
|
+
form {
|
|
138
|
+
font-size: 16px;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
@media screen and (max-height: 640px) {
|
|
142
|
+
form {
|
|
143
|
+
font-size: 16px;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
136
146
|
fieldset {
|
|
137
147
|
border: solid 1px #080;
|
|
138
148
|
border-radius: 4px;
|
|
@@ -151,7 +161,7 @@ input[disabled] {
|
|
|
151
161
|
}
|
|
152
162
|
textarea {
|
|
153
163
|
padding: 4px;
|
|
154
|
-
font-family: Osaka-Mono, "
|
|
164
|
+
font-family: Osaka-Mono, "BIZ UDゴシック", "MS ゴシック", Courier, monospace;
|
|
155
165
|
font-size: 100%;
|
|
156
166
|
border: solid 1px #999;
|
|
157
167
|
border-radius: 4px;
|
|
@@ -285,7 +295,7 @@ input[type="submit"] {
|
|
|
285
295
|
#l-mkfile input[name="filename"],
|
|
286
296
|
#l-udfile input[name="filename"],
|
|
287
297
|
#l-mkdir input[name="dirname"] {
|
|
288
|
-
width:
|
|
298
|
+
width: 200px;
|
|
289
299
|
}
|
|
290
300
|
#l-udfile input[disable] {
|
|
291
301
|
pointer-events: none;
|
|
@@ -333,6 +343,68 @@ input[type="submit"] {
|
|
|
333
343
|
color: red;
|
|
334
344
|
}
|
|
335
345
|
|
|
346
|
+
.l-nav {
|
|
347
|
+
margin: 1.5em auto 0.5em;
|
|
348
|
+
}
|
|
349
|
+
.l-nav a {
|
|
350
|
+
text-decoration: none;
|
|
351
|
+
}
|
|
352
|
+
.l-nav::after {
|
|
353
|
+
display: block;
|
|
354
|
+
content: '';
|
|
355
|
+
clear: both;
|
|
356
|
+
}
|
|
357
|
+
.l-nav-prev {
|
|
358
|
+
text-align: left;
|
|
359
|
+
float: left;
|
|
360
|
+
width: 35%;
|
|
361
|
+
}
|
|
362
|
+
.l-nav-prev::before {
|
|
363
|
+
content: '≪ ';
|
|
364
|
+
}
|
|
365
|
+
.l-nav-next {
|
|
366
|
+
text-align: right;
|
|
367
|
+
float: right;
|
|
368
|
+
width: 35%;
|
|
369
|
+
}
|
|
370
|
+
.l-nav-next::after {
|
|
371
|
+
content: ' ≫';
|
|
372
|
+
}
|
|
373
|
+
.l-nav-top {
|
|
374
|
+
text-align: center;
|
|
375
|
+
margin: 0 35%;
|
|
376
|
+
}
|
|
377
|
+
@media screen and (max-width: 480px) {
|
|
378
|
+
.l-nav-prev {
|
|
379
|
+
text-align: left;
|
|
380
|
+
float: none;
|
|
381
|
+
width: auto;
|
|
382
|
+
overflow: hidden;
|
|
383
|
+
white-space: nowrap;
|
|
384
|
+
text-overflow: ellipsis;
|
|
385
|
+
}
|
|
386
|
+
.l-nav-next {
|
|
387
|
+
text-align: left;
|
|
388
|
+
float: none;
|
|
389
|
+
width: auto;
|
|
390
|
+
overflow: hidden;
|
|
391
|
+
white-space: nowrap;
|
|
392
|
+
text-overflow: ellipsis;
|
|
393
|
+
}
|
|
394
|
+
.l-nav-top {
|
|
395
|
+
margin: auto;
|
|
396
|
+
overflow: hidden;
|
|
397
|
+
white-space: nowrap;
|
|
398
|
+
text-overflow: ellipsis;
|
|
399
|
+
}
|
|
400
|
+
.l-nav-next::before {
|
|
401
|
+
content: '≫ ';
|
|
402
|
+
}
|
|
403
|
+
.l-nav-next::after {
|
|
404
|
+
content: none;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
336
408
|
.footnotes {
|
|
337
409
|
font-size: 90%;
|
|
338
410
|
}
|
package/lib/module/core.js
CHANGED
|
@@ -12,8 +12,9 @@ module.exports = class Core {
|
|
|
12
12
|
this._r = parser._r;
|
|
13
13
|
this._req = parser._r._req;
|
|
14
14
|
this._inline = ['img','color','size','br','clear','class','lang'];
|
|
15
|
-
this._block = ['title','contents','footnote','include','img',
|
|
16
|
-
'class','style','icon','lang','redirect',
|
|
15
|
+
this._block = ['title','contents','nav','footnote','include','img',
|
|
16
|
+
'clear','class','style','icon','lang','redirect',
|
|
17
|
+
'script'];
|
|
17
18
|
this._np = ['style','script'];
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -37,6 +38,53 @@ module.exports = class Core {
|
|
|
37
38
|
+ value;
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
async nav(type, param) {
|
|
42
|
+
const location = async(href)=>{
|
|
43
|
+
try {
|
|
44
|
+
let r = await this._r.openFile(this._req, href);
|
|
45
|
+
r = await r.open();
|
|
46
|
+
return r.location;
|
|
47
|
+
}
|
|
48
|
+
catch(code) { return '' }
|
|
49
|
+
};
|
|
50
|
+
const err = `<div style="color:red">#nav(${cdata(param)})</div>\n\n`;
|
|
51
|
+
let [ url, title, top ] = param.split(/,\s*/);
|
|
52
|
+
try {
|
|
53
|
+
let r = await this._r.openFile(this._req, url);
|
|
54
|
+
r = await r.open();
|
|
55
|
+
if (r.type != 'text/x-liulian') return err;
|
|
56
|
+
let toc = r.text.match(/\[\[.*?\]\]/g) || [];
|
|
57
|
+
let index = -1;
|
|
58
|
+
for (let i = 0; i < toc.length; i++) {
|
|
59
|
+
let loc = await location(
|
|
60
|
+
toc[i].replace(/^\[\[(.*)\]\]$/, '$1')
|
|
61
|
+
.match(/[^|]*$/)[0]);
|
|
62
|
+
if (loc == this._r.location) index = i;
|
|
63
|
+
}
|
|
64
|
+
if (index < 0) return '';
|
|
65
|
+
let html = '<div class="l-nav">\n'
|
|
66
|
+
if (index > 0) {
|
|
67
|
+
html += '<div class="l-nav-prev">'
|
|
68
|
+
+ this._parser.inline(toc[index - 1])
|
|
69
|
+
+ '</div>\n';
|
|
70
|
+
}
|
|
71
|
+
if (index < toc.length - 1) {
|
|
72
|
+
html += '<div class="l-nav-next">'
|
|
73
|
+
+ this._parser.inline(toc[index + 1])
|
|
74
|
+
+ '</div>\n';
|
|
75
|
+
}
|
|
76
|
+
if (title) {
|
|
77
|
+
html += '<div class="l-nav-top">'
|
|
78
|
+
+ this._parser.inline(`[[${title}|${top||url}]]`)
|
|
79
|
+
+ '</div>\n';
|
|
80
|
+
}
|
|
81
|
+
return html + '</div>\n\n';
|
|
82
|
+
}
|
|
83
|
+
catch(code) {
|
|
84
|
+
return err;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
40
88
|
footnote(type, param) {
|
|
41
89
|
const html = this._parser.footnote();
|
|
42
90
|
this._parser.nextNote();
|
package/lib/module/paiga.js
CHANGED
|
@@ -114,7 +114,7 @@ module.exports = class Paiga {
|
|
|
114
114
|
let w = 24, h = 34;
|
|
115
115
|
if (! param) { w = 24; h = 34 }
|
|
116
116
|
else if (param == 'L') { w = 24; h = 34 }
|
|
117
|
-
else if (param == 'M') { w = 19; h =
|
|
117
|
+
else if (param == 'M') { w = 19; h = 26 }
|
|
118
118
|
else if (param == 'S') { w = 16; h = 23 }
|
|
119
119
|
else if (param.match(/^\d+x\d+$/)) {
|
|
120
120
|
[ w, h ] = param.split(/x/);
|
package/lib/resource/folder.js
CHANGED
|
@@ -34,7 +34,8 @@ module.exports = class Folder extends File {
|
|
|
34
34
|
this._files = [];
|
|
35
35
|
for (let file of await fs.readdir(this._path)) {
|
|
36
36
|
try {
|
|
37
|
-
let r = await this.openFile(this._req,
|
|
37
|
+
let r = await this.openFile(this._req,
|
|
38
|
+
this._location + file);
|
|
38
39
|
this._files.push(r);
|
|
39
40
|
}
|
|
40
41
|
catch(err) {}
|
package/lib/resource/index.js
CHANGED
|
@@ -18,7 +18,7 @@ async function resource(req, file) {
|
|
|
18
18
|
if (file) {
|
|
19
19
|
if (file.match(/^\/\//)) throw 404;
|
|
20
20
|
if (file.match(/^\//))
|
|
21
|
-
location = file;
|
|
21
|
+
location = decodeURIComponent(file);
|
|
22
22
|
else location = decodeURIComponent(urljoin(req.pathDir, file));
|
|
23
23
|
}
|
|
24
24
|
else location = decodeURIComponent(req.path);
|