Update of /var/cvs/applications/richtext/src/org/mmbase/richtext/processors/xml
In directory james.mmbase.org:/tmp/cvs-serv14673
Modified Files:
DocBook.java Kupu.java MmxfSetString.java Util.java
Added Files:
Wiki.java
Log Message:
javadoc, stub for 'wiki' resolving
See also:
http://cvs.mmbase.org/viewcvs/applications/richtext/src/org/mmbase/richtext/processors/xml
Wiki.java is new
Index: DocBook.java
===================================================================
RCS file:
/var/cvs/applications/richtext/src/org/mmbase/richtext/processors/xml/DocBook.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- DocBook.java 25 Mar 2008 17:52:18 -0000 1.1
+++ DocBook.java 25 Mar 2008 18:00:14 -0000 1.2
@@ -21,10 +21,10 @@
import org.mmbase.util.logging.*;
/**
- * Set-processing for an `mmxf' field. This is the counterpart and inverse of
[EMAIL PROTECTED] MmxfGetString}, for more
- * information see the javadoc of that class.
+ * This implements 'DocBook' Mode of [EMAIL PROTECTED] MmxfSetString}.
+ * @todo EXPERIMENTAL
* @author Michiel Meeuwissen
- * @version $Id: DocBook.java,v 1.1 2008/03/25 17:52:18 michiel Exp $
+ * @version $Id: DocBook.java,v 1.2 2008/03/25 18:00:14 michiel Exp $
*/
class DocBook {
@@ -35,7 +35,7 @@
* Receives Docbook XML, and saves as MMXF. Docbook is more powerfull as
MMXF so this
* transformation will not be perfect. It is mainly meant for MMBase
documentation.
*/
- Document parseDocBook(Node editedNode, Document source) {
+ Document parse(Node editedNode, Document source) {
Cloud cloud = editedNode.getCloud();
java.net.URL u =
ResourceLoader.getConfigurationRoot().getResource("xslt/docbook2pseudommxf.xslt");
DOMResult result = new DOMResult();
Index: Kupu.java
===================================================================
RCS file:
/var/cvs/applications/richtext/src/org/mmbase/richtext/processors/xml/Kupu.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Kupu.java 25 Mar 2008 17:52:18 -0000 1.1
+++ Kupu.java 25 Mar 2008 18:00:14 -0000 1.2
@@ -29,10 +29,9 @@
/**
- * Set-processing for an `mmxf' field. This is the counterpart and inverse of
[EMAIL PROTECTED] MmxfGetString}, for more
- * information see the javadoc of that class.
+ * This implements 'Kupu' Mode of [EMAIL PROTECTED] MmxfSetString}.
* @author Michiel Meeuwissen
- * @version $Id: Kupu.java,v 1.1 2008/03/25 17:52:18 michiel Exp $
+ * @version $Id: Kupu.java,v 1.2 2008/03/25 18:00:14 michiel Exp $
*/
class Kupu {
@@ -112,7 +111,7 @@
* @param state The function is called recursively, and this object
remembers the state then (where it was while parsing e.g.).
*/
- private void parseKupu(Element source, Element destination, List<Element>
links, ParseState state) {
+ private void parse(Element source, Element destination, List<Element>
links, ParseState state) {
org.w3c.dom.NodeList nl = source.getChildNodes();
if (log.isDebugEnabled()) {
log.trace(state.level() + state.level + " Appending to " +
destination.getNodeName() + " at " + state.offset + " of " + nl.getLength());
@@ -153,7 +152,7 @@
matcher = ignoreElement.matcher(name);
if (matcher.matches()) {
- parseKupu((Element) node, destination, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, destination, links, new
ParseState(state.level, MODE_INLINE));
continue;
}
@@ -165,7 +164,7 @@
String cssClass = Util.getCssClass("div " +
imp.getAttribute("class"));
if (! divClasses.matcher(cssClass).matches()) {
// this is no div of ours (copy/pasting?), ignore it.
- parseKupu((Element) node, destination, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, destination, links, new
ParseState(state.level, MODE_INLINE));
continue;
} else {
imp.setAttribute("class", Util.getCssClass("div " +
imp.getAttribute("class")));
@@ -192,7 +191,7 @@
log.debug("Found generated body, ignoring that");
} else {
// could only do something for 'a' and 'div', but
well, never mind
- parseKupu((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
}
}
continue;
@@ -201,7 +200,7 @@
if (node.getFirstChild() != null) { // ignore if empty
Element imp =
destination.getOwnerDocument().createElementNS(Mmxf.NAMESPACE, "em");
destination.appendChild(imp);
- parseKupu((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
}
continue;
}
@@ -209,7 +208,7 @@
if (node.getFirstChild() != null) { // ignore if empty
Element imp =
destination.getOwnerDocument().createElementNS(Mmxf.NAMESPACE, "strong");
destination.appendChild(imp);
- parseKupu((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
}
continue;
}
@@ -231,7 +230,7 @@
Element imp =
destination.getOwnerDocument().createElementNS(Mmxf.NAMESPACE,
matcher.group(0));
destination.appendChild(imp);
copyAllowedAttributes((Element) node, imp);
- parseKupu((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
}
continue;
}
@@ -243,7 +242,7 @@
Element imp =
destination.getOwnerDocument().createElementNS(Mmxf.NAMESPACE, "p");
destination.appendChild(imp);
copyAllowedAttributes((Element) node, imp);
- parseKupu((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, imp, links, new
ParseState(state.level, MODE_INLINE));
continue;
}
@@ -256,15 +255,15 @@
Element h =
destination.getOwnerDocument().createElementNS(Mmxf.NAMESPACE, "h");
section.appendChild(h);
if (foundLevel == state.level + 1) {
- parseKupu((Element) node, h, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, h, links, new
ParseState(state.level, MODE_INLINE));
state.subSections.add(section);
ParseState newState = new ParseState(foundLevel,
MODE_SECTION, state.offset + 1);
- parseKupu(source, section, links, newState);
+ parse(source, section, links, newState);
state.offset = newState.offset;
} else {
state.subSections.add(section);
ParseState newState = new ParseState(state.level + 1,
MODE_SECTION, state.offset);
- parseKupu(source, section, links, newState);
+ parse(source, section, links, newState);
state.offset = newState.offset;
}
continue;
@@ -281,7 +280,7 @@
}
}
log.warn("Unrecognised element " + name + " ignoring");
- parseKupu((Element) node, destination, links, new
ParseState(state.level, MODE_INLINE));
+ parse((Element) node, destination, links, new
ParseState(state.level, MODE_INLINE));
}
if (state.mode == MODE_SECTION) {
// drop state;
@@ -552,7 +551,7 @@
* @param document XML received from Kupu
* @return An MMXF document.
*/
- Document parseKupu(Node editedNode, Document document) {
+ Document parse(Node editedNode, Document document) {
if (log.isDebugEnabled()) {
log.debug("Handeling kupu-input" + XMLWriter.write(document,
false));
}
@@ -571,7 +570,7 @@
List<Element> links = new ArrayList();
// first stage.
- parseKupu(body, mmxf, links, new ParseState(0, MODE_SECTION));
+ parse(body, mmxf, links, new ParseState(0, MODE_SECTION));
// second stage, handle kupu-links.
@@ -699,7 +698,7 @@
}
/**
- * At the end of stage 2 of parseKupu all relations are removed which are
not used any more, using this function.
+ * At the end of stage 2 of parse all relations are removed which are not
used any more, using this function.
*/
protected void cleanDanglingIdRels(NodeList clusterNodes,
List<Map.Entry<String, Node>> usedNodes, String type) {
NodeIterator i = clusterNodes.nodeIterator();
Index: MmxfSetString.java
===================================================================
RCS file:
/var/cvs/applications/richtext/src/org/mmbase/richtext/processors/xml/MmxfSetString.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- MmxfSetString.java 25 Mar 2008 17:52:18 -0000 1.18
+++ MmxfSetString.java 25 Mar 2008 18:00:14 -0000 1.19
@@ -24,7 +24,7 @@
* Set-processing for an `mmxf' field. This is the counterpart and inverse of
[EMAIL PROTECTED] MmxfGetString}, for more
* information see the javadoc of that class.
* @author Michiel Meeuwissen
- * @version $Id: MmxfSetString.java,v 1.18 2008/03/25 17:52:18 michiel Exp $
+ * @version $Id: MmxfSetString.java,v 1.19 2008/03/25 18:00:14 michiel Exp $
* @since MMBase-1.8
*/
@@ -36,6 +36,7 @@
private static XmlField xmlField = new XmlField(XmlField.WIKI);
private static Kupu kupu = new Kupu();
private static DocBook docbook = new DocBook();
+ private static Wiki wiki = new Wiki();
@@ -49,15 +50,15 @@
switch(Modes.getMode(node.getCloud().getProperty(Cloud.PROP_XMLMODE))) {
case Modes.KUPU: {
log.debug("Handeling kupu-input: " + Util.toString(value));
- return kupu.parseKupu(node, Util.parse(value));
+ return kupu.parse(node, Util.parse(value));
}
case Modes.WIKI: {
log.debug("Handling wiki-input: " + value);
- return
Util.parse(xmlField.transformBack(Util.toString(value)));
+ return wiki.parse(node,
Util.parse(xmlField.transformBack(Util.toString(value))));
}
case Modes.DOCBOOK: {
log.debug("Handling docbook-input: " + value);
- return docbook.parseDocBook(node, Util.parse(value));
+ return docbook.parse(node, Util.parse(value));
}
case Modes.FLAT: {
log.debug("Handling flat-input " + value.getClass() + " " +
Util.toString(value));
@@ -123,7 +124,7 @@
}
node = cloud.getNode(argv[1]);
}
- Document mmxf = kupu.parseKupu(node, doc);
+ Document mmxf = kupu.parse(node, doc);
if (node != null) {
if (log.isDebugEnabled()) {
log.debug("Setting body of " + node.getNumber() + " to
" + XMLWriter.write(mmxf, false));
Index: Util.java
===================================================================
RCS file:
/var/cvs/applications/richtext/src/org/mmbase/richtext/processors/xml/Util.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Util.java 25 Mar 2008 17:52:18 -0000 1.1
+++ Util.java 25 Mar 2008 18:00:14 -0000 1.2
@@ -28,10 +28,9 @@
/**
- * Set-processing for an `mmxf' field. This is the counterpart and inverse of
[EMAIL PROTECTED] MmxfGetString}, for more
- * information see the javadoc of that class.
+ * Utility functions, used by various classes in the package.
* @author Michiel Meeuwissen
- * @version $Id: Util.java,v 1.1 2008/03/25 17:52:18 michiel Exp $
+ * @version $Id: Util.java,v 1.2 2008/03/25 18:00:14 michiel Exp $
*/
public abstract class Util {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs