Package info.bliki.wiki.model

Examples of info.bliki.wiki.model.Reference


    @Test public void testRef05() {
        assertThat(wikiModel.render("aaa <ref name=Freitag/> bbb<ref name=Arndt /> <ref>ccc</ref> <references/>", false)).isEqualTo("\n" +
                "<p>aaa <sup id=\"_ref-Freitag\" class=\"reference\"><a href=\"#_note-Freitag\" title=\"\">[1]</a></sup> bbb<sup id=\"_ref-Arndt\" class=\"reference\"><a href=\"#_note-Arndt\" title=\"\">[2]</a></sup> <sup id=\"_ref-3\" class=\"reference\"><a href=\"#_note-3\" title=\"\">[3]</a></sup> </p><ol class=\"references\">\n" +
                "<li id=\"_note-Freitag\"><b><a href=\"#_ref-Freitag\" title=\"\">&#8593;</a></b> </li><li id=\"_note-Arndt\"><b><a href=\"#_ref-Arndt\" title=\"\">&#8593;</a></b> </li><li id=\"_note-3\"><b><a href=\"#_ref-3\" title=\"\">&#8593;</a></b> ccc</li>\n</ol>");
        List<Reference> list = wikiModel.getReferences();
        Reference ref = list.get(0);
        assertThat(ref.getRefString()).isEqualTo("");
        ref = list.get(1);
        assertThat(ref.getRefString()).isEqualTo("");
        ref = list.get(2);
        assertThat(ref.getRefString()).isEqualTo("ccc");
    }
View Full Code Here


    @Test public void testRef06() {
        assertThat(wikiModel.render("aaa <ref name=Freitag/> bbb<ref name=A&B /> <ref>ccc</ref> <references/>", false)).isEqualTo("\n" +
                "<p>aaa <sup id=\"_ref-Freitag\" class=\"reference\"><a href=\"#_note-Freitag\" title=\"\">[1]</a></sup> bbb<sup id=\"_ref-A.26B\" class=\"reference\"><a href=\"#_note-A.26B\" title=\"\">[2]</a></sup> <sup id=\"_ref-3\" class=\"reference\"><a href=\"#_note-3\" title=\"\">[3]</a></sup> </p><ol class=\"references\">\n" +
                "<li id=\"_note-Freitag\"><b><a href=\"#_ref-Freitag\" title=\"\">&#8593;</a></b> </li><li id=\"_note-A.26B\"><b><a href=\"#_ref-A.26B\" title=\"\">&#8593;</a></b> </li><li id=\"_note-3\"><b><a href=\"#_ref-3\" title=\"\">&#8593;</a></b> ccc</li>\n</ol>");
        List<Reference> list = wikiModel.getReferences();
        Reference ref = list.get(0);
        assertThat(ref.getRefString()).isEqualTo("");
        ref = list.get(1);
        assertThat(ref.getRefString()).isEqualTo("");
        ref = list.get(2);
        assertThat(ref.getRefString()).isEqualTo("ccc");
    }
View Full Code Here

  @Override
  public void renderHTML(ITextConverter converter, Appendable writer, IWikiModel model) throws IOException {
    List<Reference> list = model.getReferences();
    if (list != null) {
      Reference ref;
      int counter;
      writer.append("<ol class=\"references\">\n");
      for (int i = 0; i < list.size(); i++) {
        ref = (Reference) list.get(i);
        counter = ref.getCounter();
        writer.append("<li id=\"_note-");
        if (counter == 0) {
          String i1 = Integer.toString(i + 1);
          writer.append(i1);
          writer.append("\"><b><a href=\"#_ref-");
          writer.append(i1);
          // upwards arrow
          writer.append("\" title=\"\">&#8593;</a></b> ");//&uarr;
        } else {
          String note;
          String nameAttribute = ref.getAttribute();
          char ch;
          writer.append(nameAttribute);
          writer.append("\">&#8593; "); //&uarr;
          for (int j = 0; j <= counter; j++) {
            if (j >= Reference.CHARACTER_REFS.length()) {
              ch = 'Z';
            } else {
              ch = Reference.CHARACTER_REFS.charAt(j);
            }
            note = nameAttribute + '_' + ch;
            writer.append("<a href=\"#_ref-");
            writer.append(note);
            writer.append("\" title=\"\"><sup><i><b>" + ch + "</b></i></sup></a> ");
          }
        }
        writer.append(ref.getRefString());
        writer.append("</li>");
      }
      writer.append("</ol>");
    }
  }
View Full Code Here

TOP

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

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.