/** * <p>escapeSGML</p> * * @param text The text to escape. * @param xmlMode xmlMode. * @return The escaped text. * @deprecated Use HtmlTools#escapeHTML(String,boolean). */ public static final String escapeSGML( String text, boolean xmlMode ) { return HtmlTools.escapeHTML( text, xmlMode ); }
private String chopExtension( String name ) { String anchor = name; int dot = anchor.lastIndexOf( "." ); if ( dot != -1 && dot != anchor.length() && anchor.charAt( dot + 1 ) != '/' ) { int hash = anchor.indexOf( "#", dot ); if ( hash != -1 ) { int dot2 = anchor.indexOf( ".", hash ); if ( dot2 != -1 ) { anchor = anchor.substring( 0, dot ) + "#" + HtmlTools.encodeId( anchor.substring( hash + 1, dot2 ) ); } else { anchor = anchor.substring( 0, dot ) + "#" + HtmlTools.encodeId( anchor.substring( hash + 1, anchor.length() ) ); } } else { anchor = anchor.substring( 0, dot ); } } return anchor; }
private void handleSectionStart( int level, Sink sink, SinkEventAttributeSet attribs, XmlPullParser parser ) { consecutiveSections( level, sink ); Object id = attribs.getAttribute( Attribute.ID.toString() ); if ( id != null ) { sink.anchor( id.toString() ); sink.anchor_(); } sink.section( level, attribs ); sink.sectionTitle( level, null ); sink.text( HtmlTools.unescapeHTML( parser.getAttributeValue( null, Attribute.NAME.toString() ) ) ); sink.sectionTitle_( level ); }
/** * Forward to HtmlTools.escapeHTML( text ). * * @param text the String to escape, may be null * @return the text escaped, "" if null String input * @see org.apache.maven.doxia.util.HtmlTools#escapeHTML(String) */ protected static String escapeHTML( String text ) { return HtmlTools.escapeHTML( text ); } }
/** {@inheritDoc} */ @Override protected void onSectionTitle_( int depth ) { String sectionTitle = sectionTitleBuffer.toString(); this.sectionTitleBuffer = null; String sectionWriteTitle = sectionTitleWriteBuffer.toString(); this.sectionTitleWriteBuffer = null; if ( !StringUtils.isEmpty( sectionTitle ) ) { if ( sectionHasID ) { sectionHasID = false; } else { String id = HtmlTools.encodeId( sectionTitle ); if ( ( anchorsInSectionTitle == null ) || ( !anchorsInSectionTitle.contains( id ) ) ) { anchor( id ); anchor_(); } } } super.write( sectionWriteTitle ); this.isSectionTitle = false; anchorsInSectionTitle = null; super.onSectionTitle_( depth ); }
/** * Forward to HtmlTools.escapeHTML( text ). * * @param text the String to escape, may be null * @return the text escaped, "" if null String input * @see org.apache.maven.doxia.util.HtmlTools#escapeHTML(String) */ protected static String escapeHTML( String text ) { return HtmlTools.escapeHTML( text ); } }
/** * Write subsection index for the book index. * * @param sink the XdocSink. * @param sectionIndex the section IndexEntry. * @param subsectionIndex the subsection IndexEntry. */ private void writeSubsectionIndexForBookIndex( XdocSink sink, IndexEntry sectionIndex, IndexEntry subsectionIndex ) { sink.listItem(); sink.link( sectionIndex.getId() + ".html#" + HtmlTools.encodeId( subsectionIndex.getId() ) ); sink.text( subsectionIndex.getTitle() ); sink.link_(); sink.listItem_(); }
/** * Write SGML escaped text to output, not preserving white space. * * @param text The text to write. */ protected void content( String text ) { if ( !skip ) { out.write( HtmlTools.escapeHTML( text, true ) ); } }
link( "#" + HtmlTools.encodeId( name ), name ); sink.listItem_();
/** * Write SGML escaped text to output, preserving white space. * * @param text The text to write. */ protected void verbatimContent( String text ) { if ( !skip ) { out.write( HtmlTools.escapeHTML( text, true ) ); } }
super.sink.anchor( HtmlTools.encodeId( anchor ) ); super.sink.anchor_();
/** {@inheritDoc} */ @Override public void author_() { if ( getTextBuffer().length() > 0 ) { String text = HtmlTools.escapeHTML( getTextBuffer().toString() ); text = StringUtils.replace( text, "&#", "&#" ); authors.add( text.trim() ); } resetTextBuffer(); }
/** {@inheritDoc} */ protected void handleEntity( XmlPullParser parser, Sink sink ) throws XmlPullParserException { if ( buffer != null ) { if ( parser.getText() != null ) { String text = parser.getText(); // parser.getText() returns the entity replacement text // (< -> <), need to re-escape them if ( text.length() == 1 ) { text = HtmlTools.escapeHTML( text ); } buffer.append( text ); } } else { super.handleEntity( parser, sink ); } }
/** * {@inheritDoc} * @see SimplifiedDocbookMarkup#ULINK_TAG * @see SimplifiedDocbookMarkup#URL_ATTRIBUTE * @see SimplifiedDocbookMarkup#LINK_TAG * @see SimplifiedDocbookMarkup#LINKEND_ATTRIBUTE */ public void link( String name ) { if ( name == null ) { throw new NullPointerException( "Link name cannot be null!" ); } if ( DoxiaUtils.isInternalLink( name ) ) { String linkend = name.substring( 1 ); MutableAttributeSet att = new SimpleAttributeSet(); att.addAttribute( SimplifiedDocbookMarkup.LINKEND_ATTRIBUTE, HtmlTools.escapeHTML( linkend ) ); writeStartTag( SimplifiedDocbookMarkup.LINK_TAG, att ); } else { externalLinkFlag = true; MutableAttributeSet att = new SimpleAttributeSet(); att.addAttribute( SimplifiedDocbookMarkup.URL_ATTRIBUTE, HtmlTools.escapeHTML( name, true ) ); writeStartTag( SimplifiedDocbookMarkup.ULINK_TAG, att ); } }
/** * {@inheritDoc} * @see XdocMarkup#AUTHOR_TAG */ public void author_() { if ( getTextBuffer().length() > 0 ) { writeStartTag( AUTHOR_TAG ); String text = HtmlTools.escapeHTML( getTextBuffer().toString() ); // hack: un-escape numerical entities that have been escaped above // note that numerical entities should really be written as one unicode character in the first place text = StringUtils.replace( text, "&#", "&#" ); write( text ); writeEndTag( AUTHOR_TAG ); resetTextBuffer(); } }
/** {@inheritDoc} */ public void figureGraphics( String name ) { String format = FileUtils.extension( name ).toUpperCase( Locale.ENGLISH ); writeStartTag( SimplifiedDocbookMarkup.IMAGEOBJECT_TAG ); MutableAttributeSet att = new SimpleAttributeSet(); att.addAttribute( SimplifiedDocbookMarkup.FORMAT_ATTRIBUTE, format ); att.addAttribute( SimplifiedDocbookMarkup.FILEREF_ATTRIBUTE, HtmlTools.escapeHTML( name, true ) ); writeSimpleTag( SimplifiedDocbookMarkup.IMAGEDATA_TAG, att ); writeEndTag( SimplifiedDocbookMarkup.IMAGEOBJECT_TAG ); }
writeStartTag( BASIC_LINK_TAG, "external-destination", HtmlTools.escapeHTML( name ) ); writeStartTag( INLINE_TAG, "href.external" ); writeStartTag( BASIC_LINK_TAG, "internal-destination", HtmlTools.escapeHTML( anchor ) ); writeStartTag( INLINE_TAG, "href.internal" ); writeStartTag( BASIC_LINK_TAG, "internal-destination", HtmlTools.escapeHTML( anchor ) ); writeStartTag( INLINE_TAG, "href.internal" );
writeStartTag( BASIC_LINK_TAG, "external-destination", HtmlTools.escapeHTML( name ) ); writeStartTag( INLINE_TAG, "href.external" ); return; writeStartTag( BASIC_LINK_TAG, "internal-destination", HtmlTools.escapeHTML( anchor ) ); writeStartTag( INLINE_TAG, "href.internal" ); writeStartTag( BASIC_LINK_TAG, "internal-destination", HtmlTools.escapeHTML( name ) ); writeStartTag( INLINE_TAG, "href.internal" ); writeStartTag( BASIC_LINK_TAG, "internal-destination", HtmlTools.escapeHTML( anchor ) ); writeStartTag( INLINE_TAG, "href.internal" ); anchor = base + "/" + anchor; writeStartTag( BASIC_LINK_TAG, "internal-destination", HtmlTools.escapeHTML( anchor ) ); writeStartTag( INLINE_TAG, "href.internal" );
/** * Adds a link with an optional target. * * @param name the link name. * @param target the link target, may be null. */ public void link( String name, String target ) { if ( isHeadFlag() ) { return; } MutableAttributeSet att = new SinkEventAttributeSet(); att.addAttribute( Attribute.HREF, HtmlTools.escapeHTML( name ) ); if ( target != null ) { att.addAttribute( Attribute.TARGET, target ); } writeStartTag( A, att ); }
att.addAttribute( SimplifiedDocbookMarkup.FORMAT_ATTRIBUTE, format ); att.addAttribute( SimplifiedDocbookMarkup.FILEREF_ATTRIBUTE, HtmlTools.escapeHTML( graphicsFileName, true ) );