Skip to content

rename for clarity #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Dotenv.load

SIDENAV_INDEX_DEFAULT_TITLE = 'Overview'
SIDENAV_FILE_BLACKLIST = [
'./vendor/**/*.md',
'./connections/**/**.md',
'./*.md',
'./vendor/**/*.md',
'./connections/**/**.md',
'./*.md',
'./_*/**/*.md'
]

Expand All @@ -19,7 +19,7 @@ namespace :nav do
desc 'Updates _data/sidenav.yml based on the current available docs'
task :update do
unless ENV['FORCE_NAV_UPDATE']
p "WARNING. This a destructive action and will break the current sidenav. Re-run with FORCE_NAV_UPDATE=1 if you are sure you want to do this"
p "WARNING. This a destructive action and will break the current sidenav. Re-run with FORCE_NAV_UPDATE=1 if you are sure you want to do this"
exit
end

Expand All @@ -32,14 +32,14 @@ namespace :nav do
paths = file_list.to_s
.split('/')
.reject { |p| p == '.'}


if paths.size == 0 || paths.size > 3
# Not a valid path or some deep-nested directory structure we don't support
p "skipping #{paths.join("/")}"
next
end

root = paths[0]
k = root

Expand All @@ -58,7 +58,7 @@ namespace :nav do
sections[k] ||= { 'section_title' => root.capitalize, 'section' => [{ 'path' => "/#{root}", 'title' => SIDENAV_INDEX_DEFAULT_TITLE}] }

# Skip the index e.g overview page for each section since we are setting it above
if paths.join("/") == "#{root}/index.md"
if paths.join("/") == "#{root}/index.md"
p "skipping #{paths.join("/")}"
next
else
Expand Down Expand Up @@ -114,9 +114,9 @@ namespace :nav do
partners_nav = { 'sections' => partners_sections.values }

# Main sidenav
File.open("./_data/sidenav/default.yml","w") do |file|
File.open("./_data/sidenav/main.yml","w") do |file|
file.write main_nav.to_yaml({ indention: 4, separator: '' })
end
end

# Legal sidenav
File.open("./_data/sidenav/legal.yml","w") do |file|
Expand Down Expand Up @@ -214,7 +214,7 @@ def get_catalog(url:, page_token: "")
req.headers['Content-Type'] = 'application/json'
req.headers['Authorization'] = "Bearer #{ENV["PLATFORM_API_TOKEN"]}"
end


JSON.parse(resp.body)
end
end
File renamed without changes.
2 changes: 1 addition & 1 deletion _includes/sidenav.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
{% comment %}
Basic Sidenav
{% endcomment %}
{% include sidenav/default.html %}
{% include sidenav/main.html %}
{% endif %}
</nav>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
Home
</a>
</li>
{% for root_section in site.data.sidenav.default.sections %}
{% for root_section in site.data.sidenav.main.sections %}
{% assign title = root_section.section_title %}

{% if title == "Segment-app" %}
{% assign title = "App" %}
{% endif %}

{% assign slug = title | downcase %}
{% assign root = page.url | remove: '.html' | split: '/' %}
{% assign klass = "section" %}

{% if root[1] == slug or (root[1] == "segment-app" and slug == "app") %}
{% assign klass = "section expanded" %}
{% endif %}
Expand Down Expand Up @@ -98,4 +98,4 @@
</li>
</ul>
</li>
</ul>
</ul>