zine_brewer 1.2.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cfdaa4752f297553002e48ebdcb2f865632942198aba89cc5bcc4eecccf5d17
4
- data.tar.gz: 578d33b80e31f298e9b689bf55052afe16e48d2fec61ce093ea49ceb80381072
3
+ metadata.gz: 9f47a38372b16bb0fdf904883a92e1b1e6c312b535e7efeba1c5ea5f34143d89
4
+ data.tar.gz: 057c4e1ed3e0408135326a69db755a4d50b4a4cef5e10ab3969030f6e78fe289
5
5
  SHA512:
6
- metadata.gz: db5d725e128377f6fc87c11802f19f2c3d5a7410cab23cbf5a07b75275f68bd983233040927761c53ab903a24a3628f27d53f50d072a184bf03eb9f8c69f1e1f
7
- data.tar.gz: 73b938d7e8e3073d6bc73c62a0edc2418dfa5966837109593f2baddbec5724880c0ece68851a986effb0dc585b4888657bef9db0351428eb9c3cd67a481a90c9
6
+ metadata.gz: c9a74e98d128f27bb27f859e80a45eb2bf242c5eeb523be44795a6d06cae851ad66b004a74338e6893312ceff02d31efa8f3864147c3ece6eb4cb1688b47c605
7
+ data.tar.gz: 41ad0cf51d8e2d6c2aa466bb9bf752c4c3158f2ee2d33365f60fa06a1bd77b11ba0d32c2e74f3931f41f29b874eab4eccf94e520d8e39f66347ad2b3f6839cb8
data/README.md CHANGED
@@ -20,7 +20,17 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- $ zine_brewer [kramdown_document_filename]
23
+ As the converting command:
24
+
25
+ $ zine_brewer [kramdown_document_filepath]
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.
24
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".
@@ -108,6 +118,8 @@ ZineBrewerで扱う原稿は「ヘッダー」と「本文」に分かれます
108
118
 
109
119
  ### 本文
110
120
 
121
+ 本文をHTMLに変換したファイルは、proof/body.txtとして出力されます。
122
+
111
123
  #### ■ページの起こし
112
124
 
113
125
  **本文の各ページの先頭には、ページの起こしとして必ず`<%-- page -->`を記述してください。** 1ページ目の起こしは、ヘッダーとの境界にもなります。
@@ -294,7 +306,7 @@ width: 450px
294
306
  ===wraparound
295
307
 
296
308
  {:.imgR}
297
- <<Fig_A>>
309
+ <<Fig_N>>
298
310
  src: 1234_fig.png
299
311
  width: 200px
300
312
 
@@ -311,7 +323,7 @@ width: 200px
311
323
  ===wraparound
312
324
 
313
325
  {:.imgR}
314
- <<Fig_A>>
326
+ <<Fig_N>>
315
327
  src: 1234_fig.png
316
328
  width: 200px
317
329
 
@@ -325,7 +337,7 @@ width: 200px
325
337
 
326
338
  #### ■脚注の書き方
327
339
 
328
- 次のように、本文テキスト中の脚注を付けたい言葉などに`[^1]`などとアンカーを付け、脚注を置きたい場所に`[^1]: 〜`という形で脚注本体を書きます。脚注本体のコロンを忘れなく。脚注番号で使えるのは半角数字のみです。
340
+ 次のように、本文テキスト中の脚注を付けたい言葉などに`[^1]`などとアンカーを付け、脚注を置きたい場所に`[^1]: 〜`という形で脚注本体を書きます。脚注本体のコロンを忘れなく。脚注番号には半角英数字が使えます([^1]、[^imi01]など)。変換後は出現順に[1]、[2]という通し番号による表記に変わります。
329
341
 
