Skip to content

Commit

Permalink
Merge pull request #42 from sdcr/bugfix_issue_8
Browse files Browse the repository at this point in the history
Bugfix issue 8
  • Loading branch information
NightWhistler committed Feb 15, 2016
2 parents b686e30 + c01045c commit b21b060
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -17,7 +17,7 @@ repositories {
}

dependencies {
compile 'net.sourceforge.htmlcleaner:htmlcleaner:2.2'
compile 'net.sourceforge.htmlcleaner:htmlcleaner:2.16'
compile 'com.osbcp.cssparser:cssparser:1.5'
}

Expand Down
Expand Up @@ -331,7 +331,7 @@ private void applySpan(SpannableStringBuilder builder, TagNode node, SpanStack s

if ( !handler.rendersContent() ) {

for (Object childNode : node.getChildren()) {
for (Object childNode : node.getAllChildren()) {

if ( childNode instanceof ContentNode ) {
handleContent( builder, childNode, stack, cancellationCallback );
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/nightwhistler/htmlspanner/TextUtil.java
Expand Up @@ -30,6 +30,9 @@ public class TextUtil {
REPLACEMENTS.put("‘", "‘");
REPLACEMENTS.put("’", "’");

REPLACEMENTS.put("–", "\u2013");
REPLACEMENTS.put("—", "\u2014");
REPLACEMENTS.put("―", "\u2015");
}

/**
Expand Down
Expand Up @@ -15,12 +15,12 @@
*/
package net.nightwhistler.htmlspanner.handlers;


import net.nightwhistler.htmlspanner.SpanStack;
import net.nightwhistler.htmlspanner.TagNodeHandler;

import org.htmlcleaner.TagNode;

import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.URLSpan;

Expand Down
Expand Up @@ -40,7 +40,7 @@ private int getMyIndex(TagNode node) {

int i = 1;

for (Object child : node.getParent().getChildren()) {
for (Object child : node.getParent().getAllChildren()) {
if (child == node) {
return i;
}
Expand Down
Expand Up @@ -48,7 +48,7 @@ private void getPlainText(StringBuffer buffer, Object node) {

} else if (node instanceof TagNode) {
TagNode tagNode = (TagNode) node;
for (Object child : tagNode.getChildren()) {
for (Object child : tagNode.getAllChildren()) {
getPlainText(buffer, child);
}
}
Expand Down
Expand Up @@ -20,8 +20,8 @@ public void handleTagNode(TagNode node, SpannableStringBuilder builder, int star

if ( getSpanner().isAllowStyling() ) {

if ( node.getChildren().size() == 1 ) {
Object childNode = node.getChildren().get(0);
if ( node.getAllChildren().size() == 1 ) {
Object childNode = node.getAllChildren().get(0);

if ( childNode instanceof ContentNode ) {
parseCSSFromText( ( (ContentNode) childNode ).getContent(),
Expand All @@ -32,9 +32,9 @@ public void handleTagNode(TagNode node, SpannableStringBuilder builder, int star

}

private void parseCSSFromText( StringBuilder text, SpanStack spanStack ) {
private void parseCSSFromText( String text, SpanStack spanStack ) {
try {
for ( Rule rule: CSSParser.parse( text.toString() ) ) {
for ( Rule rule: CSSParser.parse( text ) ) {
spanStack.registerCompiledRule(CSSCompiler.compile(rule, getSpanner()));
}
} catch ( Exception e ) {
Expand Down
Expand Up @@ -121,7 +121,7 @@ private void readNode(Object node, Table table) {
table.addRow();
}

for (Object child : tagNode.getChildren()) {
for (Object child : tagNode.getAllChildren()) {
readNode(child, table);
}
}
Expand Down

0 comments on commit b21b060

Please sign in to comment.