zine_brewer 1.3.2 → 1.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4a2d9b8d3b0420e7f00e67d9cd814b9d47dee6ee7597468357143e677d2be63
4
- data.tar.gz: dfada5d6c981ac3686f670c83e52fe86f2351859e2217bef2f49d929888b64a8
3
+ metadata.gz: ee3ba68f6148bff1354914fd0f2b98c5e60b70341aae73cc113d4aed2b1aa5a4
4
+ data.tar.gz: 7d25319819a05e422cdb9504e173bdfa455b938c3015a3ea6c84c58b73bcf6c3
5
5
  SHA512:
6
- metadata.gz: a5cbb3db19f9d1626cb9439fe4b2ff26910e76c04f512f915e7c1599798a727a663a34bdf9cb0d0eaa3cec3c5571867ba0833e823b35ba46653f5eacf7b44d5a
7
- data.tar.gz: e0dd6c0e92d1fe3204f7e904b5edb133479d597772d08c6024b2773802768b3e37335d9aadbebffced13375ba97c2341225c3f8ef12a88384cbb2e50cb3f8912
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
@@ -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
- puts 'ERROR: There is not the input file. Check the input file.'
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:100px;" title="{{title}}" /></a></figure>
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
- "/static/images/article/■記事ID■/#{File.basename(src)}"
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
- # src: 写真ファイル名
10
- # name: 姓 名
11
- # huri: ふり がな
12
- # cap: プロフィール
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}}" style="height:135px;" />
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
- [{"src" => (src rescue nil),
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
- "/static/images/article/■記事ID■/#{File.basename(l_src)}"
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[:img_style] = make_img_style(h["width"], h["height"]) \
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 make_img_style(l_width, l_height)
56
+ def make_img_size(l_width, l_height)
58
57
  s = []
59
- s << "width:#{l_width};" unless l_width.nil?
60
- s << "height:#{l_height};" unless l_height.nil?
61
- unless s.all?{|v| v.nil? }
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, Fig_01
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}}" {{& img_style}}/></a>
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">{{#figcaption_sw}}{{& caption}}<br/>{{/figcaption_sw}}[画像クリックで拡大表示]</figcaption>
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, Fig_01
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
- {{#href}}<a href="{{href}}" target="_blank">{{/href}}<img src="{{fig_src}}" alt="{{alt}}" {{& img_style}}/>{{#href}}</a>{{/href}}
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
- {{#figcaption_sw}}<figcaption markdown="span">{{& caption}}</figcaption>{{/figcaption_sw}}
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, Fig_01
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}}" {{& img_style}}/>
21
+ <img src="{{fig_src}}" loading="lazy" alt="{{alt}}"{{#width}} width="{{width}}"{{/width}}{{#height}} height="{{height}}"{{/height}} />
23
22
  {{/imgs_list}}
24
- {{#figcaption_sw}}<figcaption markdown="span">{{caption}}{{& cited_from}}</figcaption>{{/figcaption_sw}}
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}}氏" {{& img_style}} />
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, Fig_01
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}}" {{& img_style}}/></a>
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">{{#figcaption_sw}}{{& caption}}<br/>{{/figcaption_sw}}[画像クリックで拡大表示]</figcaption>
22
+ <figcaption markdown="span">{{#caption}}{{& caption}}<br/>{{/caption}}[画像クリックで拡大表示]</figcaption>
24
23
  </figure>
25
24
  EOT
26
25
 
@@ -1,3 +1,3 @@
1
1
  module ZineBrewer
2
- VERSION = "1.3.2"
2
+ VERSION = "1.7.0"
3
3
  end
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.3.2
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: 2020-10-04 00:00:00.000000000 Z
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.4
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: []
@@ -1,15 +0,0 @@
1
- # coding: utf-8
2
-
3
- module Fig_01
4
-
5
- def open_which
6
- defined?(href)
7
- end
8
-
9
- def figcaption_sw
10
- defined?(cap)
11
- end
12
-
13
- end
14
-
15
-