Module: Dyndoc::Linter
- Defined in:
- lib/dyndoc-linter.rb
Class Method Summary collapse
- .check_content(txt) ⇒ Object
- .check_file(file_to_lint) ⇒ Object
- .guess_bad_opentags(txt) ⇒ Object
- .guess_bad_tags(tags) ⇒ Object
- .selected_tags(txt) ⇒ Object
- .simplify_dyndoc_tags(tags) ⇒ Object
Class Method Details
.check_content(txt) ⇒ Object
35 36 37 |
# File 'lib/dyndoc-linter.rb', line 35 def Linter.check_content(txt) Dyndoc::Linter.(Dyndoc::Linter.(txt)) end |
.check_file(file_to_lint) ⇒ Object
39 40 41 42 |
# File 'lib/dyndoc-linter.rb', line 39 def Linter.check_file(file_to_lint) txt=File.read(file_to_lint) Dyndoc::Linter.check_content(txt) + Dyndoc::Linter.(txt) end |
.guess_bad_opentags(txt) ⇒ Object
31 32 33 |
# File 'lib/dyndoc-linter.rb', line 31 def Linter.(txt) =txt.scan(/(?:\{[\#\@](?:[\w\:\|-]*[<>]?[=?!><]?(?:\.\w*)?)\})/).each_with_index.map{|e,i| [i+1,e] } end |
.guess_bad_tags(tags) ⇒ Object
27 28 29 |
# File 'lib/dyndoc-linter.rb', line 27 def Linter.() end |
.selected_tags(txt) ⇒ Object
10 11 12 13 14 |
# File 'lib/dyndoc-linter.rb', line 10 def Linter.(txt) =txt.scan(/(?:\{[\#\@](?:[\w\:\|-]*[<>]?[=?!><]?(?:\.\w*)?)\]|\[[\#\@](?:[\w\:\|-]*[<>]?[=?!><]?)\})/).each_with_index.map{|e,i| [i+1,e] } ## p selected_tags end |
.simplify_dyndoc_tags(tags) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dyndoc-linter.rb', line 16 def Linter.() (0..(.length-2)).each do |i| if ([i][1] == "{#"+[i+1][1][2..-2]+"]" and [i+1][1] == "[#"+[i][1][2..-2]+"}") or ([i][1][0]=="{" and [i+1][1]=="[#}") .delete_at i+1;.delete_at i Dyndoc::Linter.() break end end return end |