Package info.bliki.wiki.namespaces

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


  }

  public static String getRedirectedTemplateContent(IWikiModel wikiModel, String redirectedLink,
      Map<String, String> templateParameters) {
    try {
      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;
      }
      int level = wikiModel.incrementRecursionLevel();
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 = null;
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) {
        try {
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).toString();
        } catch (InvalidParameterException ipe) {
          // nothing to do
        }
      } catch (NumberFormatException nfe) {
        // the given argument could not be parsed as integer number
        INamespaceValue value = namespace.getNamespace(arg0);
        if (value != null) {
          return value.getPrimaryText();
        }
        return "[[:" + namespace.getTemplate().getPrimaryText() + ":Ns:" + arg0 + "]]";
      }
    }
    return null;
  }
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

   *            the model being used
   *
   * @return the extracted namespace or <tt>null</tt> if the parameter was empty
   */
  protected static INamespaceValue getNamespaceHelper(String parameter, IWikiModel model) {
    final INamespace namespaceObj = model.getNamespace();
    if (parameter != null) {
      if (parameter.length() > 0) {
        String[] split = model.splitNsTitle(parameter);
        return namespaceObj.getNamespace(split[0]);
      } else {
        return null;
      }
    } else {
      return namespaceObj.getNamespace(model.getNamespaceName());
    }
  }
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) {
                try {
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).toString();
                } catch (InvalidParameterException ipe) {
                    // nothing to do
                }
            } catch (NumberFormatException nfe) {
                // the given argument could not be parsed as integer number
                INamespaceValue value = namespace.getNamespace(arg0);
                if (value != null) {
                    return value.getPrimaryText();
                }
                return "[[:" + namespace.getTemplate().getPrimaryText() + ":Ns:" + arg0 + "]]";
            }
        }
        return null;
    }
View Full Code Here

     *            the model being used
     *
     * @return the extracted namespace or <tt>null</tt> if the parameter was empty
     */
    protected static INamespaceValue getNamespaceHelper(String parameter, IWikiModel model) {
        final INamespace namespaceObj = model.getNamespace();
        if (parameter != null) {
            if (parameter.length() > 0) {
                String[] split = model.splitNsTitle(parameter);
                return namespaceObj.getNamespace(split[0]);
            } else {
                return null;
            }
        } else {
            return namespaceObj.getNamespace(model.getNamespaceName());
        }
    }
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 = 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.