use of org.tautua.markdownpapers.ast.Resource in project ceylon by eclipse.
the class DocBookMarkdownVisitor method visit.
public void visit(Image node) {
Resource resource = node.getResource();
append("<informalfigure>");
append("<mediaobject>");
if (node.getText() != null) {
append("<caption>");
escapeAndAppend(node.getText());
append("</caption>");
}
if (resource != null) {
append("<imageobject");
append(" fileref=\"");
escapeAndAppend(resource.getLocation());
append("\"/>");
}
if (resource != null) {
append("<textobject>");
append("<phrase>");
escapeAndAppend(resource.getHint());
append("</phrase>");
append("</textobject>");
}
append("<caption>");
escapeAndAppend(node.getText());
append("</caption>");
append("</mediaobject>");
append("</informalfigure>");
}
use of org.tautua.markdownpapers.ast.Resource in project ceylon by eclipse.
the class DocBookMarkdownVisitor method visit.
public void visit(Link node) {
Resource resource = node.getResource();
if (resource == null) {
if (node.isReferenced()) {
append("[");
node.childrenAccept(this);
append("]");
if (node.getReference() != null) {
if (node.hasWhitespaceAtMiddle()) {
append(' ');
}
append("[");
append(node.getReference());
append("]");
}
} else {
append("<a href=\"\">");
node.childrenAccept(this);
append("</a>");
}
} else {
append("<a");
append(" href=\"");
escapeAndAppend(resource.getLocation());
if (resource.getHint() != null) {
append("\" title=\"");
escapeAndAppend(resource.getHint());
}
append("\">");
node.childrenAccept(this);
append("</a>");
}
}
use of org.tautua.markdownpapers.ast.Resource in project ceylon by eclipse.
the class PlaintextMarkdownVisitor method visit.
@Override
public void visit(Link node) {
Resource resource = node.getResource();
if (resource == null) {
Node doc = node.jjtGetParent();
while (!(doc instanceof Document)) {
doc = doc.jjtGetParent();
}
resource = ((Document) doc).findResource(node.getReference());
}
if (resource != null) {
out.append(node.getText()).append(" (").append(resource.getLocation()).append(")");
} else {
out.append(node.getText());
}
}