Changeset 8955
- Timestamp:
- 02/29/08 14:30:20 (2 years ago)
- Files:
-
- spinoffs/pdoc/trunk/CHANGELOG (modified) (1 diff)
- spinoffs/pdoc/trunk/lib/p_doc/parser/description_nodes.rb (modified) (2 diffs)
- spinoffs/pdoc/trunk/lib/p_doc/parser/documentation_nodes.rb (modified) (1 diff)
- spinoffs/pdoc/trunk/lib/p_doc/parser/treetop_files/documentation.treetop (modified) (4 diffs)
- spinoffs/pdoc/trunk/test/fixtures/ajax.js (modified) (2 diffs)
- spinoffs/pdoc/trunk/test/unit/documentation_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/pdoc/trunk/CHANGELOG
r8954 r8955 1 * Add support for events (syntax subject to change) [Tobie] 2 1 3 * More consistency [Tobie] 2 4 spinoffs/pdoc/trunk/lib/p_doc/parser/description_nodes.rb
r8944 r8955 7 7 8 8 def join(sep = "\n") 9 to_a.join(sep) 9 to_a.join(sep).strip 10 10 end 11 11 … … 15 15 16 16 def inspect 17 text = truncate(15).gsub(/\n/, " "). inspect17 text = truncate(15).gsub(/\n/, " ").strip.inspect 18 18 "#<#{self.class} #{text}>" 19 19 end spinoffs/pdoc/trunk/lib/p_doc/parser/documentation_nodes.rb
r8954 r8955 228 228 arguments_descriptions.elements 229 229 end 230 231 def fires 232 event.respond_to?("name") ? event.name.text_value : nil 233 end 230 234 end 231 235 spinoffs/pdoc/trunk/lib/p_doc/parser/treetop_files/documentation.treetop
r8954 r8955 19 19 20 20 rule constructor_doc 21 start ebnf:(line constructor)+ arguments_descriptions text comment_end <Constructor>21 start ebnf:(line constructor)+ arguments_descriptions event text comment_end <Constructor> 22 22 end 23 23 … … 31 31 32 32 rule klass_method_doc 33 start ebnf:(line klass_method)+ arguments_descriptions text comment_end <KlassMethod>33 start ebnf:(line klass_method)+ arguments_descriptions event text comment_end <KlassMethod> 34 34 end 35 35 36 36 rule instance_method_doc 37 start ebnf:(line instance_method)+ arguments_descriptions text comment_end <InstanceMethod>37 start ebnf:(line instance_method)+ arguments_descriptions event text comment_end <InstanceMethod> 38 38 end 39 39 … … 51 51 52 52 rule utility_doc 53 start ebnf:(line utility)+ arguments_descriptions text comment_end <Utility>53 start ebnf:(line utility)+ arguments_descriptions event text comment_end <Utility> 54 54 end 55 55 … … 65 65 argument_description* 66 66 end 67 68 rule event 69 (line 'fires ' name:([a-zA-Z]+ (':' [a-zA-Z]+)*))? 70 end 67 71 end spinoffs/pdoc/trunk/test/fixtures/ajax.js
r8953 r8955 45 45 * - styles (String, Object, Hash): can be either a regular CSS string or 46 46 * a hash or regular object, in which case, properties need to be camelized 47 * fires element:style:updated 48 * 47 49 * Sets the style of element 48 50 * and returns it … … 57 59 /** alias of: Element#foo 58 60 * Element#bar() -> Element 61 * fires click 59 62 **/ 60 63 spinoffs/pdoc/trunk/test/unit/documentation_test.rb
r8954 r8955 454 454 end 455 455 456 def test_event 457 assert_equal "element:style:updated", fixtures.find_by_name("Element#setStyle").fires 458 assert_equal nil, fixtures.find_by_name("Element#foo").fires 459 assert_equal "click", fixtures.find_by_name("Element#bar").fires 460 end 461 456 462 def test_aliases 457 463 fixture = fixtures.find_by_name("Element#setStyle")