tty-markdown 0.3.0 → 0.4.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
  SHA1:
3
- metadata.gz: 78fdb3db2ddf8fcb253d3f2b7fd48ce85f34db5b
4
- data.tar.gz: b4176a98f2e6238a0b9d1d3eb32585610750a4b7
3
+ metadata.gz: df1fbc99e38c58ae4440884d583608273328d2a1
4
+ data.tar.gz: 891c8f4e64b506b07431d93eba3338431cb9d0bc
5
5
  SHA512:
6
- metadata.gz: c4ddf759c61068a151a2e07ad973fa0268ea671be2006ce1ae0fbd5d4aca6f823d0d682bd005af1473d75dd88b61fa69ac9ab5cc23576773b79b546b5651c232
7
- data.tar.gz: 1fa053194d9f4ad41366a4b592888184668f4ea4be628d9cf57e79a296f60b90baaacbac4a8b5df3ed94b29f3baae29268103e7dc3b8328b5a5ecc7cd8547ee4
6
+ metadata.gz: 1ac16bc20d726d43d891cf8b60158ed1a08fe721553ba65b3ded16e4e564018899644fde56f59fb72b9d568d755813768cab380edf35716a227cc2dd05251516
7
+ data.tar.gz: 26eed0a5bcf7c4ceab71faf76b2aa75814d950d7c8776bc5d1dc61b3982b014730904e5913b30705be4423f09abe98baca71d0dd072abc1c1ca1735e2cfe420e
@@ -7,10 +7,10 @@ script: "bundle exec rake ci"
7
7
  rvm:
8
8
  - 2.0.0
9
9
  - 2.1.10
10
- - 2.2.8
10
+ - 2.2.9
11
11
  - 2.3.6
12
12
  - 2.4.3
13
- - 2.5.0
13
+ - 2.5.1
14
14
  - ruby-head
15
15
  - jruby-9000
16
16
  - jruby-head
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.4.0] - 2018-06-20
4
+
5
+ ## Fixed
6
+ * Fix multiline paragraph indentation by Brett(@suwyn)
7
+
3
8
  ## [v0.3.0] - 2018-03-17
4
9
 
5
10
  ### Added
@@ -32,6 +37,7 @@
32
37
 
33
38
  * Initial implementation and release
34
39
 
40
+ [v0.4.0]: https://github.com/piotrmurach/tty-markdown/compare/v0.3.0...v0.4.0
35
41
  [v0.3.0]: https://github.com/piotrmurach/tty-markdown/compare/v0.2.0...v0.3.0
36
42
  [v0.2.0]: https://github.com/piotrmurach/tty-markdown/compare/v0.1.0...v0.2.0
37
43
  [v0.1.0]: https://github.com/piotrmurach/tty-markdown/compare/v0.1.0
data/README.md CHANGED
@@ -64,7 +64,7 @@ puts parsed
64
64
  The `parse_file` allows you to transform a markdown document into a terminal formatted output:
65
65
 
66
66
  ```ruby
67
- parsed = TTY::Markdown.parse('example.md')
67
+ parsed = TTY::Markdown.parse_file('example.md')
68
68
  puts parsed
69
69
  ```
70
70
 
@@ -69,6 +69,9 @@ module TTY
69
69
  opts[:result] << indent
70
70
  end
71
71
 
72
+ opts[:indent] = @current_indent
73
+ opts[:strip] = false
74
+
72
75
  case opts[:parent].type
73
76
  when :li
74
77
  bullet = TTY::Markdown.symbols[:bullet]
@@ -76,6 +79,10 @@ module TTY
76
79
  symbol = opts[:ordered] ? "#{index}." : bullet
77
80
  styles = Array(@theme[:list])
78
81
  opts[:result] << @pastel.decorate(symbol, *styles) + ' '
82
+ opts[:indent] += @indent
83
+ opts[:strip] = true
84
+ when :blockquote
85
+ opts[:indent] = 0
79
86
  end
80
87
 
81
88
  inner(el, opts)
@@ -127,8 +134,11 @@ module TTY
127
134
  end
128
135
 
129
136
  def convert_text(el, opts)
130
- text = el.value
131
- opts[:result] << Strings.wrap(text, @width)
137
+ text = Strings.wrap(el.value, @width)
138
+ text.strip! if opts[:strip]
139
+ indent = ' ' * opts[:indent]
140
+ text = text.gsub(/\n/, "\n#{indent}")
141
+ opts[:result] << text
132
142
  end
133
143
 
134
144
  def convert_strong(el, opts)
@@ -1,5 +1,5 @@
1
1
  module TTY
2
2
  module Markdown
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end # TTY
5
5
  end # Markdown
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-17 00:00:00.000000000 Z
11
+ date: 2018-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown