32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
|
# File 'lib/docwu/render.rb', line 32
def generate(options={})
content_data = options[:content_data] || {}
content_text = options[:content_text] || ''
content_result = ''
dest = options[:dest]
template = options[:template]
marktype = (content_data['marktype'] || 'markdown').to_s
_catalogs = []
case marktype
when 'markdown'
_mark_options = [
:hard_wrap,
:autolink,
:no_intraemphasis,
:fenced_code,
:gh_blockcode,
:tables,
:footnotes,
:superscript,
:underline,
:strikethrough,
:space_after_headers,
:quote,
:highlight
]
_html = ::RedcarpetCompat.new(content_text, *_mark_options).to_html
_catalogs_result = ::Docwu::Utils.html_catalogable(_html)
_catalogs = _catalogs_result['catalogs']
content_result << ::Docwu::Utils.syntax_highlighter(_catalogs_result['html'])
else
end
content_data['page'] ||= {}
content_data['page']['content'] = content_result
content_data['page']['content_present?'] = content_result.size > 0
content_data['page']['catalogs'] = _catalogs
::Docwu::Utils.formated_hashed!(content_data)
::Docwu::Utils.write_file dest, ::MustacheRender::Mustache.render(template, content_data)
end
|