zine_brewer 1.8.0 → 1.9.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: 4ec1e562956e0815a826a59cef79390646e78600d8a63e00d77561813596a20d
4
- data.tar.gz: f3f4a11911c859b2d86b8f69f53167a922355b213500ace38fffb0c672d309df
3
+ metadata.gz: 9377b1600b8679c919199df61d3c142c7f8a0c9c1972d891a31cd6429b406a49
4
+ data.tar.gz: b100b1ad9d96943035a8acd2dd043aa27499c348d8e9a9b9c4bbef47b9d2d0b2
5
5
  SHA512:
6
- metadata.gz: 973130be4a6996dcde4d97683711aee2c6827c1910b3414a21389c8493a920a31fdf2289c5171a00a5587307f9a0bf14a7df32f449ff68681f2280902069c020
7
- data.tar.gz: 2ebbd32bf872e1c4cfb570b7b0f26c6a1c759e2fe97d1b5adfde6136c2f95f342495753df3d22cba0a297ff79c0af78b0f07e402926ffa5d45eff4087a90e3d5
6
+ metadata.gz: ba17f9a2b9d9288b7e54e97f3fa9ccacfa9bebfad069810bd8fb20526e012d32a944f3c1bb44851b5d899d4c94b532c958bb8a2c8dbe2d36abd381f258b2bd99
7
+ data.tar.gz: b5e927c93f297b95758ad684cb54e770a981372fc2815e1f50f7d2de0d4347edf504b5f269ba0b50518fadbd09ed3550d0adc51a022c1e5504cd8ad105bd1ddc
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile CHANGED
@@ -4,3 +4,7 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
+
8
+ gem "rspec", "~> 3.0"
9
+
10
+ gem "pry"
@@ -75,10 +75,12 @@ module Kramdown
75
75
  end
76
76
 
77
77
  def convert_definition_table(el, indent)
78
+ th_width = el.attr.delete('th-width')
79
+ th = th_width.nil? ? "<th>" : "<th width=\"#{th_width}\">"
78
80
  raw_caption = el.attr.delete('caption')
79
81
  rows = raw_caption.nil? ? '' : table_caption(raw_caption)
80
82
  inner(el.children.first, indent).scan(/(<dt>.+?<\/dt>|<dd>.+?<\/dd>)/m).
81
- map{|x| x.first.sub(/\A<dt>(.+)<\/dt>\z/m, "<th>\\1</th>")}.
83
+ map{|x| x.first.sub(/\A<dt>(.+)<\/dt>\z/m, "#{th}\\1</th>")}.
82
84
  map{|x| x.sub(/\A<dd>(.+)<\/dd>\z/m, "<td>\\1</td>")}.
83
85
  each_slice(2) do |x|
84
86
  row = x.map{|c| (' '*(indent + 2)) + c}.join("\n")
@@ -49,6 +49,7 @@ module ZineBrewer
49
49
  @author = set_header_item(h[4], '著者 クレジット')
50
50
  @css = set_header_item(h[5], '')
51
51
 
52
+ @pp_header = make_pp_header
52
53
  @converted = convert(body)
53
54
  end
54
55
 
@@ -62,6 +63,17 @@ module ZineBrewer
62
63
  end
63
64
  end
64
65
 
66
+ def make_pp_header
67
+ header_output = []
68
+ header_output << "[コーナー]\n#{@corner}" if @corner.is_complete?
69
+ header_output << "[タイトル]\n#{@title}" if @title.is_complete?
70
+ header_output << "[リード]\n<p>#{@lead}</p>" if @lead.is_complete?
71
+ header_output << "[タイトル画像]\n#{@pic}" if @pic.is_complete?
72
+ header_output << "[著者クレジット]\n#{@author}" if @author.is_complete?
73
+ header_output << "[追加CSS]\n#{@css}" if @css.is_complete?
74
+ header_output.join("\n\n")
75
+ end
76
+
65
77
  ## Writing out header and body to each file
66
78
  def write_out
67
79
  make_proof_directory
@@ -78,15 +90,8 @@ module ZineBrewer
78
90
  end
79
91
 
80
92
  def write_proof_header
81
- header_output = ""
82
- header_output << "[コーナー]\n#{@corner}\n\n" if @corner.is_complete?
83
- header_output << "[タイトル]\n#{@title}\n\n" if @title.is_complete?
84
- header_output << "[リード]\n<p>#{@lead}</p>\n\n" if @lead.is_complete?
85
- header_output << "[タイトル画像]\n#{@pic}\n\n" if @pic.is_complete?
86
- header_output << "[著者クレジット]\n#{@author}\n\n" if @author.is_complete?
87
- header_output << "[追加CSS]\n#{@css}\n\n" if @css.is_complete?
88
93
  File.open("#{@proof_dir}/header.txt", 'wb') do |f|
89
- f.write(header_output)
94
+ f.write(@pp_header)
90
95
  end
91
96
  end
92
97
 
@@ -120,6 +125,11 @@ module ZineBrewer
120
125
  ### Converts a markdown document and returns that converted body
121
126
  dkmn.convert
122
127
  end
128
+
129
+ ### pretty print of the converted document
130
+ def pretty_print
131
+ @pp_header + "\n\n" + @converted
132
+ end
123
133
  end
124
134
  end
125
135
 
@@ -1,3 +1,3 @@
1
1
  module ZineBrewer
2
- VERSION = "1.8.0"
2
+ VERSION = "1.9.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.8.0
4
+ version: 1.9.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: 2021-09-12 00:00:00.000000000 Z
11
+ date: 2021-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mustache
@@ -47,6 +47,7 @@ executables:
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
+ - ".rspec"
50
51
  - CODE_OF_CONDUCT.md
51
52
  - Gemfile
52
53
  - LICENSE.txt