Package info.bliki.wiki.model

Examples of info.bliki.wiki.model.WikiModel


    }

    @Test public void testFormatnum005() {
        // default locale is ENGLISH
        assertThat(wikiModel.parseTemplates("{{formatnum:90.0}}")).isEqualTo("90.0");
        WikiModel germanWikiModel = newWikiTestModel(Locale.GERMAN);
        assertThat(germanWikiModel.parseTemplates("{{formatnum:90.0}}")).isEqualTo("90,0");
    }
View Full Code Here


    @Test public void testFormatnum006() {
        // default locale is ENGLISH
        assertThat(wikiModel.parseTemplates("{{formatnum:90.000}}")).isEqualTo("90.000");
        assertThat(wikiModel.parseTemplates("{{formatnum:90.000000000000000000000000000000000000}}")).isEqualTo("90.000000000000000000000000000000000000");
        WikiModel germanWikiModel = newWikiTestModel(Locale.GERMAN);
        assertThat(germanWikiModel.parseTemplates("{{formatnum:90.000}}")).isEqualTo("90,000");
        assertThat(germanWikiModel.parseTemplates("{{formatnum:90.000000000000000000000000000000000000}}")).isEqualTo("90,000000000000000000000000000000000000");
    }
View Full Code Here

public class BBCodeFilterTest extends FilterTestSupport
{

    @Override
    protected WikiModel newWikiTestModel(Locale locale) {
        WikiModel wikiModel = new BBCodeModel("http://en.wikipedia.org/wiki/Image:${image}",
                "http://en.wikipedia.org/wiki/${title}");
        wikiModel.setUp();
        return wikiModel;
    }
View Full Code Here

                .toHtml("start <includeonly> test </includeonly> end")).isEqualTo("\n" + "<p>start &#60;includeonly&#62; test &#60;/includeonly&#62; end</p>");
    }

    @Test public void test004() throws Exception {
        StringWriter writer = new StringWriter();
        WikiModel model = new WikiModel("/${image}", "/${title}");
        // the toText() method with last parameter true, does the template parsing
        // step
        WikiModel.toText(model, new HTMLConverter(), "start <includeonly> test </includeonly> end", writer, false, true);
        writer.flush();
        assertThat(writer.toString()).isEqualTo("\n" + "<p>start  test  end</p>");
View Full Code Here

        // default locale is ENGLISH
        assertThat(wikiModel.parseTemplates("{{formatnum:1401}}", false)).isEqualTo("1,401");
        assertThat(wikiModel.parseTemplates("{{formatnum:987654321.654321}}", false)).isEqualTo("987,654,321.654");
        assertThat(wikiModel.parseTemplates("{{FORMATNUM:987654321.654321}}", false)).isEqualTo("987,654,321.654");

        WikiModel germanWikiModel = newWikiTestModel(Locale.GERMAN);
        assertThat(germanWikiModel.parseTemplates("{{formatnum:1401}}", false)).isEqualTo("1.401");
        assertThat(germanWikiModel.parseTemplates("{{formatnum:987654321.654321}}", false)).isEqualTo("987.654.321,654");

        WikiModel italianWikiModel = newWikiTestModel(Locale.ITALIAN);
        assertThat(italianWikiModel.parseTemplates("{{formatnum:1401}}", false)).isEqualTo("1.401");
        assertThat(italianWikiModel.parseTemplates("{{formatnum:987654321}}", false)).isEqualTo("987.654.321");
    }
View Full Code Here

    @Test public void testFormatnum002() {
        // default locale is ENGLISH
        assertThat(wikiModel.parseTemplates("{{formatnum:987,654,321.654321|R}}", false)).isEqualTo("9.87654321654321E8");

        WikiModel germanWikiModel = newWikiTestModel(Locale.GERMAN);
        assertThat(germanWikiModel.parseTemplates("{{formatnum:987.654.321,654321|R}}", false)).isEqualTo("9.87654321654321E8");
    }
View Full Code Here

    /**
     * simple example
     */
    public static void main(String[] args) {
        WikiModel wikiModel = new WikiModel(
                Configuration.DEFAULT_CONFIGURATION, Locale.GERMAN,
                "http://www.bliki.info/wiki/${image}",
                "http://www.bliki.info/wiki/${title}");
        try {
            wikiModel.setUp();

            String htmlStr = wikiModel.render(
                    "This is a simple [[Hello World]] wiki tag", false);
            System.out.print(htmlStr);
        } finally {
            wikiModel.tearDown();
        }
    }
View Full Code Here

      if (args.length >= 3) {
        FileInputStream inStream = new FileInputStream(args[1]);
        FileOutputStream outStream = new FileOutputStream(args[2]);
        char[] wikiChars = getInputStreamAsCharArray(inStream, -1, encoding);
        String wikiText = new String(wikiChars);
        WikiModel wikiModel = new WikiModel(image, link);
        String htmlStr = wikiModel.render(wikiText);
        StringBuffer buff = new StringBuffer();
        buff.append(top);
        buff.append(header);
        buff.append(htmlStr);
        buff.append(bottom);
        byte[] buffer = buff.toString().getBytes();
        outStream.write(buffer);
        inStream.close();
        outStream.close();
      } else {
        // user input through console
        final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        while (true) {
          String s = in.readLine();
          if (s == null || s.equalsIgnoreCase("exit")) {
            break;
          }
          WikiModel wikiModel = new WikiModel(image, link);
          try {
            wikiModel.setUp();
            String htmlStr = wikiModel.render(s);
            System.out.print(htmlStr);
          } finally {
            wikiModel.tearDown();
          }
        }
        in.close();
      }
    } catch (IOException e) {
View Full Code Here

    counter++;
    if (counter >= max_counter) {
      throw new SAXException("\nLimit reached after " + max_counter + " entries.");
    }
    String htmlText = "";
    WikiModel wikiModel = new WikiModel("${image}", "${title}");
    try {
      wikiModel.setUp();
      htmlText = wikiModel.render(article.getText());
      if (htmlText == null) {
        System.out.println("An IOException occured!");
      } else {
        System.out.println(htmlText);
      }
    } finally {
      wikiModel.tearDown();
    }
  }
View Full Code Here

  }

  class Wiki2HtmlListener implements java.awt.event.ActionListener {
    public void actionPerformed(java.awt.event.ActionEvent event) {
      String strData = input.getText();
      WikiModel wikiModel = new WikiModel(Configuration.DEFAULT_CONFIGURATION, Locale.ENGLISH, "${image}", "${title}");
      wikiModel.setUp();
      try {
      String result = wikiModel.render(strData);
      output.setText(result);
      } finally {
        wikiModel.tearDown();
      }
    }
View Full Code Here

TOP

Related Classes of info.bliki.wiki.model.WikiModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.