diff --git a/pom.xml b/pom.xml index 808ce03..70c0861 100644 --- a/pom.xml +++ b/pom.xml @@ -54,8 +54,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA power-log power-io power-web - - power-wiki power-sql power-db diff --git a/power-wiki/pom.xml b/power-wiki/pom.xml deleted file mode 100644 index 3dbd68b..0000000 --- a/power-wiki/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - 4.0.0 - - - org.nanoboot.powerframework - power-framework - 2.0.0-SNAPSHOT - - - power-wiki - jar - - Power Wiki - Wiki functionality for the Power library - - - - - org.nanoboot.powerframework - power-core - ${power.version} - - - org.nanoboot.powerframework - power-log - ${power.version} - - - - - diff --git a/power-wiki/src/main/java/module-info.java b/power-wiki/src/main/java/module-info.java deleted file mode 100644 index 4331ca0..0000000 --- a/power-wiki/src/main/java/module-info.java +++ /dev/null @@ -1,31 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * - * - * @author Robert Vokac - * @since 0.0.0 - */ -module powerframework.wiki { - requires powerframework.core; - requires powerframework.log; - requires powerframework.utils; -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/Block.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/Block.java deleted file mode 100644 index 82ff649..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/Block.java +++ /dev/null @@ -1,170 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -import java.util.ArrayList; - -/** - * Here goes the description of this class. - * - * - * @author Robert Vokac - * @since 0.0.0 - */ -public class Block { - - private final ArrayList lines = new ArrayList<>(); - private final ArrayList origLines = new ArrayList<>(); - private final BlockType blockType; - - public Block(BlockType lineType) { - this.blockType = lineType; - } - - void addLine(String line) { - if(blockType.isOneLined() && lines.size() == 1) { - throw new WikiException(blockType.getDescription() + " is one lined. Cannot add line " + line); - } - origLines.add(line); - if(this.blockType != BlockType.PARSER) { - line = preProcessLine(line); - } - lines.add(line); - } - - private String preProcessLine(String lineIn) { - BlockType lineType = BlockType.getBlockType(lineIn); - if(blockType != lineType) { - throw new WikiException("Cannot add line to block. Line type is " + lineType + ", but the block type is " + blockType); - } - - String line = lineIn; - switch (blockType) { - - // case OL: { -// line = line.replace(WikiMarks.ORDERED_LIST, HtmlTags.LI_START); -// line = line + HtmlTags.LI_END; -// } -// break; -// case UL: { -// line = line.replace(WikiMarks.UNORDERED_LIST, HtmlTags.LI_START); -// line = line + HtmlTags.LI_END; -// } -// break; - case BLANK: { - - } - break; - case P: { - - } - break; - default: { - } - } - return line; - } - - BlockType getBlockType() { - return blockType; - } - - public String getLine(int lineNumber) { - return lines.get(lineNumber); - } - - public String toHtml() { - StringBuilder stringBuilder = new StringBuilder("" + this.blockType + "
"); - int linesMaxIndex = lines.size() - 1; - int i = 0; - for (String line : lines) { - stringBuilder.append(line); - if(i++ < linesMaxIndex) { - stringBuilder.append('\n'); - } - } - - String string = stringBuilder.toString(); - switch (blockType) { - - case H1: { - string = string.replace(WikiMarks.HEADING1_START, HtmlTags.H1_START); - string = string.replace(WikiMarks.HEADING1_END, HtmlTags.H1_END); - } - break; - case H2: { - string = string.replace(WikiMarks.HEADING2_START, HtmlTags.H2_START); - string = string.replace(WikiMarks.HEADING2_END, HtmlTags.H2_END); - } - break; - case H3: { - string = string.replace(WikiMarks.HEADING3_START, HtmlTags.H3_START); - string = string.replace(WikiMarks.HEADING3_END, HtmlTags.H3_END); - } - break; - case H4: { - string = string.replace(WikiMarks.HEADING4_START, HtmlTags.H4_START); - string = string.replace(WikiMarks.HEADING4_END, HtmlTags.H4_END); - } - break; - case H5: { - string = string.replace(WikiMarks.HEADING5_START, HtmlTags.H5_START); - string = string.replace(WikiMarks.HEADING5_END, HtmlTags.H5_END); - } - break; - case H6: { - string = string.replace(WikiMarks.HEADING6_START, HtmlTags.H6_START); - string = string.replace(WikiMarks.HEADING6_END, HtmlTags.H6_END); - } - break; - case LIST: { - string = HtmlTags.OL_START + '\n' + string + '\n' + HtmlTags.OL_END; - } - break; -// case UL: { -// string = HtmlTags.UL_START + '\n' + string + '\n' + HtmlTags.UL_END; -// } -// break; - case BLANK: { - - } - break; - case P: { - string = HtmlTags.P_START + '\n' + string + '\n' + HtmlTags.P_END; - } - break; - default: { - } - } - //s = "\n\n\n\n### ZZZZZZZZZZZZZZZZZZZ ###\n" + s + "\n---------------------\n" + string + "\n-----------------"; - //System.out.println(s); - string = "\n" + string + "\n"; - return string; - } - public String getOrig(){ - StringBuilder stringBuilder=new StringBuilder(); - for(String e:origLines){ - stringBuilder.append(e).append("\n"); - } - return stringBuilder.toString(); - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/BlockList.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/BlockList.java deleted file mode 100644 index bc33a34..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/BlockList.java +++ /dev/null @@ -1,70 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -import java.util.ArrayList; - -/** - * Here goes the description of this class. - * - * - * @author Robert Vokac - * @since 0.0.0 - */ -class BlockList { - - /** - * Logger for this class. - */ - private static final org.nanoboot.powerframework.log.Logger LOG = org.nanoboot.powerframework.log.Logger.getLogger(BlockList.class); - - /** - * Constant description - */ - private final ArrayList blocks = new ArrayList<>(); - private Block currentBlock = null; - - void addLine(String lineIn) { - BlockType lineType = BlockType.getBlockType(lineIn); - if(currentBlock == null) { - currentBlock = new Block(lineType); - currentBlock.addLine(lineIn); - return; - } - try { - currentBlock.addLine(lineIn); - } catch (WikiException e) { - blocks.add(currentBlock); - currentBlock = new Block(lineType); - currentBlock.addLine(lineIn); - } - - } - - public ArrayList getList() { - if(currentBlock != null) { - blocks.add(currentBlock); - } - currentBlock = null; - return blocks; - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/BlockType.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/BlockType.java deleted file mode 100644 index 40b95ac..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/BlockType.java +++ /dev/null @@ -1,158 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -/** - * - * - * @author Robert Vokac - * @since 0.0.0 - */ - -enum BlockType { - - H1("Heading 1", true), - H2("Heading 2", true), - H3("Heading 3", true), - H4("Heading 4", true), - H5("Heading 5", true), - H6("Heading 6", true), - LIST("List", false), - BLANK("Blank line", true), - P("Paragraph", false), - TABLE("Table", false), - PARSER("Parser", false), - HR("Horizontal rule", false), - CONTENT("Content", false), - COMMENT("Comment", false); - - private String description; - private boolean oneLined; - - BlockType(String string, boolean oneLined) { - this.description = string; - this.oneLined = oneLined; - } - - static BlockType getBlockType(String line) { - if(line.isEmpty()) { - return BlockType.BLANK; - } - if(lineIsH1(line)) { - return BlockType.H1; - } - if(lineIsH2(line)) { - return BlockType.H2; - } - if(lineIsH3(line)) { - return BlockType.H3; - } - if(lineIsH4(line)) { - return BlockType.H4; - } - if(lineIsH5(line)) { - return BlockType.H5; - } - if(lineIsH6(line)) { - return BlockType.H6; - } - if(lineIsList(line)) { - return BlockType.LIST; - } - - if(lineIsTable(line)) { - return BlockType.TABLE; - } - if(lineIsParser(line)) { - return BlockType.PARSER; - } - if(lineIsHR(line)) { - return BlockType.HR; - } - if(lineIsComment(line)) { - return BlockType.COMMENT; - } - - return BlockType.P; - } - - private static boolean lineIsH1(String line) { - return line.startsWith(WikiMarks.HEADING1_START); - } - - private static boolean lineIsH2(String line) { - return line.startsWith(WikiMarks.HEADING2_START); - } - - private static boolean lineIsH3(String line) { - return line.startsWith(WikiMarks.HEADING3_START); - } - - private static boolean lineIsH4(String line) { - return line.startsWith(WikiMarks.HEADING4_START); - } - - private static boolean lineIsH5(String line) { - return line.startsWith(WikiMarks.HEADING5_START); - } - - private static boolean lineIsH6(String line) { - return line.startsWith(WikiMarks.HEADING6_START); - } - - private static boolean lineIsList(String line) { - line = " " + line.trim(); - return line.startsWith(WikiMarks.UNORDERED_LIST) || line.startsWith(WikiMarks.ORDERED_LIST); - } - - private static boolean lineIsTable(String line) { - return line.startsWith(WikiMarks.TABLE_BORDER); - } - - private static boolean lineIsParser(String line) { - return line.startsWith(WikiMarks.PARSER_START); - } - - private static boolean lineIsHR(String line) { - return line.startsWith(WikiMarks.HORIZONTAL_RULE_4); - } - - private static boolean lineIsComment(String line) { - return line.startsWith(WikiMarks.COMMENT_LINE_BEGINNING); - } - - public String getDescription() { - return description; - } - - public boolean isOneLined() { - return this.oneLined; - } - - public static boolean isIn(BlockType blockType, BlockType... blockTypes) { - for (BlockType e : blockTypes) { - if(e == blockType) { - return true; - } - } - return false; - } -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/HtmlTags.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/HtmlTags.java deleted file mode 100644 index c60e5bd..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/HtmlTags.java +++ /dev/null @@ -1,117 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -/** - * Here goes the description of this class. - * - * @author Robert Vokac - * @since 0.0.0 - */ -public class HtmlTags { - - /** - * Logger for this class. - */ - private static final org.nanoboot.powerframework.log.Logger LOG = org.nanoboot.powerframework.log.Logger.getLogger(HtmlTags.class); - - /** - * Constant description - */ - private static final String CONSTANT = "constant"; - - static final String B_START = ""; - public static final String B_END = ""; - public static final String I_START = ""; - public static final String I_END = ""; - public static final String U_START = ""; - public static final String U_END = ""; - public static final String COLOURED_START = ""; - public static final String COLOURED_END = ""; - public static final String BACKGROUND_HIGHLIGHTED_START = ""; - public static final String BACKGROUND_HIGHLIGHTED_END = ""; - public static final String SUPER_SCRIPT_START = ""; - public static final String SUPER_SCRIPT_END = ""; - public static final String SUB_SCRIPT_START = ""; - public static final String SUB_SCRIPT_END = ""; - public static final String MONOSPACE_START = ""; - public static final String MONOSPACE_SCRIPT_END = ""; - public static final String STROKE_START = ""; - public static final String STROKE_END = ""; - public static final String SMALLER_START = ""; - public static final String SMALLER_END = ""; - public static final String LARGER_START = ""; - public static final String LARGER_END = ""; - public static final String LINK = "%s"; - public static final String EMBED_IMG = "\"%s\""; - public static final String SIZE_START = ""; - public static final String SIZE_END = ""; - - public static final String H1_START = "

"; - public static final String H1_END = "

"; - public static final String H2_START = "

"; - public static final String H2_END = "

"; - public static final String H3_START = "

"; - public static final String H3_END = "

"; - public static final String H4_START = "

"; - public static final String H4_END = "

"; - public static final String H5_START = "
"; - public static final String H5_END = "
"; - public static final String H6_START = "
"; - public static final String H6_END = "
"; - - public static final String OL_START = "
    "; - public static final String OL_END = "
"; - public static final String UL_START = "
    "; - public static final String UL_END = "
"; - public static final String LI_START = "
  • "; - public static final String LI_END = "
  • "; - public static final String P_START = "

    "; - public static final String P_END = "

    "; - - public static final String TABLE_START = ""; - public static final String TABLE_END = "
    "; - public static final String TR_START = ""; - public static final String TR_END = ""; - public static final String TH_START = ""; - public static final String TH_END = ""; - public static final String TD_START = ""; - public static final String TD_END = ""; - - public static final String HR4 = "
    "; - public static final String HR5 = "
    "; - public static final String HR6 = "
    "; - public static final String HR7 = "
    "; - public static final String HR8 = "
    "; - public static final String HR9 = "
    "; - public static final String HR10 = "
    "; - - public static final String COMMENT_TEMPLATE = ""; - - /** - * Constructor - * - * Not meant to be instantiated. - */ - private HtmlTags() { - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/Macro.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/Macro.java deleted file mode 100644 index d7d9fed..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/Macro.java +++ /dev/null @@ -1,63 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -/** - * Here goes the description of this class. - * - * - * @author Robert Vokac - * @since 0.0.0 - */ - -public class Macro { - - /** - * Logger for this class. - */ - private static final org.nanoboot.powerframework.log.Logger LOG = org.nanoboot.powerframework.log.Logger.getLogger(Macro.class); - - /** - * Constant description - */ - private static final String CONSTANT = "constant"; - - /** - * Field description - */ - private String content; - private final String value; - - /** - * Constructor - * - * Constructor description - */ - public Macro(String content, TextProcessorI processor) { - this.content = content; - this.value = processor.process(content); - } - - public String getValue() { - return value; - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/StringSource.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/StringSource.java deleted file mode 100644 index 2b23885..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/StringSource.java +++ /dev/null @@ -1,75 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -/** - * Here goes the description of this class. - * - * @author Robert Vokac - * @since 0.0.0 - * - */ -public class StringSource { - - /** - * Logger for this class. - */ - private static final org.nanoboot.powerframework.log.Logger LOG = org.nanoboot.powerframework.log.Logger.getLogger(StringSource.class); - - /** - * Constant description - */ - private static final String CONSTANT = "constant"; - - /** - * Field description - */ - private String string; - private int position = 0; - - /** - * Constructor - * - */ - public StringSource(String string) { - this.string = string; - } - - public char getNext() { - return string.charAt(position++); - } - - public char getLast() { - if(position - 1 == 0) { - return ' '; - } - return string.charAt(position - 1); - } - - public boolean hasNext() { - return position <= string.length() - 1; - } - - public char get(int number) { - return string.charAt(position + number); - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/TextFormatter.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/TextFormatter.java deleted file mode 100644 index e560e48..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/TextFormatter.java +++ /dev/null @@ -1,81 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -/** - * Here goes the description of this class. - * - * - * @author Robert Vokac - * @since 0.0.0 - * - */ -public class TextFormatter { - - /** - * Logger for this class. - */ - private static final org.nanoboot.powerframework.log.Logger LOG = org.nanoboot.powerframework.log.Logger.getLogger(TextFormatter.class); - - /** - * Constant description - */ - private static final String CONSTANT = "constant"; - - /** - * Field description - */ - private String name; - - /** - * Constructor - * - * Not meant to be instantiated. - */ - private TextFormatter() { - } - - public static String format(String text) { - StringSource stringSource = new StringSource(text); - StringBuilder out = new StringBuilder(); - StringBuilder buffer = new StringBuilder(); - while (stringSource.hasNext()) { - char ch = stringSource.getNext(); - - if(ch == '[' && stringSource.getLast() == '[') { - ch = stringSource.getNext(); - while (!(ch == ']' && stringSource.get(1) == ']')) { - buffer.append(ch); - if(!stringSource.hasNext()) { - break; - } - ch = stringSource.getNext(); - } - out.append(buffer.toString()); - buffer.delete(0, buffer.length()); - }; - - } - - return out.toString(); - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/TextProcessorI.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/TextProcessorI.java deleted file mode 100644 index 8d44412..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/TextProcessorI.java +++ /dev/null @@ -1,34 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -/** - * - * - * @author Robert Vokac - * @since 0.0.0 - */ -public interface TextProcessorI { - - public String process(String text); - - public String getName(); -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiException.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiException.java deleted file mode 100644 index f825fda..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiException.java +++ /dev/null @@ -1,53 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -import org.nanoboot.powerframework.core.PowerException; - -/** - * Here goes the description of this class. - * - * @author Robert Vokac - * @since 0.0.0 - * - */ -public class WikiException extends PowerException { - - /** - * Logger for this class. - */ - private static final org.nanoboot.powerframework.log.Logger LOG = org.nanoboot.powerframework.log.Logger.getLogger(WikiException.class); - - /** - * Constant description - */ - private static final String CONSTANT = "constant"; - - /** - * Field description - */ - private String name; - - public WikiException(String messageIn) { - super(messageIn); - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiMarks.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiMarks.java deleted file mode 100644 index df0d2ba..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiMarks.java +++ /dev/null @@ -1,108 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -/** - * Here goes the description of this class. - * - * @author Robert Vokac - * @since 0.0.0 - * - */ -public class WikiMarks { - - /** - * Logger for this class. - */ - private static final org.nanoboot.powerframework.log.Logger LOG = org.nanoboot.powerframework.log.Logger.getLogger(WikiMarks.class); - - /** - * Constant description - */ - private static final String CONSTANT = "constant"; - - public static final String BOLD = "\\*\\*"; - public static final String ITALIC = "//"; - public static final String UNDERLINED = "__"; - public static final String COLOURED = "$$"; - public static final String BACKGROUND_HIGHLIGHTED = "##"; - public static final String SUPERSCRIPT = "^"; - public static final String SUBSCRIPT = ",,"; - public static final String MONOSPACE = "`"; - public static final String STROKE = "--"; - public static final String SMALLER_START = "~-"; - public static final String SMALLER_END = "-~"; - public static final String LARGER_START = "~+"; - public static final String LARGER_END = "+~"; - - public static final String LINK_START = "[["; - public static final String LINK_END = "]]"; - public static final String EMBED_START = "{{"; - public static final String EMBED_END = "}}"; - public static final String SIZE = "&&"; - - public static final String MACRO_START = "<<"; - public static final String MACRO_END = ">>"; - - public static final String PARSER_START = "{{{"; - public static final String PARSER_END = "}}}"; - - public static final String HEADING1_START = "= "; - public static final String HEADING2_START = "== "; - public static final String HEADING3_START = "=== "; - public static final String HEADING4_START = "==== "; - public static final String HEADING5_START = "===== "; - public static final String HEADING6_START = "====== "; - public static final String HEADING1_END = " ="; - public static final String HEADING2_END = " =="; - public static final String HEADING3_END = " ==="; - public static final String HEADING4_END = " ===="; - public static final String HEADING5_END = " ====="; - public static final String HEADING6_END = " ======"; - public static final String UNORDERED_LIST = " *"; - public static final String ORDERED_LIST = " 1."; - public static final String TABLE_BORDER = " || "; - public static final String TABLE_COLOURED = "$$$"; - public static final String TABLE_BACKGROUND_HIGHLIGHTED = "###"; - - public static final String HORIZONTAL_RULE_4 = "----"; - public static final String HORIZONTAL_RULE_5 = "-----"; - public static final String HORIZONTAL_RULE_6 = "------"; - public static final String HORIZONTAL_RULE_7 = "-------"; - public static final String HORIZONTAL_RULE_8 = "--------"; - public static final String HORIZONTAL_RULE_9 = "---------"; - public static final String HORIZONTAL_RULE_10 = "----------"; - public static final String COMMENT_LINE_BEGINNING = "####"; - - /** - * Field description - */ - private String name; - - /** - * Constructor - * - * Not meant to be instantiated. - */ - private WikiMarks() { - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiParser.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiParser.java deleted file mode 100644 index 149771f..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/WikiParser.java +++ /dev/null @@ -1,192 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Pattern; -import org.nanoboot.powerframework.utils.StringUtils; - -/** - * Here goes the description of this class. - * - * @author Robert Vokac - * @since 0.0.0 - * - */ -public class WikiParser { - - /** - * Logger for this class. - */ - //private static final org.nanoboot.powerframework.logging.Logger LOG = org.nanoboot.powerframework.logging.Logger.getLogger(WikiParser.class); - /** - * Constant description - */ - private static final String CONSTANT = "constant"; - - /** - * Field description - */ - private static TextProcessorI linkProcessor; - private static final Map macroProcessorsList = new HashMap<>(); - - /** - * Constructor - * - * Not meant to be instantiated. - */ - public static void setLinkProcessor(TextProcessorI linkProcessorIn) { - linkProcessor = linkProcessorIn; - } - - public String convertWiki(String wikiText) { - System.out.println("Converting wiki text:\n\n"+wikiText); - ArrayList blocks = splitWikiTextToBlocks(wikiText); - StringBuilder stringBuilder = new StringBuilder(); - for (Block block : blocks) { - System.out.println("\n====================\n"+block.getBlockType()+"\n\n"); - String html = block.toHtml(); - System.out.println(block.getOrig()); - System.out.println("VVVVVVVVVVVVVVVVVVVV"); -System.out.println(html); - stringBuilder.append(html).append('\n').append('\n'); - } - String string = stringBuilder.toString(); - return string; - } - - public void setStyle(String string) { - - } - - public void addMacroProcessor(TextProcessorI macroProcessor) { - macroProcessorsList.put(macroProcessor.getName(), macroProcessor); - } - - public TextProcessorI getMacroProcessor(String macroName) { - return macroProcessorsList.get(macroName); - } - - @Deprecated - public static String convert(String wikiText) { - - //System.err.println("\n\n\nWIKI" + "\n{\n" + wikiText + "\n}######$$$"); - while (true) { - if(wikiText.contains(WikiMarks.BOLD)) { - wikiText = wikiText.replaceFirst(WikiMarks.BOLD, HtmlTags.B_START); - //System.err.println(String.format("Replacing %s by %s", BOLD, B_START)); - } - if(wikiText.contains(WikiMarks.BOLD)) { - wikiText = wikiText.replaceFirst(WikiMarks.BOLD, HtmlTags.B_END); - //System.err.println(String.format("Replacing %s by %s", BOLD, B_END)); - } - - if(!wikiText.contains(WikiMarks.BOLD)) { - break; - } - } - - while (true) { - - if(wikiText.contains(WikiMarks.ITALIC)) { - wikiText = wikiText.replaceFirst(WikiMarks.ITALIC, HtmlTags.I_START); - //System.err.println(String.format("Replacing %s by %s", ITALIC, I_START)); - } - if(wikiText.contains(WikiMarks.ITALIC)) { - wikiText = wikiText.replaceFirst(WikiMarks.ITALIC, HtmlTags.I_END); - //System.err.println(String.format("Replacing %s by %s", ITALIC, I_END)); - } - if(!wikiText.contains(WikiMarks.ITALIC)) { - break; - } - } - StringBuilder stringBuilder = new StringBuilder(); - - ArrayList blocks = splitWikiTextToBlocks(wikiText); - -// StringBuilder stringBuilder2 = new StringBuilder("Adding block\n\n"); -// for (Block block : blocks) { -// stringBuilder2.append("\n###{\n").append(block.toHtml()).append("\n}\n"); -// } - //System.err.println(stringBuilder2); -// try { -// Thread.sleep(10000); -// } catch (InterruptedException ex) { -// Logger.getLogger(WikiParser.class.getName()).log(Level.SEVERE, null, ex); -// } - for (Block block : blocks) { - String html = block.toHtml(); - - stringBuilder.append(html).append('\n').append('\n'); - } - String string = stringBuilder.toString(); - //System.out.println("Wiki convertor returned\n\n\n{\n" + string + "\n}\n\n\n"); - return string; - } - - @Deprecated - private String processText(String text) { - StringSource stringSource = new StringSource(text); - StringBuilder out = new StringBuilder(); - StringBuilder buffer = new StringBuilder(); - while (stringSource.hasNext()) { - char ch = stringSource.getNext(); - - if(ch == '[' && stringSource.getLast() == '[') { - ch = stringSource.getNext(); - while (!(ch == ']' && stringSource.get(1) == ']')) { - buffer.append(ch); - if(!stringSource.hasNext()) { - break; - } - ch = stringSource.getNext(); - } - out.append(buffer.toString()); - buffer.delete(0, buffer.length()); - }; - - } - - return out.toString(); - } - - @Deprecated - public static void replaceOccurences(StringBuilder stringBuilder, String what, String replacement) { - Pattern.compile(what).matcher(stringBuilder).replaceAll(replacement); - } - - public static ArrayList splitWikiTextToBlocks(String wikiText) { - BlockList blockList = new BlockList(); - - ArrayList blocks; - String[] lines = StringUtils.toLines(wikiText); - - for (String line : lines) { - blockList.addLine(line); - } - blocks = blockList.getList(); - - return blocks; - } - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/convertors/ListConvertor.java b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/convertors/ListConvertor.java deleted file mode 100644 index 124c680..0000000 --- a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/convertors/ListConvertor.java +++ /dev/null @@ -1,89 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////////////////////// -// power-framework: Java library with many purposes of usage. -// Copyright (C) 2016-2022 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; -// version 2.1 of the License only. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package org.nanoboot.powerframework.wiki.convertors; - -import org.nanoboot.powerframework.core.PowerObject; - -/** - * Here goes the description of this class. - * - * @author Robert Vokac - * @since 0.0.0 - * - */ -public class ListConvertor extends PowerObject { - - /** - * Logger for this class. - */ - private static final org.nanoboot.powerframework.log.Logger LOG = org.nanoboot.powerframework.log.Logger.getLogger(ListConvertor.class); - - /** - * Constant description - */ - private static final String CONSTANT = "constant"; - - /** - * Field description - */ - private String name; - - /** - * Constructor - * - * Not meant to be instantiated. - */ - private ListConvertor() { - } - - /** - * Constructor - * - * Constructor description - * - * @param nameIn - */ - public ListConvertor(String nameIn) { - this.name = nameIn; - } - - /** - * Setter for name. - * - * @param nameIn - */ - public void setName(String nameIn) { - LOG.traceStartOfMethod(this, "setName", "name", name); - this.name = nameIn; - } - - /** - * Getter for name. - * - * @return name - */ - public String getName() { - LOG.traceStartOfMethod(this, "getName"); - return this.name; - } - - -} diff --git a/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/macroprocessors/.gitkeep b/power-wiki/src/main/java/org/nanoboot/powerframework/wiki/macroprocessors/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/power-wiki/src/main/resources/.gitkeep b/power-wiki/src/main/resources/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/power-wiki/src/test/java/org/nanoboot/powerframework/wiki/.gitkeep b/power-wiki/src/test/java/org/nanoboot/powerframework/wiki/.gitkeep deleted file mode 100644 index e69de29..0000000