Skip to content

Commit

Permalink
improved doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Guido De Rosa committed Sep 27, 2010
1 parent 42e28b3 commit 5ad706c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.rdoc
Expand Up @@ -12,11 +12,13 @@ planned) with optional JavaScript show/hide.
Simple example:

root.add_path('/aaa/bbb/ccc/eee', {
:name => 'test2',
:href => '/xxx/yyy/2.html',
# all keys are optional
:name => 'test2',
:href => '/xxx/yyy/2.html',
:extra_class => 'my-css-class'
})

With HTML list generator:
HTML list generator:

html_ul_simple = root.to_html_ul

Expand All @@ -25,15 +27,19 @@ You can add any extra/custom information:
root.add_path('/aaa/bbb/ccc/ddd', {
:name => 'test1',
:href => '/xxx/yyy/zzz.html',
:extra_info => Object.new
:custom_info => Object.new
})

And then match within a code block to ``mangle'' the output:

html_ul = root.to_html_ul do |node, output|
output[:name] += ' (extra_info is just an Object)' if
node.content.respond_to? :[] and
node.content[:extra_info].class == Object
html_ul = root.to_html_ul do |node, output| # code block is optional!
if
node.content.respond_to? :[] and
node.content[:custom_info].class == Object

output[:name] += ' (extra_info is just an Object)' # edit text
output[:extra_class] = 'hmenu-selected' # add a CSS class
output[:href] = nil # turn off hyperref
end

Some Style (HMenu::CSS), and some JavaScript code (HMenu::JS) to show/hide
Expand Down

0 comments on commit 5ad706c

Please sign in to comment.