Refactor
This commit is contained in:
@@ -486,7 +486,7 @@ $(document).ready(function() {
|
|||||||
// Set text direction auto
|
// Set text direction auto
|
||||||
$('.markdown-body p, .markdown-body span, .markdown-body pre, .markdown-body table').attr('dir','auto');
|
$('.markdown-body p, .markdown-body span, .markdown-body pre, .markdown-body table').attr('dir','auto');
|
||||||
|
|
||||||
// Copy anchors for each editable header and give it the new anchor the 'edit' class, to display a link to edit the section
|
// Copy anchors for each editable header and give the new anchor the 'edit' class, to display an "edit section" link
|
||||||
$('a.anchor').each(function (index, anchor) {
|
$('a.anchor').each(function (index, anchor) {
|
||||||
header = $(anchor).closest(':header');
|
header = $(anchor).closest(':header');
|
||||||
if (header.hasClass('editable')){
|
if (header.hasClass('editable')){
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ module Precious
|
|||||||
Octicons::Octicon.new(symbol, parameters).to_svg
|
Octicons::Octicon.new(symbol, parameters).to_svg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Well-formed SVG with XMLNS and height/width removed, for use in CSS
|
||||||
def rocticon_css(symbol, parameters = {})
|
def rocticon_css(symbol, parameters = {})
|
||||||
html = rocticon(symbol, parameters.merge({xmlns: 'http://www.w3.org/2000/svg'}))
|
octicon = Octicons::Octicon.new(symbol, parameters.merge({xmlns: 'http://www.w3.org/2000/svg'}))
|
||||||
html.gsub!(/\s*(width|height)=["']\d+["']\s*/, ' ') # remove height and width attributes so it can be set via CSS
|
[:width, :height].each {|option| octicon.options.delete(option)}
|
||||||
html.gsub!(/\s+/, ' ')
|
octicon.to_svg
|
||||||
html.force_encoding('UTF-8')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def octicon
|
def octicon
|
||||||
|
|||||||
Reference in New Issue
Block a user