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; }
/** {@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 ); }
/** * 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_(); }
link( "#" + HtmlTools.encodeId( name ), name ); sink.listItem_();
super.sink.anchor( HtmlTools.encodeId( anchor ) ); super.sink.anchor_();