- 
                Notifications
    You must be signed in to change notification settings 
- Fork 411
          Allow custom_categories to define a regex or a name for each category child
          #1418
        
          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
Changes from 2 commits
f783f9f
              ac294c6
              e32e2d6
              6714c44
              27627fc
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -49,22 +49,29 @@ def self.group_docs_by_module(docs, type_category_prefix) | |
|  | ||
| def self.group_custom_categories(docs, doc_index) | ||
| group = config.custom_categories.map do |category| | ||
| children = category['children'].map do |name| | ||
| unless doc = doc_index.lookup(name) | ||
| warn 'WARNING: No documented top-level declarations match ' \ | ||
| "name \"#{name}\" specified in categories file" | ||
| next nil | ||
| children = category['children'].map do |selector| | ||
| selected = if selector.is_a?(String) | ||
| unless doc = doc_index.lookup(selector) | ||
| warn 'WARNING: No documented top-level declarations match ' \ | ||
| "name \"#{name}\" specified in categories file" | ||
|          | ||
| [] | ||
| else | ||
| [doc] | ||
| end | ||
| else | ||
| doc_index.lookup_regex(selector['regex']) | ||
| .sort_by { |doc| doc.name.downcase } | ||
|          | ||
| end | ||
|  | ||
| unless doc.parent_in_code.nil? | ||
| warn "WARNING: Declaration \"#{doc.fully_qualified_module_name}\" " \ | ||
| 'specified in categories file exists but is not top-level and ' \ | ||
| 'cannot be included here' | ||
| next nil | ||
| selected.map do |doc| | ||
| unless doc.parent_in_code.nil? | ||
| warn "WARNING: Declaration \"#{doc.fully_qualified_module_name}\" " \ | ||
| 'specified in categories file exists but is not top-level and ' \ | ||
| 'cannot be included here' | ||
| next nil | ||
| end | ||
| docs.delete(doc) | ||
| end | ||
|  | ||
| docs.delete(doc) | ||
| end.compact | ||
| end.flatten.compact | ||
| # Category config overrides alphabetization | ||
| children.each.with_index { |child, i| child.nav_order = i } | ||
| make_group(children, category['name'], '') | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need two spaces at the end of the line (markdown linebreak)