private String convertWikimarkupToViewFormat(String value, ConversionContext conversionContext, List<RuntimeException> errors) throws XhtmlException, XMLStreamException { return xhtmlUtils.convertStorageToView(xhtmlUtils.convertWikiToStorage(value, conversionContext, errors), conversionContext); } }
private String getBookmarkDescriptionRendered(ContentEntityObject contentEntityObject) { String bookmarkDescription = StringUtils.defaultString(bookmarkMacroParser.getParameters(contentEntityObject).get("description")); try { return xhtmlContent.convertStorageToView( bookmarkDescription, new DefaultConversionContext(contentEntityObject.toPageContext()) ); } catch (Exception e) { LOG.error("Error rendering bookmark description. Returning markup instead", e); return bookmarkDescription; } }
/** * This macro operates on the body of the content entity (e.g. the page) on which the macro is a part of. This * method fetches the content body (which should be in XHTML storage-format), renders that to view-format, then * returns that to be used as the basis of the TOC generation. */ @Override protected String getContent(final Map<String, String> parameters, final String body, final ConversionContext conversionContext) { final ContentEntityObject contentEntity = conversionContext.getEntity(); if (contentEntity == null) { log.warn("There was an error converting the preview content to view - content entity object was null."); return ""; } try { return xhtmlContent.convertStorageToView(contentEntity.getBodyAsString(), conversionContext); } catch (Exception ex) { log.warn("There was an error converting the content for id " + contentEntity.getId() + " to storage format.", ex); return ""; } }
protected String getContent(Map<String, String> parameters , String body, ConversionContext conversionContext) { ContentEntityObject ceo = conversionContext.getEntity(); if (ceo == null) { log.warn("There was an error converting the preview content to view - content entity object was null."); return ""; } String pageContent = ceo.getBodyAsString(); try { return getXhtmlContent().convertStorageToView(pageContent, conversionContext); } catch (Exception ex) { log.warn("There was an error converting the content for id " + ceo.getId() + " to storage format.", ex); return ""; } }
final String xhtml = xhtmlContent.convertStorageToView( xhtmlContent.convertWikiToStorage(bodyText, conversionContext, conversionErrors), conversionContext
renderedValue = xhtmlContent.convertStorageToView(headingStorageFormat, context);
@Override public String getViewFormat(String authToken, String pageId) throws XMLStreamException, XhtmlException { ContentEntityObject contentEntityObject = getContentEntityObject(pageId); return null == contentEntityObject ? null : xhtmlContent.convertStorageToView(contentEntityObject.getBodyAsString(), new DefaultConversionContext(contentEntityObject.toPageContext())); }
private String renderRichText( Renderable renderable ) throws RenderException { try { return XhtmlUtils.stripParagraphWrapper( xhtmlContent.convertStorageToView( renderable.getText(), renderable.getConversionContext()) ); } catch ( XMLStreamException e ) { throw new RenderException( e.getMessage(), e ); } catch ( XhtmlException e ) { throw new RenderException( e.getMessage(), e ); } } }
protected InputStream getContentInternal() throws IOException { /* Mostly copied from PageWordExportAction to generate MS Word exports of a page */ Page page = getPage(); PageContext context = page.toPageContext(); Settings globalSettings = settingsManager.getGlobalSettings(); Map<String, Object> contextMap; context.setBaseUrl(globalSettings.getBaseUrl()); context.setSiteRoot(bootstrapManager.getWebAppContextPath()); context.setOutputType(RenderContextOutputType.WORD); context.setLinkRenderer(new WordDocLinkRenderer(context)); String renderedContent = ""; try { renderedContent = xhtmlContent.convertStorageToView(page.getBodyContent().getBody(), new DefaultConversionContext(context)); } catch (XMLStreamException e) { throw new IOException(e); } catch (XhtmlException e) { throw new IOException(e); } contextMap = new HashMap<String, Object>(); contextMap.put("renderedContent", renderedContent); contextMap.put("domainName", globalSettings.getBaseUrl()); contextMap.put("page", page); return new ByteArrayInputStream( VelocityUtils.getRenderedTemplate("templates/extra/webdav/exportword.vm", contextMap).getBytes(globalSettings.getDefaultEncoding())); }
try final String renderedValue = xhtmlContent.convertStorageToView(value, subContext);