bryanbraun / middleman-navtree Goto Github PK
View Code? Open in Web Editor NEWFor building navigation trees & menus in Middleman.
License: MIT License
For building navigation trees & menus in Middleman.
License: MIT License
I'm using franklin as an Embedded Help portal for an app. The app url-matches files in the build root to the same root php pages the app uses. These are the "gateway" into the embedded help for each page.
For example, index.php is url-matched to index.html.
If I use the recommendation of naming files 01-index.adoc this will break the url-matching for index.php
middleman-navtree is sorting folders alphabetically along with filenames, and I'm wondering if a sort option could be put in to control how folders are sorted at the source root?
Perhaps something like options.sort_folders_navtree = [top | bottom]
which would allow the folder list to appear at the top of the navtree or the bottom of the navtree?
I was thinking that I could store the "gateway pages" in a /pages
directory and then do a post build task to move them, but I'm pretty sure it would break all the file interlinking I have inside the source files.
Any ideas would be greatly appreciated.
middleman-navtree automatically (over)writes a tree.yml
reflecting the structure in /source
which is great. What is the recommened way of maintaining a custom structure? Say a different ordering if you're files aren't prefixed with a number.
Copy/paste the tree.yml, duplicate it and modify it and reference it in config.rb in the navtree settings?
And thanks for the great plugin!
This gem does not currently support directory indexes. That means that directory names cannot be links, only non-linked containers for grouping links.
Some people have use cases where linked directory names would be nice. Resolving this issue would fix:
Approach
It would be nice for this to smartly detect if a directory has an index file, but we can't as it's built right now. It's currently a recursive function that always creates the directory markup as a non-linked item. By the time we've entered a directory to see if it has an index file, the markup for the parent has already been written. We have to figure out a way to refactor this, or set directory indexes as an configurable option. The configurable option thing is kind of a bummer. It could be made a bit more smart by listening in for Middleman's activate :directory_indexes
and swapping modes accordingly.
I'm open to suggestions. Not sure on the timeline of when I can address this, but it is a feature I'm interested in, if anybody wants to take a crack at it.
I'm struggling to figure out what's causing this error when I run build -
NoMethodError at / undefined method `tree_to_html'
I'm using Middleman with Haml, and admit to being fairly new to ruby, rubygems as well as Haml...
The tree.yml file has been built, suggesting the gem is installed properly.
I'm testing the treenav in my master layout file, which is in Haml, but I don't see how this would make a difference:
%ul
= tree_to_html(data.tree)
I'm running ruby 2.0 on Windows.
Any pointers would be much appreciated!
This gem doesn't have testing infrastructure in place. For example it needs a folder structure, a ruby-based testing tool, an example test, and some way to run the tests.
I'm not too familiar with what's the best setup for this in the Ruby & Gem ecosystem (in 2016). Can somebody make a recommendation, and help set it up?
Issue originally reported by @morberg.
I pushed two new directories, one with and one without accented characters, to my starter book and the one with a file name containing 'ä' ends up with an incorrect link in the navigation (links to http://morberg.github.io/Äccented/äccented.html instead of http://morberg.github.io/starter-book/Äccented/äccented.html). Manually entering the correct link works fine.
Hi, if you change the name of the default source
dir from source
to anything else, the build fails.
$ middleman build
WARN: Unresolved specs during Gem::Specification.reset:
json (>= 1.7.7, ~> 1.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Library/Ruby/Gems/2.0.0/gems/middleman-navtree-0.1.8/lib/middleman-navtree/extension.rb:63:in `open': No such file or directory - source (Errno::ENOENT)
from /Library/Ruby/Gems/2.0.0/gems/middleman-navtree-0.1.8/lib/middleman-navtree/extension.rb:63:in `foreach'
from /Library/Ruby/Gems/2.0.0/gems/middleman-navtree-0.1.8/lib/middleman-navtree/extension.rb:63:in `scan_directory'
from /Library/Ruby/Gems/2.0.0/gems/middleman-navtree-0.1.8/lib/middleman-navtree/extension.rb:46:in `after_configuration'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/extension.rb:131:in `block in bind_after_configuration'
from /Library/Ruby/Gems/2.0.0/gems/uber-0.0.8/lib/uber/options.rb:80:in `instance_exec'
from /Library/Ruby/Gems/2.0.0/gems/uber-0.0.8/lib/uber/options.rb:80:in `proc!'
from /Library/Ruby/Gems/2.0.0/gems/uber-0.0.8/lib/uber/options.rb:69:in `evaluate_for'
from /Library/Ruby/Gems/2.0.0/gems/uber-0.0.8/lib/uber/options.rb:60:in `evaluate'
from /Library/Ruby/Gems/2.0.0/gems/hooks-0.4.0/lib/hooks/hook.rb:53:in `execute_callback'
from /Library/Ruby/Gems/2.0.0/gems/hooks-0.4.0/lib/hooks/hook.rb:40:in `block in run'
from /Library/Ruby/Gems/2.0.0/gems/hooks-0.4.0/lib/hooks/hook.rb:39:in `each'
from /Library/Ruby/Gems/2.0.0/gems/hooks-0.4.0/lib/hooks/hook.rb:39:in `inject'
from /Library/Ruby/Gems/2.0.0/gems/hooks-0.4.0/lib/hooks/hook.rb:39:in `run'
from /Library/Ruby/Gems/2.0.0/gems/hooks-0.4.0/lib/hooks.rb:55:in `run_hook_for'
from /Library/Ruby/Gems/2.0.0/gems/hooks-0.4.0/lib/hooks/instance_hooks.rb:6:in `run_hook'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/core_extensions/extensions.rb:179:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/core_extensions/data.rb:33:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/application.rb:188:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/core_extensions/request.rb:49:in `new'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/core_extensions/request.rb:49:in `inst'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/cli/build.rb:95:in `shared_instance'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/cli/build.rb:62:in `build'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/cli.rb:72:in `method_missing'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:29:in `run'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:126:in `run'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/lib/middleman-core/cli.rb:20:in `start'
from /Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.4/bin/middleman:18:in `<top (required)>'
from /usr/bin/middleman:23:in `load'
from /usr/bin/middleman:23:in `<main>'
Any chance of implementing an option to order links within directories based on data stored in page frontmatter (i.e. 'priority' or 'order')? Alpha Numeric ordering isn't always ideal.
I have the following tree:
fr:
beginner:
0-index.md: /fr/beginner/0-index.md
1-introduction.md: /fr/beginner/1-introduction.md
2-start-osm.md: /fr/beginner/2-start-osm.md
3-start-josm.md: /fr/beginner/3-start-josm.md
4-josm-plugins.md: /fr/beginner/4-josm-plugins.md
5-gps.md: /fr/beginner/5-gps.md
6-papers.md: /fr/beginner/6-papers.md
7-editing-with-josm.md: /fr/beginner/7-editing-with-josm.md
8-aerial-imagery-considerations.md: /fr/beginner/8-aerial-imagery-considerations.md
9-moving-forward.md: /fr/beginner/9-moving-forward.md
intermediate:
edit-in-detail-osm.md: /fr/intermediate/edit-in-detail-osm.md
With depth=1, the following code display nothing:
<%= tree_to_html(data.tree['fr'], 1) %>
But it should display:
Beginner
Intermediate
With depth=2, the result is good:
<%= tree_to_html(data.tree['fr'], 2) %>
Beginner
Guide du débutant
Introduction
Introduction à OpenStreetMap.org
Premiers pas avec JOSM
Préférences et greffons JOSM
Sur le terrain avec un GPS
Étude de terrain avec les Field Papers
Éditer avec JOSM
Utiliser l'imagerie aérienne
Pour aller plus loin
Intermediate
Edition avancée
Note: This is the tree corresponding to this guide (generate by jekyll): http://learnosm.org/fr/beginner/
Labels Previous and Next of Pagination helpers need to be localized
I have multiple files named index.html.erb
that act as directory indexes for various folders throughout my site.
I noticed NavTree incorrectly associated my site's root index.html.erb
with /work/client-1/index.erb.html
below and then skips every other folder that uses that same file name:
---
index.html.erb: /work/client-1/index.html.erb
contact: {}
documentation:
defaults.html.erb: /documentation/defaults.html.erb
partials:
_head.erb: /documentation/partials/_head.erb
_modules_nav.erb: /documentation/partials/_modules_nav.erb
favicon.ico: /favicon.ico
modules:
contact_card.erb: /modules/contact_card.erb
copy_block.erb: /modules/copy_block.erb
featured_media.erb: /modules/featured_media.erb
resume: {}
work:
client-2:
project-a: {}
client-3:
project-b: {}
client-4:
project-c: {}
client-1:
project-d: {}
project-e: {}
We need to get some automated tests in place for the basic functionality here.
This issue depends on setting up testing infrastructure in #18.
I don't actively work with projects that use this Gem anymore, and as a result, I've done a poor job of continuing to maintain it.
If anybody would like to take over maintaining this Gem, chime in below. Happy to add you to the project, transfer the repo or whatever else makes sense.
index.md are not associated with the parent folder to display his name (and eventually a content)
The following tree is generated:
fr:
beginner:
index.md: /fr/beginner/index.md
1-introduction.md: /fr/beginner/1-introduction.md
…
intermediate:
index.md: /fr/intermediate/index.md
edit-in-detail-osm.md: /fr/intermediate/edit-in-detail-osm.md
… with the following html:
Beginner
Guide du débutant
Introduction
…
Intermediate
Guides intermédiaires
Edition avancée
But it should generate:
fr:
beginner: /fr/beginner/index.md
1-introduction.md: /fr/beginner/1-introduction.md
…
intermediate: /fr/intermediate/index.md
edit-in-detail-osm.md: /fr/intermediate/edit-in-detail-osm.md
… with the following html:
Guide du débutant
Introduction
…
Guides intermédiaires
Edition avancée
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.