oga 1.3.1-java → 2.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,6 +53,9 @@
53
53
  ident_char = unicode | [a-zA-Z0-9\-_\.];
54
54
  identifier = ident_char+;
55
55
 
56
+ html_ident_char = unicode | [a-zA-Z0-9\-_\.:];
57
+ html_identifier = html_ident_char+;
58
+
56
59
  whitespace_or_newline = whitespace | newline;
57
60
 
58
61
  action count_newlines {
@@ -390,12 +393,23 @@
390
393
  # Machine used for lexing the name/namespace of an element.
391
394
  element_name := |*
392
395
  identifier ':' => {
393
- callback(id_on_element_ns, data, encoding, ts, te - 1);
396
+ if ( !html_p )
397
+ {
398
+ callback(id_on_element_ns, data, encoding, ts, te - 1);
399
+ }
394
400
  };
395
401
 
396
402
  identifier => {
397
403
  callback(id_on_element_name, data, encoding, ts, te);
398
- fnext element_head;
404
+
405
+ if ( html_p )
406
+ {
407
+ fnext html_element_head;
408
+ }
409
+ else
410
+ {
411
+ fnext element_head;
412
+ }
399
413
  };
400
414
  *|;
401
415
 
@@ -508,8 +522,33 @@
508
522
  any => hold_and_return;
509
523
  *|;
510
524
 
511
- # Machine used for processing the contents of an element's starting tag.
512
- # This includes the name, namespace and attributes.
525
+ action start_attribute_pre {
526
+ fcall attribute_pre;
527
+ }
528
+
529
+ action close_open_element {
530
+ callback_simple(id_on_element_open_end);
531
+
532
+ if ( html_script_p() )
533
+ {
534
+ fnext html_script;
535
+ }
536
+ else if ( html_style_p() )
537
+ {
538
+ fnext html_style;
539
+ }
540
+ else
541
+ {
542
+ fnext main;
543
+ }
544
+ }
545
+
546
+ action close_self_closing_element {
547
+ callback_simple(id_on_element_end);
548
+ fnext main;
549
+ }
550
+
551
+ # Machine used for processing the contents of an XML element's starting tag.
513
552
  element_head := |*
514
553
  newline => advance_newline;
515
554
 
@@ -522,12 +561,30 @@
522
561
  callback(id_on_attribute, data, encoding, ts, te);
523
562
  };
524
563
 
525
- # Attribute values.
526
- '=' => {
527
- fcall attribute_pre;
564
+ '=' => start_attribute_pre;
565
+
566
+ '>' => {
567
+ callback_simple(id_on_element_open_end);
568
+
569
+ fnext main;
528
570
  };
529
571
 
530
- # We're done with the open tag of the element.
572
+ '/>' => close_self_closing_element;
573
+
574
+ any;
575
+ *|;
576
+
577
+ # Machine used for processing the contents of an HTML element's starting
578
+ # tag.
579
+ html_element_head := |*
580
+ newline => advance_newline;
581
+
582
+ html_identifier => {
583
+ callback(id_on_attribute, data, encoding, ts, te);
584
+ };
585
+
586
+ '=' => start_attribute_pre;
587
+
531
588
  '>' => {
532
589
  callback_simple(id_on_element_open_end);
533
590
 
@@ -545,11 +602,7 @@
545
602
  }
546
603
  };
547
604
 
548
- # Self closing tags.
549
- '/>' => {
550
- callback_simple(id_on_element_end);
551
- fnext main;
552
- };
605
+ '/>' => close_self_closing_element;
553
606
 
554
607
  any;
555
608
  *|;
data/lib/liboga.jar CHANGED
Binary file
data/lib/oga/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oga
2
- VERSION = '1.3.1'
2
+ VERSION = '2.0.0'
3
3
  end # Oga
@@ -64,7 +64,11 @@ module Oga
64
64
  #
65
65
  # @return [Oga::XML::Attribute]
66
66
  def attribute(name)
67
- name, ns = split_name(name)
67
+ if html?
68
+ ns = nil
69
+ else
70
+ name, ns = split_name(name)
71
+ end
68
72
 
69
73
  attributes.each do |attr|
70
74
  return attr if attribute_matches?(attr, ns, name)
@@ -89,7 +89,7 @@ module Oga
89
89
 
90
90
  # @return [TrueClass|FalseClass]
91
91
  def self.boolean?(value)
92
- value.is_a?(TrueClass) || value.is_a?(FalseClass)
92
+ value == true || value == false
93
93
  end
94
94
 
95
95
  # @param [Oga::XML::NodeSet] set
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oga
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 2.0.0
5
5
  platform: java
6
6
  authors:
7
7
  - Yorick Peterse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-07 00:00:00.000000000 Z
11
+ date: 2015-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -229,4 +229,3 @@ signing_key:
229
229
  specification_version: 4
230
230
  summary: Oga is an XML/HTML parser written in Ruby.
231
231
  test_files: []
232
- has_rdoc: yard