Do matching in sidebar_current via regex or equal sign

This commit is contained in:
Radek Simko 2015-05-08 10:28:26 +01:00
parent f1ae920aa9
commit dfae8e1170
17 changed files with 26 additions and 26 deletions

View File

@ -3,7 +3,7 @@ module SidebarHelpers
# if the YAML frontmatter matches the expected value.
def sidebar_current(expected)
current = current_page.data.sidebar_current || ""
if current.start_with?(expected)
if current == expected or (expected.is_a?(Regexp) and expected.match(current))
return " class=\"active\""
else
return ""

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/atlas/index.html">Atlas Provider</a>
</li>
<li<%= sidebar_current("docs-atlas-resource") %>>
<li<%= sidebar_current(/^docs-atlas-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-atlas-resource-artifact") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/aws/index.html">AWS Provider</a>
</li>
<li<%= sidebar_current("docs-aws-resource") %>>
<li<%= sidebar_current(/^docs-aws-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-aws-resource-autoscale") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/cloudflare/index.html">CloudFlare Provider</a>
</li>
<li<%= sidebar_current("docs-cloudflare-resource") %>>
<li<%= sidebar_current(/^docs-cloudflare-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-cloudflare-resource-record") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/cloudstack/index.html">CloudStack Provider</a>
</li>
<li<%= sidebar_current("docs-cloudstack-resource") %>>
<li<%= sidebar_current(/^docs-cloudstack-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-cloudstack-resource-disk") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/consul/index.html">Consul Provider</a>
</li>
<li<%= sidebar_current("docs-consul-resource") %>>
<li<%= sidebar_current(/^docs-consul-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-consul-resource-keys") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/do/index.html">DigitalOcean Provider</a>
</li>
<li<%= sidebar_current("docs-do-resource") %>>
<li<%= sidebar_current(/^docs-do-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-do-resource-domain") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/dme/index.html">DNSMadeEasy Provider</a>
</li>
<li<%= sidebar_current("docs-dme-resource") %>>
<li<%= sidebar_current(/^docs-dme-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-dme-resource-record") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/dnsimple/index.html">DNSimple Provider</a>
</li>
<li<%= sidebar_current("docs-dnsimple-resource") %>>
<li<%= sidebar_current(/^docs-dnsimple-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-dnsimple-resource-record") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/docker/index.html">Docker Provider</a>
</li>
<li<%= sidebar_current("docs-docker-resource") %>>
<li<%= sidebar_current(/^docs-docker-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-docker-resource-container") %>>

View File

@ -6,7 +6,7 @@
<a href="/docs/index.html">Documentation Home</a>
</li>
<li<%= sidebar_current("docs-config") %>>
<li<%= sidebar_current(/^docs-config/) %>>
<a href="/docs/configuration/index.html">Configuration</a>
<ul class="nav">
<li<%= sidebar_current("docs-config-load") %>>
@ -52,7 +52,7 @@
</ul>
</li>
<li<%= sidebar_current("docs-commands") %>>
<li<%= sidebar_current(/^docs-commands/) %>>
<a href="/docs/commands/index.html">Commands (CLI)</a>
<ul class="nav">
<li<%= sidebar_current("docs-commands-apply") %>>
@ -105,7 +105,7 @@
</ul>
</li>
<li<%= sidebar_current("docs-state") %>>
<li<%= sidebar_current(/^docs-state/) %>>
<a href="/docs/state/index.html">State</a>
<ul class="nav">
<li<%= sidebar_current("docs-state-remote") %>>
@ -114,7 +114,7 @@
</ul>
</li>
<li<%= sidebar_current("docs-providers") %>>
<li<%= sidebar_current(/^docs-providers/) %>>
<a href="/docs/providers/index.html">Providers</a>
<ul class="nav">
<li<%= sidebar_current("docs-providers-atlas") %>>
@ -175,7 +175,7 @@
</ul>
</li>
<li<%= sidebar_current("docs-provisioners") %>>
<li<%= sidebar_current(/^docs-provisioners/) %>>
<a href="/docs/provisioners/index.html">Provisioners</a>
<ul class="nav">
<li<%= sidebar_current("docs-provisioners-connection") %>>
@ -196,7 +196,7 @@
</ul>
</li>
<li<%= sidebar_current("docs-modules") %>>
<li<%= sidebar_current(/^docs-modules/) %>>
<a href="/docs/modules/index.html">Modules</a>
<ul class="nav">
<li<%= sidebar_current("docs-modules-usage") %>>
@ -213,7 +213,7 @@
</ul>
</li>
<li<%= sidebar_current("docs-plugins") %>>
<li<%= sidebar_current(/^docs-plugins/) %>>
<a href="/docs/plugins/index.html">Plugins</a>
<ul class="nav">
<li<%= sidebar_current("docs-plugins-basics") %>>
@ -226,7 +226,7 @@
</ul>
</li>
<li<%= sidebar_current("docs-internals") %>>
<li<%= sidebar_current(/^docs-internals/) %>>
<a href="/docs/internals/index.html">Internals</a>
<ul class="nav">
<li<%= sidebar_current("docs-internals-debug") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/google/index.html">Google Provider</a>
</li>
<li<%= sidebar_current("docs-google-resource") %>>
<li<%= sidebar_current(/^docs-google-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-google-resource-address") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/heroku/index.html">Heroku Provider</a>
</li>
<li<%= sidebar_current("docs-heroku-resource") %>>
<li<%= sidebar_current(/^docs-heroku-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-heroku-resource-addon") %>>

View File

@ -10,7 +10,7 @@
<a href="/intro/use-cases.html">Use Cases</a>
</li>
<li<%= sidebar_current("vs-other") %>>
<li<%= sidebar_current(/^vs-other/) %>>
<a href="/intro/vs/index.html">Terraform vs. Other Software</a>
<ul class="nav">
<li<%= sidebar_current("vs-other-chef") %>>
@ -31,7 +31,7 @@
</ul>
</li>
<li<%= sidebar_current("gettingstarted") %>>
<li<%= sidebar_current(/^gettingstarted/) %>>
<a href="/intro/getting-started/install.html">Getting Started</a>
<ul class="nav">
<li<%= sidebar_current("gettingstarted-install") %>>
@ -80,7 +80,7 @@
</ul>
</li>
<li<%= sidebar_current("examples") %>>
<li<%= sidebar_current(/^examples/) %>>
<a href="/intro/examples/index.html">Example Configurations</a>
<ul class="nav">
<li<%= sidebar_current("examples-aws") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/mailgun/index.html">Mailgun Provider</a>
</li>
<li<%= sidebar_current("docs-mailgun-resource") %>>
<li<%= sidebar_current(/^docs-mailgun-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-mailgun-resource-domain") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/openstack/index.html">OpenStack Provider</a>
</li>
<li<%= sidebar_current("docs-openstack-resource") %>>
<li<%= sidebar_current(/^docs-openstack-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-openstack-resource-blockstorage-volume-v1") %>>

View File

@ -10,7 +10,7 @@
<a href="/docs/providers/template/index.html">Template Provider</a>
</li>
<li<%= sidebar_current("docs-template-resource") %>>
<li<%= sidebar_current(/^docs-template-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-template-resource-file") %>>