Commit Graph

1238 Commits

Author SHA1 Message Date
Yorick Peterse e086515e59
Release 2.15 2018-04-11 21:42:08 +02:00
Yorick Peterse 8ac0055e42
Allow "th" to occur in thead, tbody, and tfoot
Fixes https://gitlab.com/yorickpeterse/oga/issues/190
2018-04-11 21:32:30 +02:00
Yorick Peterse 6c10f41446
Release 2.14 2018-01-30 22:58:43 +01:00
David Cornu bc87711f9c Return an Enumerator from each* methods when no block is given 2018-01-29 13:12:42 -05:00
Yorick Peterse 0b7b54119b
Release 2.13 2018-01-05 10:29:42 +01:00
Yorick Peterse 886a160c6a
Strip leading/trailing whitespace from CSS exprs
When tokenising CSS expressions we now strip leading and trailing
whitespace from the input string. This is performed without any checks
as a check + `String#strip` ended up being slower compared to just
running `String#strip`. On top of that we cache expressions anyway, so
the overhead of `String#strip` is very small.

Fixes https://gitlab.com/yorickpeterse/oga/issues/187
2018-01-04 22:02:50 +01:00
Yorick Peterse d1336e760a
Disable appveyor Email notifications 2018-01-02 13:23:22 +01:00
Yorick Peterse 952779da39
Use msys64 for installing Ragel 2018-01-02 13:14:55 +01:00
Yorick Peterse a5cb9887b0
Try adding vcpkg bin/ to the PATH 2018-01-02 13:06:06 +01:00
Yorick Peterse 5d693134d7
Try using vcpkg for installing Ragel 2018-01-02 12:44:07 +01:00
Vidur Murali 84748a8d85 Fix typo in gemspec homepage URL 2018-01-02 16:20:52 +05:30
Yorick Peterse e40bd38384
Fixed CHANGELOG typo 2017-12-29 20:42:06 +01:00
Yorick Peterse db00fcdd55
Release 2.12 2017-12-29 20:40:24 +01:00
Yorick Peterse f574197ea6
Ignore nested element start tags
This ensures that Oga is able to tokenize input such as the following:

    <script<script>foo</script>

Oga will now treat this as:

    <script>foo</script>

This is based on libxml behaviour, which seems to differ a bit from
Chromium which treats the node as a text node. This however would
require complex look-ahead logic (as far as I can tell) that I really
don't want to implement in Oga.

Fixes #186
2017-12-28 16:12:20 +01:00
Yorick Peterse 1e002de527
Update CI links
[ci skip]
2017-11-02 14:31:43 +01:00
Yorick Peterse e6eaff1a28
Fix YAML for JRuby builds 2017-11-02 14:13:18 +01:00
Yorick Peterse 11e83f911b
Try to install openjdk for JRuby
This is necessary so "javac" is available.
2017-11-02 14:07:51 +01:00
Yorick Peterse dea9bafee1
Use Ragel without a version
Apparently on some platforms (e.g. the JRuby build) 6.9 breaks things.
2017-11-02 13:24:13 +01:00
Yorick Peterse 9cfd628b55
Install build-base on Alpine
This is necessary to get programs such as "make".
2017-11-02 13:13:57 +01:00
Yorick Peterse 54e3115607
Bundle without nproc on CI
nproc is in coreutils which isn't installed by default. Since the
Gemfile is so small there's no real benefit to using -jX anyway.
2017-11-02 12:56:53 +01:00
Yorick Peterse 794291990e
Use ragel 6.9-r0
Maybe this will work, because apparently just using "ragel=6.9" refuses
to install.
2017-11-02 12:41:46 +01:00
Yorick Peterse de2166eb40
Don't use sudo for Alpine 2017-11-02 12:29:47 +01:00
Yorick Peterse b248cc7c0f
Updated Appveyor config 2017-11-02 12:21:02 +01:00
Yorick Peterse e811b511b0
Fixed the GitLab CI YAML 2017-11-02 02:39:40 +01:00
Yorick Peterse 5d1d7fd1d8
Move to GitLab and GitLab CI 2017-11-02 02:13:00 +01:00
Yorick Peterse f85869ecab
Release 2.11 2017-09-07 00:11:24 +02:00
Loic Nageleisen 39bf7ffaeb Silence method redefinition warnings
As the community progressively moves to a useful practice of enabling
ruby warnings on tests, knowingly redefining a method produces a
distracting warning that has to be special-cased when running automated
tests. We thus skip dynamic definitions of methods we know will be
redefined right after.
2017-09-07 00:03:36 +02:00
Loic Nageleisen 151788abad Silence uninitialized variable warnings
As the community progressively moves to a useful practice of enabling
ruby warnings on tests, assigning an instance variable before use becomes
a necessary practice. Here we set some variables at initialization that
were previously lazily or conditionally set:

- `decoded` is assigned false which seems to make more semantic sense
  than than using nil
- `namespace` is assigned nil, its value being lazily computed later
- `available_namespaces` is assigned nil so as to respect the cache
  invalidation mechanism