330
342
  ```
331
343
   ほら、ここに難しい専門用語[^1]が1つ。ここにも意味の分からない専門用語[^2]がもう1つ。
data/exe/zine_brewer CHANGED
File without changes
@@ -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)
@@ -1,5 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
+ require 'mustache'
4
+
3
5
  class BookRanking < Mustache
4
6
 
5
7
  # <<BookRanking>>
@@ -23,7 +25,8 @@ EOT
23
25
  def cover
24
26
  case File.dirname(src)
25
27
  when ".", "images"
26
- "/static/images/article/■記事ID■/#{File.basename(src)}"
28
+ f = File.basename(l_src)
29
+ "/static/images/article/■記事ID■/#{/^\d+_/ =~ f ? f : '■記事ID■_' + f}"
27
30
  when "common"
28
31
  "/static/images/article/common/#{File.basename(src)}"
29
32
  else
@@ -1,13 +1,16 @@
1
1
  # coding: utf-8
2
2
 
3
+ require 'mustache'
4
+
3
5
  class Casts < Mustache
4
6
 
5
7
  # <<Casts>>
6
8
  # casts:
7
- # src: 写真ファイル名
8
- # name: 姓 名
9
- # huri: ふり がな
10
- # cap: プロフィール
9
+ # title: 見出し
10
+ # src: 写真ファイル名
11
+ # name:
12
+ # huri: ふり がな
13
+ # cap: プロフィール
11
14
 
12
15
  # CSSに下記の登録が必要
13
16
  # article#contents div.article div.casts>div ~ div { margin-top:8px; }
@@ -15,11 +18,12 @@ class Casts < Mustache
15
18
  @template = <<EOT
16
19
  <div class="casts" style="margin-bottom:30px; padding:13px 13px 3px; border:solid 2px #eee;">
17
20
  {{#prof_list}}
21
+ {{#title_sw}}<h4>{{title}}</h4>{{/title_sw}}
18
22
  <div class="imgLRBlock cf">
19
23
  <figure class="imgL">
20
24
  <img src="{{fig_src}}" alt="{{name}}" style="height:135px;" />
21
25
  </figure>
22
- <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>
23
27
  </div>
24
28
  {{/prof_list}}
25
29
  </div>
@@ -30,6 +34,8 @@ EOT
30
34
  (casts rescue a_cast_param).each do |h|
31
35
  a_cast = {}
32
36
  raise "Error: No src:" if h["src"].nil?
37
+ a_cast[:title] = h["title"]
38
+ a_cast[:title_sw] = !h["title"].nil?
33
39
  a_cast[:fig_src] = make_src(h["src"])
34
40
  a_cast[:name] = h["name"]
35
41
  a_cast[:huri] = h["huri"]
@@ -41,7 +47,8 @@ EOT
41
47
 
42
48
  private
43
49
  def a_cast_param
44
- [{"src" => (src rescue nil),
50
+ [{"title" => (title rescue nil),
51
+ "src" => (src rescue nil),
45
52
  "name" => (name rescue nil),
46
53
  "huri" => (huri rescue nil),
47
54
  "cap" => (cap rescue nil)}]
@@ -50,7 +57,8 @@ EOT
50
57
  def make_src(l_src)
51
58
  case File.dirname(l_src)
52
59
  when ".", "images"
53
- "/static/images/article/■記事ID■/#{File.basename(l_src)}"
60
+ f = File.basename(l_src)
61
+ "/static/images/article/■記事ID■/#{/^\d+_/ =~ f ? f : '■記事ID■_' + f}"
54
62
  when "common"
55
63
  "/static/images/article/common/#{File.basename(l_src)}"
56
64
  else
@@ -68,37 +76,3 @@ EOT
68
76
 
69
77
  end
70
78
 
71
- __END__
72
-
73
- {:.casts %margin-bottom:45px; %padding:13px 13px 3px; %border:solid 2px #eee;}
74
- ===div
75
-
76
- {:.imgLRBlock .cf}
77
- ===div
78
- {:.imgL}
79
- <<Fig_N>>
80
- src: 2096_misonou_p.jpg
81
- height: 135px
82
-
83
- {:.ovh markdown="1" %font-size:14px; %line-height:1.7; %margin-bottom:10px;}
84
- **御園生 銀平(みそのう ぎんぺい)氏**<br/>
85
- ソフトバンク株式会社[[ ]]{:%font-size:3px;}人事本部[[ ]]{:%font-size:3px;}戦略企画統括部[[ ]]{:%font-size:3px;}人材戦略部[[ ]]{:%font-size:3px;}デジタルHR推進課。<br/>
86
- (※御園生様のプロフィールを100〜150字程度でお願いいたします)。
87
- ==/div
88
-
89
- {:.imgLRBlock .cf}
90
- ===div
91
- {:.imgL}
92
- <<Fig_N>>
93
- src: 2096_shikauchi_p.jpg
94
- height: 135px
95
-
96
- {:.ovh markdown="1" %font-size:14px; %line-height:1.7; %margin-bottom:10px;}
97
- **鹿内 学(しかうち まなぶ)氏**<br/>
98
- 博士(理学)。株式会社シンギュレイト 代表。<br/>
99
- 働く中でのコミュニケーション・データから関係性に注目した次世代ピープルアナリティクスにとりくむ。代表を務めるシンギュレイトでは1 on 1や会議で利用できる可視化ツールを提供中。働く組織の科学と実用をめざす。情報量規準が好き、サッカー好き、漫画好き。
100
- ==/div
101
-
102
- ==/div
103
-
104
-
@@ -1,5 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
+ require 'mustache'
4
+
3
5
  require_relative 'fig/module_fig_base'
4
6
  require_relative 'fig/module_fig_plus'
5
7
 
@@ -1,5 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
+ require 'mustache'
4
+
3
5
  require_relative 'fig/module_fig_base'
4
6
  require_relative 'fig/module_fig_plus'
5
7
 
@@ -1,5 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
+ require 'mustache'
4
+
3
5
  require_relative 'fig/module_fig_base'
4
6
  require_relative 'fig/module_fig_plus'
5
7
 
@@ -1,5 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
+ require 'mustache'
4
+
3
5
  require_relative 'fig/module_fig_base'
4
6
 
5
7
  class Fig_P < Mustache
@@ -1,5 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
+ require 'mustache'
4
+
3
5
  require_relative 'fig/module_fig_base'
4
6
  require_relative 'fig/module_fig_plus'
5
7
 
@@ -1,3 +1,3 @@
1
1
  module ZineBrewer
2
- VERSION = "1.2.1"
2
+ VERSION = "1.6.0"
3
3
  end
data/zine_brewer.gemspec CHANGED
@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
+ spec.add_runtime_dependency "mustache"
27
28
  spec.add_runtime_dependency "darkmouun"
28
29
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zine_brewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori Ichigo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-03 00:00:00.000000000 Z
11
+ date: 2021-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mustache
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: darkmouun
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -29,6 +43,7 @@ email:
29
43
  - akinori.ichigo@gmail.com
30
44
  executables:
31
45
  - zine_brewer
46
+ - zine_brewing_server
32
47
  extensions: []
33
48
  extra_rdoc_files: []
34
49
  files:
@@ -40,6 +55,7 @@ files:
40
55
  - bin/console
41
56
  - bin/setup
42
57
  - exe/zine_brewer
58
+ - exe/zine_brewing_server
43
59
  - lib/zine_brewer.rb
44
60
  - lib/zine_brewer/kramdown/converter/sehtml.rb
45
61
  - lib/zine_brewer/kramdown/parser/sekd.rb
@@ -77,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
93
  - !ruby/object:Gem::Version
78
94
  version: '0'
79
95
  requirements: []
80
- rubygems_version: 3.1.4
96
+ rubygems_version: 3.2.14
81
97
  signing_key:
82
98
  specification_version: 4
83
99
  summary: Kramdown to HTML converter for Shoeisha Web Media