X-Git-Url: http://git.nikiroo.be/?p=gofetch.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fgofetch%2Fsupport%2FBasicSupport.java;h=102023eb051a02b6c13a41e5ddc0d64e98743156;hp=1db066b3d107c8fefb26218675fa8c5c0767b815;hb=100a839503d23e324d2db3f6d3e47892def3bf81;hpb=1b084e893e0af0c90524fb137b83984d9bc44c06 diff --git a/src/be/nikiroo/gofetch/support/BasicSupport.java b/src/be/nikiroo/gofetch/support/BasicSupport.java index 1db066b..102023e 100644 --- a/src/be/nikiroo/gofetch/support/BasicSupport.java +++ b/src/be/nikiroo/gofetch/support/BasicSupport.java @@ -20,7 +20,7 @@ import be.nikiroo.gofetch.data.Story; public abstract class BasicSupport { public enum Type { - SLASHDOT, PIPEDOT, LWN, + SLASHDOT, PIPEDOT, LWN, LEMONDE, } public interface QuoteProcessor { @@ -29,12 +29,33 @@ public abstract class BasicSupport { public String processText(String text); public boolean ignoreNode(Node node); + + /** + * Manually process this node if so desired. + * + * @param node + * the node to optionally process + * + * @return NULL if not processed, a {@link String} (may be empty) if we + * must not process it any further + */ + public String manualProcessing(Node node); } static private String preselector; private Type type; + /** + * List all the recent items, but only assure the ID and internal URL to + * fetch it later on (until it has been fetched, the rest of the + * {@link Story} is not confirmed). + * + * @return the list of new stories + * + * @throws IOException + * in case of I/O + */ abstract public List list() throws IOException; /** @@ -85,6 +106,9 @@ public abstract class BasicSupport { case LWN: support = new LWN(); break; + case LEMONDE: + support = new LeMonde(); + break; } if (support != null) { @@ -162,8 +186,18 @@ public abstract class BasicSupport { new NodeTraversor(new NodeVisitor() { @Override public void head(Node node, int depth) { - if (quoteProcessor.ignoreNode(node) - || ignoredNodes.contains(node.parentNode())) { + String manual = null; + boolean ignore = quoteProcessor.ignoreNode(node) + || ignoredNodes.contains(node.parentNode()); + if (!ignore) { + manual = quoteProcessor.manualProcessing(node); + if (manual != null) { + currentLine.append(manual); + ignore = true; + } + } + + if (ignore) { ignoredNodes.add(node); return; }