All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fitnesse.wikitext.parser.WikiTranslator Maven / Gradle / Ivy

There is a newer version: 20250223
Show newest version
package fitnesse.wikitext.parser;

import java.util.HashMap;
import java.util.Map;

public class WikiTranslator extends Translator {
    private static final Map translations;

    static {
        translations = new HashMap<>();
        addTranslation(Alias.symbolType, new WikiBuilder().text("[[").children("][").text("]]"));
        addTranslation(Link.symbolType, new WikiBuilder().property("image", "", " ")
                .property("image", "left", " ").property("image", "right", " ").content().child(0));
        addTranslation(Literal.symbolType, new WikiBuilder().text("!-").content().text("-!"));
        addTranslation(Path.symbolType, new WikiBuilder().text("!path ").child(0));
        addTranslation(Preformat.symbolType, new WikiBuilder().text("{{{").child(0).text("}}}"));
        addTranslation(Variable.symbolType, new WikiBuilder().text("${").child(0).text("}"));
    }

    private static void addTranslation(SymbolType symbolType, Translation translation) {
        translations.put(symbolType, translation);
    }

    public WikiTranslator(SourcePage page) {
        super(page);
    }

    @Override
    protected Translation getTranslation(SymbolType symbolType) {
        return translations.get(symbolType);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy