Commit Graph

770 Commits

Author SHA1 Message Date
Yorick Peterse 5e24a3d1e5 Short docs on lexer callback names. 2014-11-23 20:20:14 +01:00
Yorick Peterse 4fa88fcbde Cache rb_intern/symbol lookups in the lexer.
For JRuby this has little to no benefits as it uses strings for method names.
However, both MRI and Rubinius will perform a Symbol lookup whenever rb_intern()
is called. By doing this once for all callback names and caching the resulting
VALUE objects the lexer timings can be reduced by about 25%. In case of the
benchmark benchmark/xml/lexer/string_average_bench.rb this means it runs in
around 500ms instead of 700ms.
2014-11-22 01:53:37 +01:00
Yorick Peterse a10fe855d7 Merge pull request #67 from krasnoukhov/xml-entities
Add missing entities to the decode/encode lists
2014-11-21 01:12:24 +01:00
Dmitry Krasnoukhov 26baf89440 Add missing entities to the decode/encode lists 2014-11-21 01:53:11 +02:00
Yorick Peterse 81c49b5101 Contributing notes on thread-safety/require usage. 2014-11-20 20:09:41 +01:00
Yorick Peterse cbb2815146 Support for inline doctype rules plus newlines.
This adds support for lexing/parsing XML documents that use an IO as input _and_
contain doctype rules with newlines in them.

This fixes #63.
2014-11-18 20:02:55 +01:00
Yorick Peterse f88df486ba README example on using Enumerator for input. 2014-11-17 23:59:30 +01:00
Yorick Peterse b8f9d04b17 Added checksums for v0.2.0 2014-11-17 23:31:40 +01:00
Yorick Peterse ae17e7f137 Clean before building any Gem. 2014-11-17 23:28:57 +01:00
Yorick Peterse 922cee913d Release 0.2.0 2014-11-17 23:26:19 +01:00
Yorick Peterse 6f50e79f15 Added changelog link to the CSS ticket. 2014-11-17 23:24:35 +01:00
Yorick Peterse c4a5e8d4b4 Updated the changelog. 2014-11-17 23:23:13 +01:00
Yorick Peterse 72c8cafcb1 Added README example on using CSS selectors. 2014-11-17 23:21:55 +01:00
Yorick Peterse c253254e24 Prefix version tags with "v".
This makes them stand out as versions a bit more.
2014-11-17 22:42:16 +01:00
Yorick Peterse ad4f650c5d Fixed XML entity encoding/decoding ordering.
Thanks to @krasnoukhov for providing the initial patch, which this commit is
largely based on.

This fixes #49.
2014-11-17 22:39:43 +01:00
Yorick Peterse 675eb562e2 Basic docs on manually creating documents. 2014-11-17 09:13:13 +01:00
Yorick Peterse cd86d5d294 Allow removal of element attributes. 2014-11-17 09:00:40 +01:00
Yorick Peterse 104576b4ad Removed .ruby-version
Oga doesn't really require an exact version during development, so lets get rid
of this.
2014-11-17 00:12:01 +01:00
Yorick Peterse 804646cc5e Don't modify raw namespaces.
When calling Element#available_namespaces the list of namespaces returned by
Element#namespaces must not be modified.
2014-11-17 00:01:16 +01:00
Yorick Peterse a4459c866f Basic docs on using XML namespaces. 2014-11-16 23:59:05 +01:00
Yorick Peterse 6753d6a26d Slightly better docs for the XPath/CSS parsers. 2014-11-16 23:40:19 +01:00
Yorick Peterse 57adabc068 Ensure SAX after_element receives meaningful args
This changes the behaviour of after_element when parsing documents using the SAX
parsing API. Previously it would always receive a nil argument, which is kinda
pointless. This commit changes that by making sure it receives a namespace name
(if any) and the element name.

