trulia / hologram

A markdown based documentation system for style guides.
http://trulia.github.io/hologram
Other
2.16k stars 199 forks source link

Local variable categories is undefined #210

Open elijahmurray opened 9 years ago

elijahmurray commented 9 years ago

Running into an issue where it can't find the categories local variable. I looked at #82 however my syntax appears to be correct as I am declaring a category for in my css.

Error message

Adding renderer for haml examples
Adding renderer for html examples
Adding renderer for js examples
Adding renderer for jsx examples
Adding renderer for react examples
Adding renderer for slim examples
(erb):19:in `get_binding': undefined local variable or method `categories' for #<Hologram::TemplateVariables:0x007fb65147da88> (NameError)
  from /Users/gorefi/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/erb.rb:849:in `eval'
  from /Users/gorefi/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/erb.rb:849:in `result'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/lib/hologram/doc_builder.rb:238:in `write_page'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/lib/hologram/doc_builder.rb:194:in `block in write_docs'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/lib/hologram/doc_builder.rb:180:in `each'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/lib/hologram/doc_builder.rb:180:in `write_docs'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/lib/hologram/doc_builder.rb:143:in `build_docs'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/lib/hologram/doc_builder.rb:85:in `build'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/lib/hologram/cli.rb:38:in `build'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/lib/hologram/cli.rb:30:in `run'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/gems/hologram-1.3.1/bin/hologram:6:in `<top (required)>'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/bin/hologram:23:in `load'
  from /Users/gorefi/.rvm/gems/ruby-2.0.0-p247/bin/hologram:23:in `<main>'

./typography.css.scss
/*doc

---
title: Alert
name: alert
category: basics

---
```html_example
<div class='alert'>Hello</div>

*/


---

./hologram_config.yml

Hologram will run from same directory where this config file resides

All paths should be relative to there

The directory containing the source files to parse recursively

source: ./app/assets/stylesheets

The directory that hologram will build to

destination: ./public/styleguide

The assets needed to build the docs (includes header.html,

footer.html, etc)

You may put doc related assets here too: images, css, etc.

documentation_assets: ./doc_assets

The folder that contains templates for rendering code examples.

If you want to change the way code examples appear in the styleguide,

modify the files in this folder

code_example_templates: ./code_example_templates

The folder that contains custom code example renderers.

If you want to create additional renderers that are not provided

by Hologram (i.e. coffeescript renderer, jade renderer, etc)

place them in this folder

code_example_renderers: ./code_example_renderers

Any other asset folders that need to be copied to the destination

folder. Typically this will include the css that you are trying to

document. May also include additional folders as needed.

dependencies:

Mark which category should be the index page

Alternatively, you may have an index.md in the documentation assets

folder instead of specifying this config.

index: basics

To additionally output navigation for top level sections, set the value to

'section'. To output navigation for sub-sections,

set the value to all

nav_level: all

Hologram displays warnings when there are issues with your docs

(e.g. if a component's parent is not found, if the _header.html and/or

_footer.html files aren't found)

If you want Hologram to exit on these warnings, set the value to 'true'

(Default value is 'false')

exit_on_warnings: false

jdcantrell commented 9 years ago

Can you share your header and template files? You may be referencing categories but not checking that it is not nil first. Which will happen if you have erb files or markdown files.