Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

Commit

Permalink
Merge pull request #311 from lakhanmandloi/dev
Browse files Browse the repository at this point in the history
Sidebar Issue - 3rd level not visible
  • Loading branch information
Lakhan Mandloi authored Mar 6, 2018
2 parents c1a114a + 4a30336 commit 985a6c1
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
69 changes: 69 additions & 0 deletions _plugins/link.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
=begin
link tag takes three properties
- href
- title
- target [ blank ] (default: none)
- url [ relative | absolute ] (default: relative)
- class (default: none)
{% link href="/architecture" title="Web Url" class="link" blank relative %}
=end

module Jekyll
class LinkTag < Liquid::Tag
FILE_REGEX = /({{)(?<name>.*)(}})/i



def replace(context, asset)
m = FILE_REGEX.match(asset)
unless m.nil?
name = m[:name].split('.')
page = context.environments.first[name[0]]
str_replace = page.has_key?(name[1]) ? page[name[1]] : ''
asset = asset.gsub(FILE_REGEX, str_replace)

end
asset
end

def initialize(tag_name, text, tokens)
super

@href = /href=['"]\S*['"]/.match(text).to_s
@title = /title=['"].\S*['"]/.match(text).to_s
@target = /\s(blank)\s/.match(text).to_s.strip!
@url = /\s(relative|absolute)\s/.match(text).to_s.strip!
@classes = /class=['"].\S*['"]/.match(text).to_s

end

def render(context)
href = @href ? @href.gsub('href=', '').gsub("\"", ''): '#'
paths = context.registers[:page]["url"].split('/')
this_version = paths[2]
url = @url

if url == 'relative'
href = 'docs/'+this_version+'/'+href
elsif url == 'absolute'
href = href
else
href = href
end


title = @title ? @title.gsub('title=', '').gsub("\"", ''): 'Link'
target = @target ? @target : ''
classes = @classes ? @classes : ''




'<a href="'+href+'" '+classes+' target="'+target+'" >'+title+'</a>'
end
end
end

Liquid::Template.register_tag('link', Jekyll::LinkTag)
8 changes: 7 additions & 1 deletion css/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,18 @@
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0d9474', endColorstr='#2a6fa8',GradientType=1 );
}
}
/*
Uncomment this in multiversion
.sidebar-container .inner__sidebar .sidebar-wrapper .sidebar-group {
display:none;
}
}*/
.sidebar-container .inner__sidebar .sidebar-wrapper .section.active .sidebar-group {
display:block;
}
.section-developer-docs.path-apis .sidebar-group{
display:block !important;
}

/* Multiversion - Remove from Here*/
.sidebar-group.architecture,
.sidebar-group.features-documentation,
Expand Down

0 comments on commit 985a6c1

Please sign in to comment.