Search in sources :

Example 1 with Resource

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>");
}
Also used : Resource(org.tautua.markdownpapers.ast.Resource)

Example 2 with Resource

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>");
    }
}
Also used : Resource(org.tautua.markdownpapers.ast.Resource)

Example 3 with Resource

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());
    }
}
Also used : Node(org.tautua.markdownpapers.ast.Node) Resource(org.tautua.markdownpapers.ast.Resource) Document(org.tautua.markdownpapers.ast.Document)

Aggregations

Resource (org.tautua.markdownpapers.ast.Resource)3 Document (org.tautua.markdownpapers.ast.Document)1 Node (org.tautua.markdownpapers.ast.Node)1