@ThreadSafe public final class LineTransformer1 extends Object
The line transformer recognizes markers that distinguish meta-content from proper content. The meta-content must bracket the page like a header and footer. It is marked by lines that contain BRAC_LINE_MARKER_PATTERN. These lines and the content above or below are ignored for differencing purposes. Pages are thus structured as follows:
The optional high bracket, or header, ends with a line containing this marker <!--voHiBrac--> The content proper for differencing purposes This <!--voLoBrac--> marks the first line of the optional low bracket, or footer.
Note that this transformer may append a final newline to outgoing wikitext that was not in the original. This is unlikely to have much effect, because MediaWiki's own editor has the same behaviour.
Modifier and Type | Field and Description |
---|---|
(package private) static Pattern |
BRAC_LINE_MARKER_PATTERN
The pattern of a "low bracket" or "high bracket" marker in a line of wikitext.
|
Constructor and Description |
---|
LineTransformer1() |
Modifier and Type | Method and Description |
---|---|
(package private) void |
appendFromWiki(String line,
Writer out)
Appends a line of incoming text from the wiki.
|
void |
appendToWiki(String line,
Writer out)
Appends a line of outgoing text, destined for the wiki.
|
File[] |
fetchPageAsFile(URI s,
String idType,
int id,
String prefix,
Spool fileSpool)
Downloads the wikitext source of the specified page, and splits it into one or
more temporary files.
|
(package private) void |
test()
Runs a loopback test of this line transformer.
|
static final Pattern BRAC_LINE_MARKER_PATTERN
public LineTransformer1()
void appendFromWiki(String line, Writer out) throws IOException
IOException
public void appendToWiki(String line, Writer out) throws IOException
IOException
public File[] fetchPageAsFile(URI s, String idType, int id, String prefix, Spool fileSpool) throws IOException
idType
- one of "curid" or "oldid".id
- the page identifier (curid) or revision identifier (oldid).s
- the base URI for script execution in the wiki, without a trailing
slash (/).prefix
- the base prefix
for the temporary files.fileSpool
- the spool to hold temporary files. If unwound, the files
will be deleted.IOException
void test() throws IOException
IOException