Package info.bliki.wiki.namespaces

Examples of info.bliki.wiki.namespaces.INamespace$INamespaceValue


    }
   
    if (name.equals(MAGIC_TALK_PAGE_NAME)) {
      String temp = model.getPageName();
      if (temp != null) {
        INamespace ns = model.getNamespace();
        if (parameter.length() > 0) {
          String namespace = parameter;
          int index = namespace.indexOf(':');
          if (index > 0) {
            // {{TALKPAGENAME:Template:Sandbox}}
            String rest = namespace.substring(index + 1);
            namespace = namespace.substring(0, index);
            String talkspace = ns.getTalkspace(namespace);
            if (talkspace != null) {
              return talkspace + ":" + rest;
            }
          }
          return ns.getTalk() + ":" + parameter;
        }
        return ns.getTalk() + temp;
      }
    }

    return name;
  }
View Full Code Here


        return temp;
      }
    } else if (name.equals(MAGIC_TALK_PAGE_NAME)) {
      String temp = model.getPageName();
      if (temp != null) {
        INamespace ns = model.getNamespace();
        if (parameter.length() > 0) {
          String namespace = parameter;
          int index = namespace.indexOf(':');
          if (index > 0) {
            // {{TALKPAGENAME:Template:Sandbox}}
            String rest = namespace.substring(index + 1);
            namespace = namespace.substring(0, index);
            String talkspace = ns.getTalkspace(namespace);
            if (talkspace != null) {
              return talkspace + ":" + rest;
            }
          }
          return ns.getTalk() + ":" + parameter;
        }
        return ns.getTalk() + temp;
      }
    }

    return name;
  }
