diff --git a/htroot/env/base.css b/htroot/env/base.css index e7016b5cb..52b325a55 100644 --- a/htroot/env/base.css +++ b/htroot/env/base.css @@ -16,7 +16,7 @@ # i.e. ".strong"; ".left"; ".error"; ############################################### ## "privat classes" ## -# all htnml-elements with a specific class +# all HTML-elements with a specific class # i.e. "div.content"; "span.left"; # and # "div.content span a."; "form.search fieldset legend"; @@ -117,6 +117,10 @@ margin-bottom:0px; vertical-align:text-bottom; } +pre { + font-family:monospace; +} + /* --------------- global classes --------------------- */ tt, *.tt { @@ -163,6 +167,10 @@ tt, *.tt { font-weight:bold; } +.strike { + text-decoration: line-through; +} + .Headline { font-weight: bold; font-size: 160%; diff --git a/source/de/anomic/data/wiki/wikiCode.java b/source/de/anomic/data/wiki/wikiCode.java index a71c4f2ef..6c8069c05 100644 --- a/source/de/anomic/data/wiki/wikiCode.java +++ b/source/de/anomic/data/wiki/wikiCode.java @@ -1,4 +1,4 @@ -// wikiCode.java +// wikiCode.java // ------------------------------------- // part of YACY // @@ -36,10 +36,10 @@ import net.yacy.document.parser.html.CharacterCoding; import de.anomic.server.serverCore; /** This class provides methods to handle texts that have been posted in the yacyWiki or other - * parts of YaCy that use this class, like the blog or the profile. - * - * @author Alexander Schier [AS], Franz Brausze [FB], Marc Nause [MN] - */ +* parts of YaCy that use this class, like the blog or the profile. +* +* @author Alexander Schier [AS], Franz Brausze [FB], Marc Nause [MN] +*/ public class wikiCode extends abstractWikiParser implements wikiParser { private static final String ASTERISK = "*"; private static final String EMPTY = ""; @@ -60,7 +60,7 @@ public class wikiCode extends abstractWikiParser implements wikiParser { private static final String HTML_OPEN_BLOCKQUOTE = "
"; private static final String HTML_OPEN_LIST_ELEMENT = "
  • "; private static final String HTML_OPEN_ORDERED_LIST = "
      "; - + private static final String WIKI_CLOSE_LINK = "]]"; private static final String WIKI_OPEN_LINK = "[["; private static final String WIKI_CLOSE_EXTERNAL_LINK = "]"; @@ -70,17 +70,23 @@ public class wikiCode extends abstractWikiParser implements wikiParser { private static final String WIKI_EMPHASIZE_1 = "\'\'"; private static final String WIKI_EMPHASIZE_2 = "\'\'\'"; private static final String WIKI_EMPHASIZE_3 = "\'\'\'\'\'"; - private static final String WIKI_HEADLINE_TAG_1 = "=="; - private static final String WIKI_HEADLINE_TAG_2 = "==="; - private static final String WIKI_HEADLINE_TAG_3 = "===="; + private static final String WIKI_HEADLINE_TAG_1 = "="; + private static final String WIKI_HEADLINE_TAG_2 = "=="; + private static final String WIKI_HEADLINE_TAG_3 = "==="; + private static final String WIKI_HEADLINE_TAG_4 = "===="; + private static final String WIKI_HEADLINE_TAG_5 = "====="; + private static final String WIKI_HEADLINE_TAG_6 = "======"; private static final String WIKI_HR_LINE = "----"; private static final String WIKI_IMAGE = "Image:"; private static final String WIKI_OPEN_EXTERNAL_LINK = "["; private static final String WIKI_OPEN_PRE_ESCAPED = "<pre>"; private static final char ONE = '1'; - private static final char THREE = '3'; private static final char TWO = '2'; + private static final char THREE = '3'; + private static final char FOUR = '4'; + private static final char FIVE = '5'; + private static final char SIX = '6'; private static final char WIKI_FORMATTED = ' '; private static final char WIKI_INDENTION = ':'; @@ -101,9 +107,9 @@ public class wikiCode extends abstractWikiParser implements wikiParser { private final static Map PROPERTY_VALUES = new HashMap(); /** Tags for different types of headlines in wikiCode. */ - private final static String[] HEADLINE_TAGS = new String[]{WIKI_HEADLINE_TAG_3, WIKI_HEADLINE_TAG_2, WIKI_HEADLINE_TAG_1}; + private final static String[] HEADLINE_TAGS = new String[]{WIKI_HEADLINE_TAG_6, WIKI_HEADLINE_TAG_5, WIKI_HEADLINE_TAG_4, WIKI_HEADLINE_TAG_3, WIKI_HEADLINE_TAG_2, WIKI_HEADLINE_TAG_1}; - private final static char[] HEADLINE_LEVEL = new char[]{ONE, TWO, THREE}; + private final static char[] HEADLINE_LEVEL = new char[]{ONE, TWO, THREE, FOUR, FIVE, SIX}; private String numberedListLevel = EMPTY; private String unorderedListLevel = EMPTY; @@ -568,7 +574,7 @@ public class wikiCode extends abstractWikiParser implements wikiParser { //both
       and 
      in the same line if ((positionOfOpeningTag >= 0) && (positionOfClosingTag > 0) && !escaped) { if (positionOfOpeningTag < positionOfClosingTag) { - String preformattedText = "
      " + line.substring(positionOfOpeningTag + LEN_WIKI_OPEN_PRE_ESCAPED, positionOfClosingTag) + "
      "; + String preformattedText = "
      " + line.substring(positionOfOpeningTag + LEN_WIKI_OPEN_PRE_ESCAPED, positionOfClosingTag) + "
      "; preformattedText = preformattedText.replaceAll("!pre!", "!pre!!"); line = processLineOfWikiCode(line.substring(0, positionOfOpeningTag).replaceAll("!pre!", "!pre!!") + "!pre!txt!" + line.substring(positionOfClosingTag + LEN_WIKI_CLOSE_PRE_ESCAPED).replaceAll("!pre!", "!pre!!")); line = line.replaceAll("!pre!txt!", preformattedText); @@ -588,10 +594,11 @@ public class wikiCode extends abstractWikiParser implements wikiParser { else if ((positionOfOpeningTag >= 0) && !preformattedSpanning && !escaped) { processingPreformattedText = true; //prevent surplus line breaks final StringBuilder openBlockQuoteTags = new StringBuilder(); //gets filled with
      s as needed - String preformattedText = "
      " + line.substring(positionOfOpeningTag + LEN_WIKI_OPEN_PRE_ESCAPED);
      +            String preformattedText = "
      " + line.substring(positionOfOpeningTag + LEN_WIKI_OPEN_PRE_ESCAPED);
                   preformattedText = preformattedText.replaceAll("!pre!", "!pre!!");
                   //taking care of indented lines
      -            while (line.substring(preindented, positionOfOpeningTag).charAt(0) == WIKI_INDENTION) {
      +            while (preindented < positionOfOpeningTag && positionOfOpeningTag < line.length() &&
      +                    line.substring(preindented, positionOfOpeningTag).charAt(0) == WIKI_INDENTION) {
                       preindented++;
                       openBlockQuoteTags.append(HTML_OPEN_BLOCKQUOTE);
                   }
      @@ -600,17 +607,17 @@ public class wikiCode extends abstractWikiParser implements wikiParser {
                   line = line.replaceAll("!pre!!", "!pre!");
                   preformattedSpanning = true;
               } //end 
      - else if ((positionOfOpeningTag >= 0) && preformattedSpanning && !escaped) { + else if ((positionOfClosingTag >= 0) && preformattedSpanning && !escaped) { preformattedSpanning = false; final StringBuilder endBlockQuoteTags = new StringBuilder(); //gets filled with
      s as needed - String preformattedText = line.substring(0, positionOfOpeningTag) + ""; + String preformattedText = line.substring(0, positionOfClosingTag) + ""; preformattedText = preformattedText.replaceAll("!pre!", "!pre!!"); //taking care of indented lines while (preindented > 0) { endBlockQuoteTags.append(HTML_CLOSE_BLOCKQUOTE); preindented--; } - line = processLineOfWikiCode("!pre!txt!" + line.substring(positionOfOpeningTag + LEN_WIKI_CLOSE_PRE_ESCAPED).replaceAll("!pre!", "!pre!!")); + line = processLineOfWikiCode("!pre!txt!" + line.substring(positionOfClosingTag + LEN_WIKI_CLOSE_PRE_ESCAPED).replaceAll("!pre!", "!pre!!")); line = line.replaceAll("!pre!txt!", preformattedText) + endBlockQuoteTags; line = line.replaceAll("!pre!!", "!pre!"); processingPreformattedText = false; @@ -637,6 +644,9 @@ public class wikiCode extends abstractWikiParser implements wikiParser { int level1 = 0; int level2 = 0; int level3 = 0; + int level4 = 0; + int level5 = 0; + int level6 = 0; int doubles = 0; String anchorext = EMPTY; if ((s = tableOfContentElements.size()) > 2) { @@ -673,37 +683,91 @@ public class wikiCode extends abstractWikiParser implements wikiParser { final char l = element.charAt(0); String temp = ""; if (Arrays.binarySearch(HEADLINE_LEVEL, l) >= 0 && element.length() > 0) { - if (l == THREE) { - if (level < 3) { - level = 3; - level3 = 0; + + switch (l) { + + case SIX: { + if (level < 6) { + level = 6; + level6 = 0; + } + level6++; + temp = element.substring(1); + element = level1 + "." + level2 + "." + level3 + "." + level4 + "." + level5 + "." + level6 + " " + temp; + directory.append("             1) { - level = 1; - level2 = 0; - level3 = 0; + case ONE: { + if (level > 1) { + level = 1; + level2 = 0; + level3 = 0; + level4 = 0; + level5 = 0; + level6 = 0; + } + level1++; + temp = element.substring(1); + element = level1 + ". " + temp; + directory.append("= 0) || (line.indexOf(WIKI_CLOSE_PRE_ESCAPED) >= 0) || (preformattedSpanning)) { + if ((line.indexOf(WIKI_OPEN_PRE_ESCAPED) >= 0) || + (line.indexOf(WIKI_CLOSE_PRE_ESCAPED) >= 0) || + preformattedSpanning) { line = processPreformattedText(line); } else { @@ -823,18 +889,21 @@ public class wikiCode extends abstractWikiParser implements wikiParser { } line = head + line + tail; } - // end contrib [MN] + // end contrib [MN] // format headers - line = pairReplace(line, WIKI_HEADLINE_TAG_3, "

      ", "

      "); - line = pairReplace(line, WIKI_HEADLINE_TAG_2, "

      ", "

      "); - line = pairReplace(line, WIKI_HEADLINE_TAG_1, "

      ", "

      "); + line = pairReplace(line, WIKI_HEADLINE_TAG_6, "
      ", "
      "); + line = pairReplace(line, WIKI_HEADLINE_TAG_5, "
      ", "
      "); + line = pairReplace(line, WIKI_HEADLINE_TAG_4, "

      ", "

      "); + line = pairReplace(line, WIKI_HEADLINE_TAG_3, "

      ", "

      "); + line = pairReplace(line, WIKI_HEADLINE_TAG_2, "

      ", "

      "); + line = pairReplace(line, WIKI_HEADLINE_TAG_1, "

      ", "

      "); line = pairReplace(line, WIKI_EMPHASIZE_3, "", ""); line = pairReplace(line, WIKI_EMPHASIZE_2, "", ""); line = pairReplace(line, WIKI_EMPHASIZE_1, "", ""); - line = pairReplace(line, WIKI_OPEN_STRIKE, WIKI_CLOSE_STRIKE, "", ""); + line = pairReplace(line, WIKI_OPEN_STRIKE, WIKI_CLOSE_STRIKE, "", ""); line = processUnorderedList(line); line = processOrderedList(line); @@ -852,4 +921,4 @@ public class wikiCode extends abstractWikiParser implements wikiParser { } return line; } -} +} \ No newline at end of file