Package info.bliki.wiki.model

Examples of info.bliki.wiki.model.WikiModel


  }

  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, false);
      output.setText(result);
      } finally {
        wikiModel.tearDown();
      }
    }
View Full Code Here


   * The number of processed articles is limited by a maximum counter
   * <code>max_count</code>
   *
   */
  public PrintArticle(int max_count) {
    wikiModel = new WikiModel("${image}", "${title}");
    counter = 0;
    max_counter = max_count;
  }
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(), false);
      if (htmlText == null) {
        System.out.println("An IOException occured!");
      } else {
        System.out.println(htmlText);
      }
    } 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, false);
        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, false);
            System.out.print(htmlStr);
          } finally {
            wikiModel.tearDown();
          }
        }
        in.close();
      }
    } catch (IOException e) {
View Full Code Here

   * The number of processed articles is limited by a maximum counter
   * <code>max_count</code>
   *
   */
  public PrintArticle(int max_count) {
    wikiModel = new WikiModel("${image}", "${title}");
    counter = 0;
    max_counter = max_count;
  }
View Full Code Here

  public static Test suite() {
    return new TestSuite(BigDocbookTest.class);
  }

  public void testDocbook() {
    WikiModel myWikiModel = new WikiTestModel("file:///c:/temp/${image}", "file:///c:/temp/${title}");
    String renderedXHTML = myWikiModel.render(TEST1);
    DocbookGenerator gen = new DocbookGenerator();
    try {
      String output = gen.create(renderedXHTML, DocbookGenerator.HEADER_TEMPLATE, DocbookGenerator.FOOTER, "Big Docbook Test");
      System.out.println(output);
    } catch (Exception e) {
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 (convertType.equals("wiki")) {
        HTML2WikiConverter conv = new HTML2WikiConverter();
        conv.setInputHTML(expression);
        result = conv.toWiki(new ToWikipedia(no_div, no_font));
      } else if (convertType.equals("wiki2html")) {
        WikiModel wikiModel = new WikiModel(Configuration.DEFAULT_CONFIGURATION, Locale.ENGLISH, "${image}", "${title}");
        wikiModel.setUp();
        try {
          result = wikiModel.render(expression);
        } finally {
          wikiModel.tearDown();
        }
      } else if (convertType.equals("wiki2plain")) {
        WikiModel wikiModel = new WikiModel(Configuration.DEFAULT_CONFIGURATION, Locale.ENGLISH, "${image}", "${title}");
        wikiModel.setUp();
        try {
          result = wikiModel.render(new PlainTextConverter(), expression);
        } finally {
          wikiModel.tearDown();
        }
      } else if (convertType.equals("googlecode")) {
        HTML2WikiConverter conv = new HTML2WikiConverter();
        conv.setInputHTML(expression);
        result = conv.toWiki(new ToGoogleCode(no_div, no_font));
View Full Code Here

  public static Test suite() {
    return new TestSuite(BigDocbookTest.class);
  }

  public void testDocbook() {
    WikiModel myWikiModel = new WikiTestModel("file:///c:/temp/${image}", "file:///c:/temp/${title}");
    String renderedXHTML = myWikiModel.render(TEST1);
    DocbookGenerator gen = new DocbookGenerator();
    try {
      String output = gen.create(renderedXHTML, DocbookGenerator.HEADER_TEMPLATE, DocbookGenerator.FOOTER, "Big Docbook Test");
      System.out.println(output);
    } catch (Exception e) {
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}");
    String htmlStr = wikiModel.render("This is a simple [[Hello World]] wiki tag");
    System.out.print(htmlStr);
  }
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.