Skip to content

Commit

Permalink
fix: in Nokogiri >= v1.17.0, use SAX::Document#reference
Browse files Browse the repository at this point in the history
This works around the issues reported at:

- sparklemotion/nokogiri#1926
- sparklemotion/nokogiri#3147

Closes searls#10.
  • Loading branch information
flavorjones committed Jun 30, 2024
1 parent e43c5a1 commit 04cdbda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/eiwa/jmdict/doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def characters(s)
@current.add_characters(s)
end

def reference(name, content)
@current.set_entity(name, content)
end

# def comment string
# puts "comment #{string}"
# end
Expand All @@ -62,6 +66,7 @@ def characters(s)
# end

def error(msg)
# TODO: This logic can be removed once we pin to Nokogiri >= 1.17.0
if (matches = msg.match(/Entity '(\S+)' not defined/))
# See: http://github.com/sparklemotion/nokogiri/issues/1926
code = matches[1]
Expand Down
5 changes: 3 additions & 2 deletions lib/eiwa/jmdict/entities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Jmdict
"adj-ku" => "`ku' adjective (archaic)",
"adj-na" => "adjectival nouns or quasi-adjectives (keiyodoshi)",
"adj-nari" => "archaic/formal form of na-adjective",
"adj-no" => "nouns which may take the genitive case particle `no'",
"adj-no" => "nouns which may take the genitive case particle 'no'",
"adj-pn" => "pre-noun adjectival (rentaishi)",
"adj-shiku" => "`shiku' adjective (archaic)",
"adj-t" => "`taru' adjective",
Expand All @@ -34,7 +34,7 @@ module Jmdict
"chem" => "chemistry term",
"chn" => "children's language",
"col" => "colloquialism",
"comp" => "computer terminology",
"comp" => "computing",
"conj" => "conjunction",
"cop" => "copula",
"cop-da" => "copula",
Expand Down Expand Up @@ -101,6 +101,7 @@ module Jmdict
"quote" => "quotation",
"rare" => "rare",
"rkb" => "Ryuukyuu-ben",
"rK" => "rarely used kanji form",
"sens" => "sensitive",
"shogi" => "shogi term",
"sl" => "slang",
Expand Down

0 comments on commit 04cdbda

Please sign in to comment.