Skip to content

Commit

Permalink
Typo fixes (#3194)
Browse files Browse the repository at this point in the history
**What problem is this PR intended to solve?**

Fix various typos - some found via `codespell` and `typos` CLI (h/t
@kianmeng with PR #3166)

**Have you included adequate test coverage?**

This PR does not change test coverage - existing tests should suffice.

**Does this change affect the behavior of either the C or the Java
implementations?**

This PR does not introduce any changes in behavior.
  • Loading branch information
flavorjones authored May 16, 2024
2 parents b97b458 + 97ad3cb commit 1415688
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ Several changes were made to improve performance:
* [JRuby] fix slow add_child [#692]
* [JRuby] fix load errors when deploying to JRuby/Torquebox [#1114] (@atambo and @jvshahid)
* [JRuby] fix NPE when inspecting nodes returned by `NodeSet#drop` [#1042] (@mkristian)
* [JRuby] fix nil attriubte node's namespace in reader [#1327] (@codekitchen)
* [JRuby] fix nil attribute node's namespace in reader [#1327] (@codekitchen)
* [JRuby] fix Nokogiri munging unicode characters that require more than 2 bytes [#1113] (@mkristian)
* [JRuby] allow unlinking an unparented node (#1112, #1152) (@esse)
* [JRuby] allow Fragment parsing on a frozen string (#444, #1077)
Expand Down
2 changes: 1 addition & 1 deletion ext/java/nokogiri/Html4Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public class Html4Document extends XmlDocument
}

public String
getPraedEncoding()
getParsedEncoding()
{
return parsed_encoding;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/java/nokogiri/XmlDocumentFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class XmlDocumentFragment extends XmlNode

XmlDocument doc = (XmlDocument) args[0];

// make wellformed fragment, ignore invalid namespace, or add appropriate namespace to parse
// make well-formed fragment, ignore invalid namespace, or add appropriate namespace to parse
if (args.length > 1 && args[1] instanceof RubyString) {
final RubyString arg1 = (RubyString) args[1];
if (XmlDocumentFragment.isTag(arg1)) {
Expand Down
4 changes: 2 additions & 2 deletions ext/java/nokogiri/XmlDtd.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public class XmlDtd extends XmlNode
*
* NekoDTD parser returns a new document node containing elements
* representing the dtd declarations. The plan is to get the root
* element and adopt it into the correct document, stipping the
* element and adopt it into the correct document, stripping the
* Document provided by NekoDTD.
*
*/
Expand Down Expand Up @@ -454,7 +454,7 @@ public class XmlDtd extends XmlNode
* This recursive function will not descend into an
* 'externalSubset' node, thus for an internal subset it only
* extracts nodes in the internal subset, and for an external
* subset it extracts everything and assumess <code>node</code>
* subset it extracts everything and assumes <code>node</code>
* and all children are part of the external subset.
*/
protected IRubyObject[]
Expand Down
2 changes: 1 addition & 1 deletion ext/java/nokogiri/internals/NokogiriHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ public class NokogiriHelpers
convertEncodingByNKFIfNecessary(ThreadContext context, XmlDocument doc, CharSequence str)
{
if (!(doc instanceof Html4Document)) { return str; }
String parsed_encoding = ((Html4Document)doc).getPraedEncoding();
String parsed_encoding = ((Html4Document)doc).getParsedEncoding();
if (parsed_encoding == null) { return str; }
String ruby_encoding = rubyStringToString(doc.getEncoding());
if (ruby_encoding == null) { return str; }
Expand Down
2 changes: 1 addition & 1 deletion ext/java/nokogiri/internals/XmlDomParserContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class XmlDomParserContext extends ParserContext
setFeature(FEATURE_NOT_EXPAND_ENTITY, true);
}
// If we turn off loading of external DTDs complete, we don't
// getthe publicID. Instead of turning off completely, we use
// get the publicID. Instead of turning off completely, we use
// an entity resolver that returns empty documents.
if (options.dtdLoad) {
setFeature(FEATURE_LOAD_EXTERNAL_DTD, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public abstract class Canonicalizer20010315Excl extends CanonicalizerBase
if (!XMLNS_URI.equals(attribute.getNamespaceURI())) {
if (isVisible(attribute) && isOutputElement) {
// The Element is output element, add the prefix (if used)
// to visibyUtilized
// to visiblyUtilized
String prefix = attribute.getPrefix();
if (prefix != null && !(prefix.equals(XML) || prefix.equals(XMLNS))) {
visiblyUtilized.add(prefix);
Expand Down
19 changes: 9 additions & 10 deletions ext/java/nokogiri/internals/c14n/CanonicalizerBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
Expand Down Expand Up @@ -243,7 +242,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi
ns.outputNodePush();
writer.write('<');
String name = currentElement.getTagName();
UtfHelpper.writeByte(name, writer, cache);
UtfHelper.writeByte(name, writer, cache);

Iterator<Attr> attrs = this.handleAttributesSubtree(currentElement, ns);
if (attrs != null) {
Expand All @@ -257,7 +256,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi
sibling = currentNode.getFirstChild();
if (sibling == null) {
writer.write(END_TAG);
UtfHelpper.writeStringToUtf8(name, writer);
UtfHelper.writeStringToUtf8(name, writer);
writer.write('>');
//We finished with this level, pop to the previous definitions.
ns.outputNodePop();
Expand All @@ -274,7 +273,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi
}
while (sibling == null && parentNode != null) {
writer.write(END_TAG);
UtfHelpper.writeByte(((Element)parentNode).getTagName(), writer, cache);
UtfHelper.writeByte(((Element)parentNode).getTagName(), writer, cache);
writer.write('>');
//We finished with this level, pop to the previous definitions.
ns.outputNodePop();
Expand Down Expand Up @@ -467,7 +466,7 @@ abstract Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTa
) throws IOException
{
writer.write(' ');
UtfHelpper.writeByte(name, writer, cache);
UtfHelper.writeByte(name, writer, cache);
writer.write(equalsStr);
byte[] toWrite;
final int length = value.length();
Expand Down Expand Up @@ -505,7 +504,7 @@ abstract Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTa
if (c < 0x80) {
writer.write(c);
} else {
UtfHelpper.writeCharToUtf8(c, writer);
UtfHelper.writeCharToUtf8(c, writer);
}
continue;
}
Expand Down Expand Up @@ -543,7 +542,7 @@ abstract Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTa
if (c < 0x80) {
writer.write(c);
} else {
UtfHelpper.writeCharToUtf8(c, writer);
UtfHelper.writeCharToUtf8(c, writer);
}
}
}
Expand All @@ -560,7 +559,7 @@ abstract Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTa
if (c == 0x0D) {
writer.write(XD);
} else {
UtfHelpper.writeCharToUtf8(c, writer);
UtfHelper.writeCharToUtf8(c, writer);
}
}
}
Expand Down Expand Up @@ -599,7 +598,7 @@ abstract Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTa
if (c < 0x80) {
writer.write(c);
} else {
UtfHelpper.writeCharToUtf8(c, writer);
UtfHelper.writeCharToUtf8(c, writer);
}
}
}
Expand Down Expand Up @@ -649,7 +648,7 @@ abstract Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTa
if (c < 0x80) {
writer.write(c);
} else {
UtfHelpper.writeCharToUtf8(c, writer);
UtfHelper.writeCharToUtf8(c, writer);
}
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public class NameSpaceSymbTable
symb.put(prefix, ne);
if (ob != null) {
//We have a previous definition store it for the pop.
//Check if a previous definition(not the inmidiatly one) has been rendered.
//Check if a previous definition(not the immediate one) has been rendered.
ne.lastrendered = ob.lastrendered;
if ((ob.lastrendered != null) && (ob.lastrendered.equals(uri))) {
//Yes it is. Mark as rendered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import java.io.OutputStream;
import java.util.Map;

public final class UtfHelpper
public final class UtfHelper
{

private
UtfHelpper()
UtfHelper()
{
// complete
}
Expand Down
6 changes: 3 additions & 3 deletions ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* Note that it doesn't necessarily represent a full Document
* tree. You can wrap a DOM2DTM around a specific node and its subtree
* and the right things should happen. (I don't _think_ we currently
* support DocumentFrgment nodes as roots, though that might be worth
* support DocumentFragment nodes as roots, though that might be worth
* considering.)
*
* Note too that we do not currently attempt to track document
Expand All @@ -63,7 +63,7 @@ public class DOM2DTM extends DTMDefaultBaseIterators
// static final boolean JJK_DEBUG=false;
// static final boolean JJK_NEWCODE=true;

/** Manefest constant
/** Manifest constant
*/
static final String NAMESPACE_DECL_NS = "http://www.w3.org/XML/1998/namespace";

Expand Down Expand Up @@ -330,7 +330,7 @@ public class DOM2DTM extends DTMDefaultBaseIterators
}

// %REVIEW% Is this local copy Really Useful from a performance
// point of view? Or is this a false microoptimization?
// point of view? Or is this a false micro-optimization?
Node pos = m_pos;
Node next = null;
int nexttype = NULL;
Expand Down
10 changes: 5 additions & 5 deletions gumbo-parser/src/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,17 +569,17 @@ static StateResult emit_from_mark(GumboParser* parser, GumboToken* output) {
}

// Appends a codepoint to the current tag buffer. If
// reinitilize_position_on_first is set, this also initializes the tag buffer
// reinitialize_position_on_first is set, this also initializes the tag buffer
// start point; the only time you would *not* want to pass true for this
// parameter is if you want the original_text to include character (like an
// opening quote) that doesn't appear in the value.
static void append_char_to_tag_buffer (
GumboParser* parser,
int codepoint,
bool reinitilize_position_on_first
bool reinitialize_position_on_first
) {
GumboStringBuffer* buffer = &parser->_tokenizer_state->_tag_state._buffer;
if (buffer->length == 0 && reinitilize_position_on_first) {
if (buffer->length == 0 && reinitialize_position_on_first) {
reset_tag_buffer_start_point(parser);
}
gumbo_string_buffer_append_codepoint(codepoint, buffer);
Expand All @@ -589,10 +589,10 @@ static void append_char_to_tag_buffer (
static void append_string_to_tag_buffer (
GumboParser* parser,
GumboStringPiece* str,
bool reinitilize_position_on_first
bool reinitialize_position_on_first
) {
GumboStringBuffer* buffer = &parser->_tokenizer_state->_tag_state._buffer;
if (buffer->length == 0 && reinitilize_position_on_first) {
if (buffer->length == 0 && reinitialize_position_on_first) {
reset_tag_buffer_start_point(parser);
}
gumbo_string_buffer_append_string(str, buffer);
Expand Down
2 changes: 1 addition & 1 deletion lib/nokogiri/xml/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def decorate(node)
@decorators.each do |klass, list|
next unless node.is_a?(klass)

list.each { |moodule| node.extend(moodule) }
list.each { |mod| node.extend(mod) }
end
end

Expand Down
2 changes: 1 addition & 1 deletion nokogiri.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Gem::Specification.new do |spec|
"ext/java/nokogiri/internals/c14n/InvalidCanonicalizerException.java",
"ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java",
"ext/java/nokogiri/internals/c14n/NodeFilter.java",
"ext/java/nokogiri/internals/c14n/UtfHelpper.java",
"ext/java/nokogiri/internals/c14n/UtfHelper.java",
"ext/java/nokogiri/internals/c14n/XMLUtils.java",
"ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java",
"ext/java/nokogiri/internals/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java",
Expand Down
2 changes: 1 addition & 1 deletion test/html5/test_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_charset_sniff_to_html
# I'm happy to change them. I'm just pasting them in here so I'm pretty sure
# the right-to-left languages are backward. Corrections welcome.
ENCODINGS = [
["UTF-8", "Let's concatentate all of these for UTF-8"], # English
["UTF-8", "Let's concatenate all of these for UTF-8"], # English
["IBM866", "А дело бывало -- и коза волка съедала"], # Russian
["ISO-8859-2", "Co můžeš udělat dnes, neodkládej na zítřek."], # Czech
["ISO-8859-3", "Yukarda mavi gök, asağıda yağız yer yaratıldıkta"], # Turkish
Expand Down
2 changes: 1 addition & 1 deletion test/test_xslt_transforms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_exslt
check_params(result_doc, params)
end

def test_xslt_paramaters
def test_xslt_parameters
# see http://yokolet.blogspot.com/2010/10/pure-java-nokogiri-xslt-extension.html")
skip_unless_libxml2("cannot get it working on JRuby")

Expand Down

0 comments on commit 1415688

Please sign in to comment.