Class: Martile

Inherits:
Object
  • Object
show all
Defined in:
lib/martile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_s, ignore_domainlabel: nil) ⇒ Martile

Returns a new instance of Martile.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/martile.rb', line 50

def initialize(raw_s, ignore_domainlabel: nil)
  
  @data_source = {}
  
  @ignore_domainlabel = ignore_domainlabel

  raw_s.gsub!("\r",'')
  
  s0 = raw_s =~ /^__DATA__$/ ? parse__data__(raw_s) : raw_s
  #puts 's0: ' + s0.inspect
  s1 = apply_filter(s0) {|x| slashpre x }
  #puts 's1 : ' + s1.inspect
  s2 = apply_filter(s1) {|x| code_block_to_html(x.strip + "\n") }

  #puts 's2 : ' + s2.inspect
  #s3 = apply_filter(s2, %w(ol ul)) {|x| explicit_list_to_html x }
  #puts 's3 : ' + s3.inspect
  s4 = apply_filter(s2) {|x| ordered_list_to_html x }
  #puts 's4 : ' + s4.inspect

  s5 = apply_filter(s4) {|x| unordered_list_to_html x }
  #puts 's5 : ' + s5.inspect

  s6 = apply_filter(s5) {|x| dynarex_to_markdown x }
  #puts 's6 :' + s6.inspect

  s7 = apply_filter(s6) {|x| table_to_html x }
  #puts 's7 : ' + s7.inspect

  s8 = apply_filter(s7) {|x| underline x}
  #puts 's8: ' + s8.inspect
  s9 = apply_filter(s8) {|x| section x }
  #puts 's9: ' + s9.inspect
  
  s10 = apply_filter(s9) {|x| smartlink x }

  #puts 's10: ' + s10.inspect

  #s11 = section s9
  #puts 's11 : ' + s11.inspect
  s12 = apply_filter(s10) {|x| audiotag x }
  #puts 's12 : ' + s12.inspect
  s13 = apply_filter(s12) {|x| videotag x }
  #puts 's13 : ' + s13.inspect
  s14 = apply_filter(s13) {|x| iframetag x }
  #puts 's14 : ' + s14.inspect
  s15 = apply_filter(s14) {|x| kvx_to_dl x }
  #puts 's15 : ' + s15.inspect
  s16 = apply_filter(s15) {|x| list_item_to_hyperlink x }
  #puts 's16 : ' + s16.inspect
  s17 = apply_filter(s16) {|x| mtlite_utils x }
  s18 = apply_filter(s17) {|x| hyperlinkify x }
  s19 = apply_filter(s18) {|x| highlight x }
  s20 = apply_filter(s19) {|x| details x }
  
  #puts 's17 : ' + s17.inspect
  
  @to_s = s20
end

Instance Attribute Details

#data_sourceObject (readonly)

Returns the value of attribute data_source.



48
49
50
# File 'lib/martile.rb', line 48

def data_source
  @data_source
end

#to_sObject (readonly)

Returns the value of attribute to_s.



48
49
50
# File 'lib/martile.rb', line 48

def to_s
  @to_s
end

Instance Method Details

#to_htmlObject



110
111
112
# File 'lib/martile.rb', line 110

def to_html()
  @to_s
end