private void _emitXMLComment (final MarkdownHCStack out, final Line lines) { Line line = lines; final StringBuilder aXML = new StringBuilder (); while (line != null) { if (!line.m_bIsEmpty) { // Append without trimming! aXML.append (line.m_sValue); } aXML.append ('\n'); line = line.m_aNext; } // Trim only once, so that newlines before or after a comment start/close is // removed final String sContent = StringHelper.trimStartAndEnd (aXML.toString ().trim (), XMLEmitter.COMMENT_START, XMLEmitter.COMMENT_END); out.append (new HCCommentNode (sContent)); }
/** * Clean the provided path and split it into parts. * * @param sPath * Source path * @return The list with all path parts. Never <code>null</code>. */ @Nonnull @ReturnsMutableCopy public static ICommonsList <String> getCleanPathParts (@Nonnull final String sPath) { // Remove leading and trailing whitespaces and slashes String sRealPath = StringHelper.trimStartAndEnd (sPath.trim (), "/", "/"); // Remove obscure path parts sRealPath = FilenameHelper.getCleanPath (sRealPath); // Split into pieces final ICommonsList <String> aPathParts = StringHelper.getExploded ('/', sRealPath); return aPathParts; } }
@Nonnull protected PhotonRequestParameters getParametersFromPath (@Nonnull final String sPath, @Nonnull final IMenuTree aMenuTree) { // Use paths for standard menu items final PhotonRequestParameters ret = new PhotonRequestParameters (); for (final String sParamValue : StringHelper.getExploded ('/', StringHelper.trimStartAndEnd (sPath, "/"))) { if (!ret.hasLocale ()) if (ret.setLocaleFromString (GlobalLocaleManager.getInstance (), sParamValue) != null) continue; if (!ret.hasMenuItem ()) if (ret.setMenuItemFromString (aMenuTree, sParamValue) != null) continue; if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Ignoring superfluous parameter '" + sParamValue + "'"); } return ret; }
@Nonnull protected PhotonRequestParameters getParametersFromPath (@Nonnull final String sPath, @Nonnull final IMenuTree aMenuTree) { // Use paths for standard menu items final PhotonRequestParameters ret = new PhotonRequestParameters (); for (final String sPair : StringHelper.getExploded ('/', StringHelper.trimStartAndEnd (sPath, "/"))) { final ICommonsList <String> aElements = StringHelper.getExploded (m_sSeparator, sPair, 2); if (aElements.size () == 2) { final String sParamName = aElements.get (0); final String sParamValue = aElements.get (1); if (sParamName.equals (getRequestParamNameLocale ())) ret.setLocaleFromString (GlobalLocaleManager.getInstance (), sParamValue); else if (sParamName.equals (getRequestParamNameMenuItem ())) ret.setMenuItemFromString (aMenuTree, sParamValue); else if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Ignoring superfluous parameter '" + sParamName + "' with value '" + sParamValue + "'"); } } return ret; }
final String sRealContentID = StringHelper.trimStartAndEnd (aBodyPart.getContentID (), '<', '>'); ret.setId (sRealContentID);