2017-09-07 00:03:36 +02:00
hinamiyagk ef1b8d2a28 Fix typo in README 2017-07-11 13:03:52 +02:00
Yorick Peterse d1f46e289c
Reworked the contributing guide a bit
A lot of the stuff in it was rather blunt.
2017-07-07 00:03:48 +02:00
Yorick Peterse 2710976e48
Added note about wanting more patches 2017-07-03 17:58:37 +02:00
Yorick Peterse b5848b07a9
Rename COC.md to make GitHub happy
GitHub only detects CODE_OF_CONDUCT.md.
2017-06-20 17:01:18 +02:00
Yorick Peterse 6f747656b6
Use RSpec 3 expect syntax for tests
This should make it a little bit easier for others to contribute.
2017-06-17 13:52:43 +02:00
Yorick Peterse 8282325569
Don't warn for implicit fallthroughs
This is the result of Ragel output which we can't control.
2017-06-17 13:46:59 +02:00
Yorick Peterse 8dc2318020
Release 2.10 2017-04-18 12:56:24 +02:00
Yorick Peterse 84c4db3e9f
Clean up changes from PR #174 2017-04-18 12:55:11 +02:00
PikachuEXE 4250033ed5 Update CHANGELOG
[ci skip]
2017-04-18 12:51:34 +02:00
PikachuEXE 21b5eeec4b Fix using symbol on Element#attribute alwas getting nil 2017-04-18 12:51:34 +02:00
Yorick Peterse e9953d4212
Release 2.9 2017-02-10 15:59:15 +01:00
Yorick Peterse 673f4a29db
Use HTML5 style closing tags for void elements
This ensures that element tags such as <img> tags don't use a closing />
when documents are parsed as HTML documents.

Fixes #170
2017-02-10 15:24:41 +01:00
Yorick Peterse 131fba7aed
Doctype inherits from Node
This makes it possible to parse documents where a doctype resides in a
node, instead of being located at the root.

Fixes #169
2017-02-10 15:10:30 +01:00
Yorick Peterse b13cfdfea5
Release 2.8 2017-01-04 12:28:37 +01:00
Yorick Peterse 5b4d295912
Nuke old Rubies from CI configuration 2017-01-04 00:12:10 +01:00
Po Shan Cheah c75ca96d22 Ruby 2.4 Fixnum deprecation
In Ruby 2.4, Fixnum is deprecated and the following produces a warning:

$ irb
irb(main):001:0> puts RUBY_VERSION
2.4.0
=> nil
irb(main):002:0> require 'oga'
=> true
irb(main):003:0> Oga.parse_xml('<people><person>Alice</person></people>').css(':nth-child(1)')
/Users/pcheah/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/oga-2.7/lib/oga/xpath/conversion.rb:79: warning: constant ::Fixnum is deprecated
=> NodeSet(Element(name: "people" children: NodeSet(Element(name: "person" children: NodeSet(Text("Alice"))))), Element(name: "person" children: NodeSet(Text("Alice"))))
irb(main):004:0>
$

So oga/xpath/conversion.rb needs to test for Integer instead of Fixnum.

Also, it appears that json 1.8.3 no longer builds under Ruby 2.4, so the gemfile has to be upgraded to json 2.0.
2017-01-03 21:38:04 +01:00
Yorick Peterse f5370c35d2
Release 2.7 2016-09-27 11:54:27 +02:00
Yorick Peterse e0e0687dc2
Generating closing element & Doctype XML
This commit fixes two problems:

1. Doctypes introducing too many newlines
2. Elements with siblings and a common parent not being closed properly

== Doctypes

When generating the XML for a doctype the XML::Generator class would
append a trailing newline. This however meant that if the next text node
was also a newline you'd now have two newlines. In previous versions of
Oga this worked because the old XML generation code would call
String#strip on the XML to add after the doctype.

To support this in the new version we perform a lookahead in
XML::Generator#on_doctype to remove any trailing newlines added by this
method in case the first child node is a newline text node.

== Closing Elements

When an element has a sibling following it _and_ does not have any child
nodes it would not be closed properly when generating XML. This is due
to the "until next_node = ..." expression evaluating to true, thus never
executing its body.

There's probably some way to work around this by using the "loop"
method, but considering it's 02:09 I think the current approach is good
enough. Future me will probably hate me for it.
2016-09-27 02:10:16 +02:00
Yorick Peterse 01fa1513f4
Lexing of processing instructions with namespaces
This adds lexing/parsing support for processing instructions that
contain namespace prefixes such as `<?foo:bar ?>`.
2016-09-17 14:51:48 +02:00
Yorick Peterse 116b9b0ceb
Make XmlDeclaration a ProcessingInstruction
This allows Oga to parse documents that contain an XML declaration at a
place other than at the document root. Oga still only assigns the XML
declaration to the document whenever it is at the top-level. This
matches libxml/XML specification behaviour as far as I can tell.
2016-09-17 14:39:07 +02:00
Scott Wheeler d40baf0c72 Add aliases for accessing attributes via [] and []=
This also fixes accessing attributes via symbol name and tests to ensure
that such does not break in the future.
2016-09-14 15:21:46 +03:00
Yorick Peterse b8fd8670df
Release 2.6 2016-09-10 02:50:02 +02:00