zine_brewer 1.3.2 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/exe/zine_brewing_server +20 -0
- data/lib/zine_brewer/kramdown/converter/sehtml.rb +6 -1
- data/lib/zine_brewer/kramdown/parser/sekd.rb +2 -0
- data/lib/zine_brewer/main.rb +1 -2
- data/lib/zine_brewer/templates/bookranking.rb +3 -2
- data/lib/zine_brewer/templates/casts.rb +14 -42
- data/lib/zine_brewer/templates/fig/module_fig_base.rb +5 -8
- data/lib/zine_brewer/templates/fig_a.rb +3 -4
- data/lib/zine_brewer/templates/fig_h.rb +3 -4
- data/lib/zine_brewer/templates/fig_n.rb +3 -4
- data/lib/zine_brewer/templates/fig_p.rb +1 -1
- data/lib/zine_brewer/templates/fig_z.rb +3 -4
- data/lib/zine_brewer/version.rb +1 -1
- metadata +9 -8
- data/lib/zine_brewer/templates/fig/module_fig_plus.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee3ba68f6148bff1354914fd0f2b98c5e60b70341aae73cc113d4aed2b1aa5a4
|
4
|
+
data.tar.gz: 7d25319819a05e422cdb9504e173bdfa455b938c3015a3ea6c84c58b73bcf6c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26a77c54ce06edc09849fbca363d08eff80b428e811d9ec3e95b0866dd192453be50e9aca6a16d7a0a8ca27dcf48b8917482a2d50ad723d71404fab472848b27
|
7
|
+
data.tar.gz: 2c7f9293f59f9caa63243f042b9803d5518c1886de8ef043cf3f22b427712b812619ce31e44018d179b00441be1b2bf8c910ce83719cb59b761f6a03ea951845
|
data/README.md
CHANGED
@@ -20,8 +20,18 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
+
As the converting command:
|
24
|
+
|
23
25
|
$ zine_brewer [kramdown_document_filepath]
|
24
26
|
|
27
|
+
As the converting server:
|
28
|
+
|
29
|
+
$ zine_brewing_server
|
30
|
+
|
31
|
+
When you run the command above,
|
32
|
+
or send kramdown_document_filepath to the zine_brewing_server,
|
33
|
+
the convertion is done as below.
|
34
|
+
|
25
35
|
* The header part is converted and written out as "proof/header.txt".
|
26
36
|
* The body part is converted and written out as "proof/body.txt".
|
27
37
|
|
@@ -327,7 +337,7 @@ width: 200px
|
|
327
337
|
|
328
338
|
#### ■脚注の書き方
|
329
339
|
|
330
|
-
次のように、本文テキスト中の脚注を付けたい言葉などに`[^1]`などとアンカーを付け、脚注を置きたい場所に`[^1]:
|
340
|
+
次のように、本文テキスト中の脚注を付けたい言葉などに`[^1]`などとアンカーを付け、脚注を置きたい場所に`[^1]: 〜`という形で脚注本体を書きます。脚注本体のコロンを忘れなく。脚注番号には半角英数字が使えます([^1]、[^imi01]など)。変換後は出現順に[1]、[2]という通し番号による表記に変わります。
|
331
341
|
|
332
342
|
```
|
333
343
|
ほら、ここに難しい専門用語[^1]が1つ。ここにも意味の分からない専門用語[^2]がもう1つ。
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "socket"
|
4
|
+
require "zine_brewer"
|
5
|
+
|
6
|
+
server = TCPServer.open('localhost', 53623)
|
7
|
+
loop do
|
8
|
+
socket = server.accept
|
9
|
+
begin
|
10
|
+
filepath = socket.gets.chomp
|
11
|
+
zine = ZineBrewer::Application.new(filepath)
|
12
|
+
zine.write_out
|
13
|
+
socket.write 'Conversion from Markdown to HTML is done. The output files (header.txt / body.txt) are in proof directory.'
|
14
|
+
rescue => e
|
15
|
+
socket.write e.message
|
16
|
+
ensure
|
17
|
+
socket.close
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -86,7 +86,12 @@ module Kramdown
|
|
86
86
|
end
|
87
87
|
format_as_indented_block_html('table', el.attr, rows, indent)
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
|
+
def convert_dt(el, indent)
|
91
|
+
result = super
|
92
|
+
result.sub(/<dt>\\/, '<dt>')
|
93
|
+
end
|
94
|
+
|
90
95
|
def convert_div(el, indent)
|
91
96
|
format_as_indented_block_html('div', el.attr, inner(el, indent), indent)
|
92
97
|
end
|
@@ -36,6 +36,8 @@ module Kramdown
|
|
36
36
|
@fn_number = Hash.new{|h, k| h[k] = (@fn_counter += 1).to_s }
|
37
37
|
end
|
38
38
|
|
39
|
+
LIST_START_OL = /^(#{OPT_SPACE}(?:[^\\]|)\d+\.)(#{PATTERN_TAIL})/
|
40
|
+
|
39
41
|
# Parse the fenced codeblock at the current location
|
40
42
|
# code highlighting by Google Prettify.
|
41
43
|
def parse_codeblock_fenced_sekd
|
data/lib/zine_brewer/main.rb
CHANGED
@@ -20,8 +20,7 @@ module ZineBrewer
|
|
20
20
|
Encoding.default_external = Kconv.guess(File.open(path, 'r:BINARY').read)
|
21
21
|
input_data = File.open(path, 'rt').read.encode('UTF-8')
|
22
22
|
rescue
|
23
|
-
|
24
|
-
exit
|
23
|
+
raise 'ERROR: The input file does not exist. Check it.'
|
25
24
|
end
|
26
25
|
|
27
26
|
@dir = File.dirname(path)
|
@@ -13,7 +13,7 @@ class BookRanking < Mustache
|
|
13
13
|
@template = <<EOT
|
14
14
|
<div class="imgLRBlock cf">
|
15
15
|
<figure class="imgR">
|
16
|
-
<a href="{{url}}" target="_blank"><img alt="{{title}}" src="{{cover}}" style="border:1px solid #808080; width
|
16
|
+
<a href="{{url}}" target="_blank"><img alt="{{title}}" loading="lazy" src="{{cover}}" style="border:1px solid #808080;" width="100" title="{{title}}" /></a></figure>
|
17
17
|
<p markdown="1"> {{& description}}</p>
|
18
18
|
</div>
|
19
19
|
EOT
|
@@ -25,7 +25,8 @@ EOT
|
|
25
25
|
def cover
|
26
26
|
case File.dirname(src)
|
27
27
|
when ".", "images"
|
28
|
-
|
28
|
+
f = File.basename(src)
|
29
|
+
"/static/images/article/■記事ID■/#{/^\d+_/ =~ f ? f : '■記事ID■_' + f}"
|
29
30
|
when "common"
|
30
31
|
"/static/images/article/common/#{File.basename(src)}"
|
31
32
|
else
|
@@ -6,10 +6,11 @@ class Casts < Mustache
|
|
6
6
|
|
7
7
|
# <<Casts>>
|
8
8
|
# casts:
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
9
|
+
# title: 見出し
|
10
|
+
# src: 写真ファイル名
|
11
|
+
# name: 姓 名
|
12
|
+
# huri: ふり がな
|
13
|
+
# cap: プロフィール
|
13
14
|
|
14
15
|
# CSSに下記の登録が必要
|
15
16
|
# article#contents div.article div.casts>div ~ div { margin-top:8px; }
|
@@ -17,11 +18,12 @@ class Casts < Mustache
|
|
17
18
|
@template = <<EOT
|
18
19
|
<div class="casts" style="margin-bottom:30px; padding:13px 13px 3px; border:solid 2px #eee;">
|
19
20
|
{{#prof_list}}
|
21
|
+
{{#title_sw}}<h4>{{title}}</h4>{{/title_sw}}
|
20
22
|
<div class="imgLRBlock cf">
|
21
23
|
<figure class="imgL">
|
22
|
-
<img src="{{fig_src}}" alt="{{name}}"
|
24
|
+
<img src="{{fig_src}}" loading="lazy" alt="{{name}}" height="135" width="110" />
|
23
25
|
</figure>
|
24
|
-
<p class="ovh" markdown="span" style="font-size:14px; line-height:1.7; margin-bottom:10px;"><strong>{{name}}({{huri}})氏</strong><br />{{& caption}}</p>
|
26
|
+
<p class="ovh" markdown="span" style="font-size:14px; line-height:1.7; margin-bottom:10px;"><strong style="font-size:15px;">{{name}}({{huri}})氏</strong><br />{{& caption}}</p>
|
25
27
|
</div>
|
26
28
|
{{/prof_list}}
|
27
29
|
</div>
|
@@ -32,6 +34,8 @@ EOT
|
|
32
34
|
(casts rescue a_cast_param).each do |h|
|
33
35
|
a_cast = {}
|
34
36
|
raise "Error: No src:" if h["src"].nil?
|
37
|
+
a_cast[:title] = h["title"]
|
38
|
+
a_cast[:title_sw] = !h["title"].nil?
|
35
39
|
a_cast[:fig_src] = make_src(h["src"])
|
36
40
|
a_cast[:name] = h["name"]
|
37
41
|
a_cast[:huri] = h["huri"]
|
@@ -43,7 +47,8 @@ EOT
|
|
43
47
|
|
44
48
|
private
|
45
49
|
def a_cast_param
|
46
|
-
[{"
|
50
|
+
[{"title" => (title rescue nil),
|
51
|
+
"src" => (src rescue nil),
|
47
52
|
"name" => (name rescue nil),
|
48
53
|
"huri" => (huri rescue nil),
|
49
54
|
"cap" => (cap rescue nil)}]
|
@@ -52,7 +57,8 @@ EOT
|
|
52
57
|
def make_src(l_src)
|
53
58
|
case File.dirname(l_src)
|
54
59
|
when ".", "images"
|
55
|
-
|
60
|
+
f = File.basename(l_src)
|
61
|
+
"/static/images/article/■記事ID■/#{/^\d+_/ =~ f ? f : '■記事ID■_' + f}"
|
56
62
|
when "common"
|
57
63
|
"/static/images/article/common/#{File.basename(l_src)}"
|
58
64
|
else
|
@@ -70,37 +76,3 @@ EOT
|
|
70
76
|
|
71
77
|
end
|
72
78
|
|
73
|
-
__END__
|
74
|
-
|
75
|
-
{:.casts %margin-bottom:45px; %padding:13px 13px 3px; %border:solid 2px #eee;}
|
76
|
-
===div
|
77
|
-
|
78
|
-
{:.imgLRBlock .cf}
|
79
|
-
===div
|
80
|
-
{:.imgL}
|
81
|
-
<<Fig_N>>
|
82
|
-
src: 2096_misonou_p.jpg
|
83
|
-
height: 135px
|
84
|
-
|
85
|
-
{:.ovh markdown="1" %font-size:14px; %line-height:1.7; %margin-bottom:10px;}
|
86
|
-
**御園生 銀平(みそのう ぎんぺい)氏**<br/>
|
87
|
-
ソフトバンク株式会社[[ ]]{:%font-size:3px;}人事本部[[ ]]{:%font-size:3px;}戦略企画統括部[[ ]]{:%font-size:3px;}人材戦略部[[ ]]{:%font-size:3px;}デジタルHR推進課。<br/>
|
88
|
-
(※御園生様のプロフィールを100〜150字程度でお願いいたします)。
|
89
|
-
==/div
|
90
|
-
|
91
|
-
{:.imgLRBlock .cf}
|
92
|
-
===div
|
93
|
-
{:.imgL}
|
94
|
-
<<Fig_N>>
|
95
|
-
src: 2096_shikauchi_p.jpg
|
96
|
-
height: 135px
|
97
|
-
|
98
|
-
{:.ovh markdown="1" %font-size:14px; %line-height:1.7; %margin-bottom:10px;}
|
99
|
-
**鹿内 学(しかうち まなぶ)氏**<br/>
|
100
|
-
博士(理学)。株式会社シンギュレイト 代表。<br/>
|
101
|
-
働く中でのコミュニケーション・データから関係性に注目した次世代ピープルアナリティクスにとりくむ。代表を務めるシンギュレイトでは1 on 1や会議で利用できる可視化ツールを提供中。働く組織の科学と実用をめざす。情報量規準が好き、サッカー好き、漫画好き。
|
102
|
-
==/div
|
103
|
-
|
104
|
-
==/div
|
105
|
-
|
106
|
-
|
@@ -10,8 +10,7 @@ module Fig_00
|
|
10
10
|
a_img[:fig_src] = make_src(h["src"])
|
11
11
|
a_img[:href] = h["href"]
|
12
12
|
a_img[:alt] = make_alt(h["alt"])
|
13
|
-
a_img[:
|
14
|
-
unless h["width"].nil? && h["height"].nil?
|
13
|
+
a_img[:img_size] = make_img_size(h["width"], h["height"])
|
15
14
|
result << a_img
|
16
15
|
end
|
17
16
|
result
|
@@ -54,13 +53,11 @@ module Fig_00
|
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
def
|
56
|
+
def make_img_size(l_width, l_height)
|
58
57
|
s = []
|
59
|
-
s << "
|
60
|
-
s << "
|
61
|
-
|
62
|
-
%Q{style="#{s.join(' ').strip}" }
|
63
|
-
end
|
58
|
+
s << %Q{width="#{l_width}"} unless l_width.nil?
|
59
|
+
s << %Q{height="#{l_height}"} unless l_height.nil?
|
60
|
+
s.join(' ').strip
|
64
61
|
end
|
65
62
|
|
66
63
|
end
|
@@ -3,11 +3,10 @@
|
|
3
3
|
require 'mustache'
|
4
4
|
|
5
5
|
require_relative 'fig/module_fig_base'
|
6
|
-
require_relative 'fig/module_fig_plus'
|
7
6
|
|
8
7
|
class Fig_A < Mustache
|
9
8
|
|
10
|
-
include Fig_00
|
9
|
+
include Fig_00
|
11
10
|
|
12
11
|
# <<Fig_A>>
|
13
12
|
# src: 画像ファイル名
|
@@ -18,9 +17,9 @@ class Fig_A < Mustache
|
|
18
17
|
@template = <<EOT
|
19
18
|
<figure>
|
20
19
|
{{#imgs_list}}
|
21
|
-
<a href="{{fig_src}}" target="_blank"><img src="{{fig_src}}" alt="{{alt}}" {{
|
20
|
+
<a href="{{fig_src}}" target="_blank"><img src="{{fig_src}}" loading="lazy" alt="{{alt}}"{{#width}} width="{{width}}"{{/width}}{{#height}} height="{{height}}"{{/height}} /></a>
|
22
21
|
{{/imgs_list}}
|
23
|
-
<figcaption markdown="span">{{#
|
22
|
+
<figcaption markdown="span">{{#caption}}{{& caption}}<br/>{{/caption}}[画像クリックで拡大表示]</figcaption>
|
24
23
|
</figure>
|
25
24
|
EOT
|
26
25
|
|
@@ -3,11 +3,10 @@
|
|
3
3
|
require 'mustache'
|
4
4
|
|
5
5
|
require_relative 'fig/module_fig_base'
|
6
|
-
require_relative 'fig/module_fig_plus'
|
7
6
|
|
8
7
|
class Fig_H < Mustache
|
9
8
|
|
10
|
-
include Fig_00
|
9
|
+
include Fig_00
|
11
10
|
|
12
11
|
# <<Fig_H>>
|
13
12
|
# src: 画像ファイル名
|
@@ -19,9 +18,9 @@ class Fig_H < Mustache
|
|
19
18
|
@template = <<EOT
|
20
19
|
<figure>
|
21
20
|
{{#imgs_list}}
|
22
|
-
|
21
|
+
<a href="{{href}}" target="_blank"><img src="{{fig_src}}" loading="lazy" alt="{{alt}}"{{#width}} width="{{width}}"{{/width}}{{#height}} height="{{height}}"{{/height}} /></a>
|
23
22
|
{{/imgs_list}}
|
24
|
-
{{#
|
23
|
+
{{#caption}}<figcaption markdown="span">{{& caption}}</figcaption>{{/caption}}
|
25
24
|
</figure>
|
26
25
|
EOT
|
27
26
|
|
@@ -3,11 +3,10 @@
|
|
3
3
|
require 'mustache'
|
4
4
|
|
5
5
|
require_relative 'fig/module_fig_base'
|
6
|
-
require_relative 'fig/module_fig_plus'
|
7
6
|
|
8
7
|
class Fig_N < Mustache
|
9
8
|
|
10
|
-
include Fig_00
|
9
|
+
include Fig_00
|
11
10
|
|
12
11
|
# <<Fig_N>>
|
13
12
|
# src: 画像ファイル名
|
@@ -19,9 +18,9 @@ class Fig_N < Mustache
|
|
19
18
|
@template = <<EOT
|
20
19
|
<figure>
|
21
20
|
{{#imgs_list}}
|
22
|
-
<img src="{{fig_src}}" alt="{{alt}}" {{
|
21
|
+
<img src="{{fig_src}}" loading="lazy" alt="{{alt}}"{{#width}} width="{{width}}"{{/width}}{{#height}} height="{{height}}"{{/height}} />
|
23
22
|
{{/imgs_list}}
|
24
|
-
{{#
|
23
|
+
{{#caption}}<figcaption markdown="span">{{caption}}</figcaption>{{/caption}}
|
25
24
|
</figure>
|
26
25
|
EOT
|
27
26
|
|
@@ -20,7 +20,7 @@ class Fig_P < Mustache
|
|
20
20
|
@template = <<EOT
|
21
21
|
<figure>
|
22
22
|
{{#imgs_list}}
|
23
|
-
<img src="{{fig_src}}" alt="{{name}}氏" {{
|
23
|
+
<img src="{{fig_src}}" loading="lazy" alt="{{name}}氏"{{#width}} width="{{width}}"{{/width}}{{#height}} height="{{height}}"{{/height}} />
|
24
24
|
{{/imgs_list}}
|
25
25
|
<div style="text-align:left; padding:0px 35px;">
|
26
26
|
<figcaption><strong>{{name}}({{huri}})氏</strong></figcaption>
|
@@ -3,11 +3,10 @@
|
|
3
3
|
require 'mustache'
|
4
4
|
|
5
5
|
require_relative 'fig/module_fig_base'
|
6
|
-
require_relative 'fig/module_fig_plus'
|
7
6
|
|
8
7
|
class Fig_Z < Mustache
|
9
8
|
|
10
|
-
include Fig_00
|
9
|
+
include Fig_00
|
11
10
|
|
12
11
|
# <<Fig_Z>>
|
13
12
|
# src: 画像ファイル名
|
@@ -18,9 +17,9 @@ class Fig_Z < Mustache
|
|
18
17
|
@template = <<EOT
|
19
18
|
<figure>
|
20
19
|
{{#imgs_list}}
|
21
|
-
<a href="{{fig_src}}" rel="lightbox" target="_blank"><img src="{{fig_src}}" alt="{{alt}}" {{
|
20
|
+
<a href="{{fig_src}}" rel="lightbox" target="_blank"><img src="{{fig_src}}" loading="lazy" alt="{{alt}}"{{#width}} width="{{width}}"{{/width}}{{#height}} height="{{height}}"{{/height}} /></a>
|
22
21
|
{{/imgs_list}}
|
23
|
-
<figcaption markdown="span">{{#
|
22
|
+
<figcaption markdown="span">{{#caption}}{{& caption}}<br/>{{/caption}}[画像クリックで拡大表示]</figcaption>
|
24
23
|
</figure>
|
25
24
|
EOT
|
26
25
|
|
data/lib/zine_brewer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zine_brewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinori Ichigo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mustache
|
@@ -38,11 +38,12 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- akinori.ichigo@gmail.com
|
44
44
|
executables:
|
45
45
|
- zine_brewer
|
46
|
+
- zine_brewing_server
|
46
47
|
extensions: []
|
47
48
|
extra_rdoc_files: []
|
48
49
|
files:
|
@@ -54,6 +55,7 @@ files:
|
|
54
55
|
- bin/console
|
55
56
|
- bin/setup
|
56
57
|
- exe/zine_brewer
|
58
|
+
- exe/zine_brewing_server
|
57
59
|
- lib/zine_brewer.rb
|
58
60
|
- lib/zine_brewer/kramdown/converter/sehtml.rb
|
59
61
|
- lib/zine_brewer/kramdown/parser/sekd.rb
|
@@ -61,7 +63,6 @@ files:
|
|
61
63
|
- lib/zine_brewer/templates/bookranking.rb
|
62
64
|
- lib/zine_brewer/templates/casts.rb
|
63
65
|
- lib/zine_brewer/templates/fig/module_fig_base.rb
|
64
|
-
- lib/zine_brewer/templates/fig/module_fig_plus.rb
|
65
66
|
- lib/zine_brewer/templates/fig_a.rb
|
66
67
|
- lib/zine_brewer/templates/fig_h.rb
|
67
68
|
- lib/zine_brewer/templates/fig_n.rb
|
@@ -76,7 +77,7 @@ metadata:
|
|
76
77
|
homepage_uri: https://github.com/akinori-ichigo/zine_brewer
|
77
78
|
source_code_uri: https://github.com/akinori-ichigo/zine_brewer
|
78
79
|
changelog_uri: https://github.com/akinori-ichigo/zine_brewer
|
79
|
-
post_install_message:
|
80
|
+
post_install_message:
|
80
81
|
rdoc_options: []
|
81
82
|
require_paths:
|
82
83
|
- lib
|
@@ -91,8 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
92
|
- !ruby/object:Gem::Version
|
92
93
|
version: '0'
|
93
94
|
requirements: []
|
94
|
-
rubygems_version: 3.1.
|
95
|
-
signing_key:
|
95
|
+
rubygems_version: 3.1.6
|
96
|
+
signing_key:
|
96
97
|
specification_version: 4
|
97
98
|
summary: Kramdown to HTML converter for Shoeisha Web Media
|
98
99
|
test_files: []
|