Top Level Namespace
Defined Under Namespace
Classes: CodeTabsCustomerRenderer
Instance Method Summary
collapse
Instance Method Details
#add_resource_links_in_html_head(site) ⇒ Object
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/jekyll-commonmark-codetabs.rb', line 146
def add_resource_links_in_html_head(site)
site_directory = "#{site.in_dest_dir("/")}"
Dir.glob("**/*.html", base: site_directory).each do |file_name|
file_plus_path = "#{site_directory}#{file_name}"
if (!File.foreach(file_plus_path).grep(/code_switcher_container_parent/).any?)
next
end
if (File.foreach(file_plus_path).grep(/<\/head>/).any?)
File.write(file_plus_path, File.open(file_plus_path, &:read).sub("</head>","#{get_resource_string(site)}</head>"))
elsif (File.foreach(file_plus_path).grep(/<\/html>/).any?)
File.write(file_plus_path, File.open(file_plus_path, &:read).sub(/(<html.*>)/,"#{$1}<head>#{get_resource_string(site)}</head>"))
end
end
end
|
#get_resource_string(site) ⇒ Object
140
141
142
143
144
|
# File 'lib/jekyll-commonmark-codetabs.rb', line 140
def get_resource_string(site)
return "<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Roboto+Mono\"/>" +
"<link rel=\"stylesheet\" href=\"#{site.baseurl}/assets/codeblock.css\"/>" +
"<script src=\"#{site.baseurl}/assets/codeblock.js\"></script>"
end
|