Skip to content

Commit

Permalink
Don't strip forms in pre-processing
Browse files Browse the repository at this point in the history
  • Loading branch information
GomiGuchi committed Nov 26, 2018
1 parent f6f6a0e commit bd68a75
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/main/java/com/chimbori/crux/articles/PreprocessHelpers.java
Expand Up @@ -14,7 +14,7 @@ class PreprocessHelpers {
static void preprocess(Document doc) {
Log.i("preprocess");
stripUnlikelyCandidates(doc);
removeScriptsStylesForms(doc);
removeScriptsStyles(doc);
removeComments(doc.body());
}

Expand All @@ -36,25 +36,20 @@ private static void stripUnlikelyCandidates(Document doc) {
}
}

private static void removeScriptsStylesForms(Document doc) {
private static void removeScriptsStyles(Document doc) {
Elements scripts = doc.getElementsByTag("script");
for (Element item : scripts) {
Log.printAndRemove(item, "removeScriptsStylesForms('script')");
Log.printAndRemove(item, "removeScriptsStyles('script')");
}

Elements noscripts = doc.getElementsByTag("noscript");
for (Element item : noscripts) {
Log.printAndRemove(item, "removeScriptsStylesForms('noscript')");
Log.printAndRemove(item, "removeScriptsStyles('noscript')");
}

Elements styles = doc.getElementsByTag("style");
for (Element item : styles) {
Log.printAndRemove(item, "removeScriptsStylesForms('style')");
}

Elements forms = doc.getElementsByTag("form");
for (Element item : forms) {
Log.printAndRemove(item, "removeScriptsStylesForms('form')");
Log.printAndRemove(item, "removeScriptsStyles('style')");
}
}

Expand Down

0 comments on commit bd68a75

Please sign in to comment.