View Full Code Here

  @Override
  public String parseFunction(List<String> list, IWikiModel model, char[] src, int beginIndex, int endIndex, boolean isSubst) {
    if (list.size() > 0) {
      String arg0 = isSubst ? list.get(0) : parseTrim(list.get(0), model);
      INamespace namespace = model.getNamespace();
      try {
        int numberCode = Integer.valueOf(arg0).intValue();
        try {
          return namespace.getNamespaceByNumber(numberCode);
        } catch (InvalidParameterException ipe) {
          // nothing to do
        }
      } catch (NumberFormatException nfe) {
        // the given argument could not be parsed as integer number
        arg0 = arg0.replace(' ', '_');
        String value = namespace.getNamespaceByLowercase(arg0.toLowerCase());
        if (value != null) {
          return value;
        }
        return "[[:" + model.getTemplateNamespace() + ":Ns:" + arg0 + "]]";
      }
View Full Code Here

  @Override
  public String parseFunction(List<String> list, IWikiModel model, char[] src, int beginIndex, int endIndex, boolean isSubst) {
    if (list.size() > 0) {
      String arg0 = isSubst ? list.get(0) : parseTrim(list.get(0), model);
      INamespace namespace = model.getNamespace();
      try {
        int numberCode = Integer.valueOf(arg0).intValue();
        if (numberCode >= (-2) || numberCode <= 15) {
          return namespace.getNamespaceByNumber(numberCode);
        }
      } catch (NumberFormatException nfe) {
        // the given argument could not be parsed as integer number
        arg0 = arg0.replace(' ', '_');
        String value = namespace.getNamespaceByLowercase(arg0.toLowerCase());
        if (value != null) {
          return value;
        }
        return "[[:Template:Ns:" + arg0 + "]]";
      }
View Full Code Here

    }

    if (name.equals(MAGIC_TALK_PAGE_NAME)) {
      String temp = model.getPageName();
      if (temp != null) {
        INamespace ns = model.getNamespace();
        if (parameter.length() > 0) {
          String namespace = parameter;
          int index = namespace.indexOf(':');
          if (index > 0) {
            // {{TALKPAGENAME:Template:Sandbox}}
            String rest = namespace.substring(index + 1);
            namespace = namespace.substring(0, index);
            String talkspace = ns.getTalkspace(namespace);
            if (talkspace != null) {
              return talkspace + ":" + rest;
            }
          }
          return ns.getTalk() + ":" + parameter;
        }
        return ns.getTalk() + temp;
      }
    }

    return name;
  }
View Full Code Here

  public String parseFunction(char[] src, int beginIndex, int endIndex, IWikiModel model) throws IOException {
    List<String> list = new ArrayList<String>();
    WikipediaScanner.splitByPipe(src, beginIndex, endIndex, list);
    if (list.size() > 0) {
      String arg0 = parse(list.get(0), model);
      INamespace namespace = model.getNamespace();
      try {
        int numberCode = Integer.valueOf(arg0).intValue();
        if (numberCode >= (-2) || numberCode <= 15) {
          return namespace.getNamespaceByNumber(numberCode);
        }
      } catch (NumberFormatException nfe) {
        // the given argument could not be parsed as integer number
        arg0 = arg0.replace(' ', '_');
        String value = namespace.getNamespaceByLowercase(arg0.toLowerCase());
        if (value != null) {
          return value;
        }
        return "[[:Template:Ns:" + arg0 + "]]";
      }
View Full Code Here

    }
   
    if (name.equals(MAGIC_TALK_PAGE_NAME)) {
      String temp = model.getPageName();
      if (temp != null) {
        INamespace ns = model.getNamespace();
        if (parameter.length() > 0) {
          String namespace = parameter;
          int index = namespace.indexOf(':');
          if (index > 0) {
            // {{TALKPAGENAME:Template:Sandbox}}
            String rest = namespace.substring(index + 1);
            namespace = namespace.substring(0, index);
            String talkspace = ns.getTalkspace(namespace.toLowerCase());
            if (talkspace != null) {
              return talkspace + ":" + rest;
            }
          }
          return ns.getTalk() + ":" + parameter;
        }
        return ns.getTalk() + temp;
      }
    }
    // statistics
    // NumberFormat numFormatter = NumberFormat.getInstance();
    // if (name.equals(MAGIC_CURRENT_VERSION)) {
View Full Code Here

    return new ParsedPageName(namespace, pagename, magicWord, magicWordParameter, true);
  }

  public static String getRedirectedTemplateContent(IWikiModel wikiModel, String redirectedLink,
      Map<String, String> templateParameters) {
    final INamespace namespace = wikiModel.getNamespace();
    ParsedPageName parsedPagename = AbstractParser.parsePageName(wikiModel, redirectedLink, namespace.getMain(), false, false);
    // note: don't just get redirect content if the namespace is the template
    // namespace!
    if (!parsedPagename.valid) {
      return null;
    }
View Full Code Here

        TemplateParser.createSingleParameter(parts.get(i), model, parameterMap, unnamedParameters);
      }
    }
    TemplateParser.mergeParameters(parameterMap, unnamedParameters);

    final INamespace namespace = model.getNamespace();
    // TODO: remove trailing "#section"?!
    ParsedPageName parsedPagename = AbstractParser.parsePageName(model, templateName, namespace.getTemplate(), true, false);
    if (!parsedPagename.valid) {
      return "{{" + parsedPagename.pagename + "}}";
    }
   
    String plainContent = model.getRawWikiContent(parsedPagename, parameterMap);
View Full Code Here

  @Override
  public String parseFunction(List<String> list, IWikiModel model, char[] src, int beginIndex, int endIndex, boolean isSubst) {
    if (list.size() > 1) {
      String wikiTopicName = isSubst ? list.get(0) : parseTrim(list.get(0), model);
     
      final INamespace namespace = model.getNamespace();
      // note: appended "#section" does not count for the check whether a page exists or not!
      // -> strip off
      ParsedPageName parsedPagename = AbstractParser.parsePageName(model, wikiTopicName, namespace.getMain(), false, true);
      String rawWikiContent = null;
      // if parsing failed, e.g. double "::" at the page titles beginning, this is the same as if the page does not exist.
      if (parsedPagename.valid) {
        rawWikiContent = model.getRawWikiContent(parsedPagename, null);
      }
View Full Code Here

TOP

Related Classes of info.bliki.wiki.namespaces.INamespace$INamespaceValue

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.