This fixes #54.
2014-11-16 23:32:32 +01:00
Yorick Peterse 8c8ecce447 Added README note on default namespaces.
This closes #57.
2014-11-16 23:08:32 +01:00
Yorick Peterse 67abe7731e Added CSS selectors to the list of features. 2014-11-16 22:55:44 +01:00
Yorick Peterse e02cb54fa2 Added class/ID selectors to CSS spec. 2014-11-16 22:53:30 +01:00
Yorick Peterse da36c53321 Syntax for wildcard selector in the CSS spec. 2014-11-16 00:36:02 +01:00
Yorick Peterse 3c944f77c9 Added pseudo class syntax to CSS spec. 2014-11-15 21:29:53 +01:00
Yorick Peterse 181a0c3bc8 Added docs on remaining pseudo classes. 2014-11-15 21:20:53 +01:00
Yorick Peterse 02e00019ff Overwrite installation procedure for Travis.
See https://github.com/travis-ci/travis-ci/issues/2821
and https://github.com/rubygems/rubygems/pull/1005.
2014-11-15 19:43:40 +01:00
Yorick Peterse 8b28656087 Cleaned up Travis config. 2014-11-15 19:12:58 +01:00
Yorick Peterse 7990e63678 Use rbx-2 for Travis. 2014-11-15 19:10:43 +01:00
Yorick Peterse 23b408fe4f Cleaned up CSS parser code for counting siblings. 2014-11-15 18:31:08 +01:00
Yorick Peterse 448ff56e38 Fixed CSS eval specs for nth-(first|last)-of-type. 2014-11-15 18:27:26 +01:00
Yorick Peterse b464815577 Fixed AST generation for nth-(first|last)-of-type. 2014-11-15 18:27:15 +01:00
Yorick Peterse 9eead81a7c Fixed AST for :only-of-type 2014-11-15 18:08:26 +01:00
Yorick Peterse 1c301d40e2 Properly fixed AST for first-of-type/last-of-type
This requires keeping track of the current element being processed. This in turn
allows the usage of count() + preceding-sibling/following-sibling.
2014-11-15 17:58:56 +01:00
Yorick Peterse e559b4b89b Corrected :first-of-type eval spec. 2014-11-15 17:20:17 +01:00
Yorick Peterse f1d574f342 Evaluate XPath predicates for every context node.
Instead of evaluating a predicate once for all context nodes, they should
instead be evaluated separately per context node.
2014-11-15 00:31:44 +01:00
Yorick Peterse 6daa3e7a00 Reverted AST changes for first-of-type
Functions can't be used in combination with axes, so I'll just need to fix the
position() function to work properly.
2014-11-14 23:51:46 +01:00
Yorick Peterse 2d6a2be2e8 Revert "Fixed XPath AST for :last-of-type"
Axes can't be used in combination with functions.

This reverts commit b0b572a584.
2014-11-14 23:49:49 +01:00
Yorick Peterse 8f3553f8f1 Fixed eval specs of :first-of-type & :last-of-type 2014-11-14 23:27:52 +01:00
Yorick Peterse b0b572a584 Fixed XPath AST for :last-of-type
This should count following nodes, not merely the position.
2014-11-14 23:27:15 +01:00
Yorick Peterse 0128dc50ae Fixed CSS evaluation of :first-of-type
The old XPath "position() = 1" would work in Nokogiri due to the way they
retrieve descendants. In Oga however this would simply always return the first
node.

To fix this Oga now counts the amount of preceding siblings that match the same
full name.
2014-11-14 01:25:03 +01:00
Yorick Peterse e3a26c5d15 Allow querying of nodes using CSS. 2014-11-14 01:05:29 +01:00
Yorick Peterse 913eb6a15a Added various extra pseudos to the CSS spec. 2014-11-14 01:02:58 +01:00
Yorick Peterse d47ca19ffa Remaining CSS evaluation specs. 2014-11-14 00:24:54 +01:00
Yorick Peterse 518bedc3a1 CSS evaluator specs for :nth-of-type 2014-11-14 00:16:35 +01:00
Yorick Peterse abfe6e3d61 CSS evaluator specs for nth-last-of-type 2014-11-14 00:13:11 +01:00
Yorick Peterse c874ceabb9 CSS evaluator specs for :nth-last-child 2014-11-13 23:54:47 +01:00
Yorick Peterse 5964a2cda4 CSS evaluator specs for :nth-child(n) 2014-11-13 22:50:04 +01:00