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
40 41 42 |
# File 'lib/dyndoc-linter.rb', line 40 def Linter.check_content(txt) Dyndoc::Linter.(Dyndoc::Linter.(txt)) end |
.check_file(file_to_lint) ⇒ Object
44 45 46 47 |
# File 'lib/dyndoc-linter.rb', line 44 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
36 37 38 |
# File 'lib/dyndoc-linter.rb', line 36 def Linter.(txt) =txt.scan(/(?:\{[\#\@](?:[\w\:\|-]*[<>]?[=?!><]?(?:\.\w*)?)\})/).each_with_index.map{|e,i| [i+1,e] } end |
.guess_bad_tags(tags) ⇒ Object
32 33 34 |
# File 'lib/dyndoc-linter.rb', line 32 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 26 27 28 29 30 |
# 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 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 |