markdown_ruby_documentation 0.4.3 → 0.4.4

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
  SHA1:
3
- metadata.gz: 11ab3f61b93d496652ba85ae38a259c246e442da
4
- data.tar.gz: b53de1a0cdf50f601d8ca7ed390bc11adf540b19
3
+ metadata.gz: 1e4deabd18fa1afabe6abc4c3a9375341807ef22
4
+ data.tar.gz: db358d7299865548126c931f9756f4fff5534c5a
5
5
  SHA512:
6
- metadata.gz: 972e857ab9aeb02520f0b32f0e5fd50cad982be37e42ce46d314017a96fbc3c95dad37b27ddac9e0c562771d1599c33469e59864488b5f48c2686ee754d0bc93
7
- data.tar.gz: 8c9ca0631d4065d9bfcf93c5cbdafb39aafc04e8dad33b997e9da004cdea4d7fd7c3bee00c0b8edfcc2556a1bfc58584eb21d9fb1bf1a545bb251960e12613c5
6
+ metadata.gz: 1918c0b06612f8d663c2af76471ced722d1b3310f565fe3c4fdc611e8eb73417d58d19e9686238f10a691ef3a545bc871bf09ea250076562ac4d1adbadb24d46
7
+ data.tar.gz: 06248e8a5a0cd48486d3e7fd290f412c8ad0be54523d9537474e55d9784da06c75298612c0166c6bb5cc15f361e1255512678f7cd4bbaf83f76ed181d6c001f4
@@ -129,6 +129,7 @@ module MarkdownRubyDocumentation
129
129
  :remove_end_keyword,
130
130
  :constants_with_name_and_value,
131
131
  :remove_memoized_vars,
132
+ :comment_format
132
133
  ]
133
134
 
134
135
  def ruby_to_markdown(*args)
@@ -147,6 +148,10 @@ module MarkdownRubyDocumentation
147
148
  ruby_source
148
149
  end
149
150
 
151
+ def comment_format(source_code, proc: false)
152
+ gsub_replacement(source_code, { /^#(.*)/ => "</br>*(\\1)*</br>" }, proc: proc)
153
+ end
154
+
150
155
  def remove_memoized_vars(source_code=print_method_source, *)
151
156
  source_code.gsub(/@[a-z][a-z0-9_]+ \|\|=?\s/, "") # @memoized_vars ||=
152
157
  end
@@ -331,8 +336,12 @@ module MarkdownRubyDocumentation
331
336
 
332
337
  def constants_with_name_and_value(ruby_source, *)
333
338
  ruby_source.gsub(/([A-Z]+[A-Z_0-9]+)/) do |match|
334
- value = ruby_class.const_get(match)
335
- "[#{ConstantsPresenter.format(value)}](##{match.dasherize.downcase})"
339
+ begin
340
+ value = ruby_class.const_get(match)
341
+ "[#{ConstantsPresenter.format(value)}](##{match.dasherize.downcase})"
342
+ rescue NameError
343
+ match
344
+ end
336
345
  end
337
346
  end
338
347
 
@@ -348,11 +357,10 @@ module MarkdownRubyDocumentation
348
357
 
349
358
  def ruby_if_statement_to_md(ruby_source, proc: false)
350
359
  conversions = {
351
- /else if(.*)/ => "* __Else If__\\1\n__Then__",
352
- /elsif(.*)/ => "* __Else If__\\1\n__Then__",
353
- /if(.*)/ => "* __If__\\1\n__Then__",
354
- /unless(.*)/ => "* __Unless__\\1\n__Then__",
355
- "else" => "* __Else__"
360
+ /elsif(.*)/ => "* __Else If__\\1\n__Then__",
361
+ /^\s?if(.*)/ => "* __If__\\1\n__Then__",
362
+ /unless(.*)/ => "* __Unless__\\1\n__Then__",
363
+ "else" => "* __Else__"
356
364
  }
357
365
  gsub_replacement(ruby_source, conversions, proc: proc)
358
366
  end
@@ -1,3 +1,3 @@
1
1
  module MarkdownRubyDocumentation
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_ruby_documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source