Commit | Line | Data |
---|---|---|
3e62b034 NR |
1 | package be.nikiroo.gofetch.support; |
2 | ||
3 | import org.jsoup.nodes.Node; | |
4 | ||
5 | /** | |
6 | * Used to process an element into lines. | |
7 | * | |
8 | * @author niki | |
9 | */ | |
10 | interface ElementProcessor { | |
11 | /** | |
12 | * Detect if this node is a quote and should be trated as such. | |
13 | * | |
14 | * @param node | |
15 | * the node to check | |
16 | * @return TRUE if it is | |
17 | */ | |
18 | public boolean detectQuote(Node node); | |
19 | ||
20 | /** | |
21 | * Process text content (will be called on each text element, allowing you | |
22 | * to modify it if needed). | |
23 | * | |
24 | * @param text | |
25 | * the text to process | |
26 | * | |
27 | * @return the resulting text | |
28 | */ | |
29 | public String processText(String text); | |
30 | ||
31 | /** | |
32 | * Ignore this node. | |
33 | * | |
34 | * @param node | |
35 | * the node to ignore | |
36 | * @return TRUE if it has to be ignored | |
37 | */ | |
38 | public boolean ignoreNode(Node node); | |
39 | ||
40 | /** | |
41 | * Manually process this node (and return the manual processing value) if so | |
42 | * desired. | |
43 | * <p> | |
44 | * If the node is manually processed, it and its children will not be | |
45 | * automatically processed. | |
46 | * | |
47 | * @param node | |
48 | * the node to optionally process | |
49 | * | |
50 | * @return NULL if not processed (will thus be automatically processed as | |
51 | * usual), a {@link String} (may be empty) if we process it manually | |
52 | * -- the given {@link String} will be used instead of the usual | |
53 | * automatic processing if not NULL | |
54 | */ | |
55 | public String manualProcessing(Node node); | |
56 | ||
57 | /** | |
58 | * This {@link Node} is a subtitle and should be treated as such | |
59 | * (highlighted). | |
60 | * | |
61 | * @param node | |
62 | * the node to check | |
63 | * | |
64 | * @return NULL if it is not a subtitle, the subtitle to use if it is | |
65 | */ | |
66 | public String isSubtitle(Node node); | |
67 | } |