From: Olivier Lamy Date: Sat, 6 Oct 2012 15:12:45 +0000 (+0000) Subject: resize a bit doc h1/h2/h3 are quite big X-Git-Tag: archiva-1.4-M4~805 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a69ee292be0e4104993cb911a8ac61d0adb69152;p=archiva.git resize a bit doc h1/h2/h3 are quite big git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1395092 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/docs/RestDocsServlet.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/docs/RestDocsServlet.java index a7f0e0fe8..76cf0667f 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/docs/RestDocsServlet.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/docs/RestDocsServlet.java @@ -65,9 +65,7 @@ public class RestDocsServlet for ( Iterator elementIterator = links.iterator(); elementIterator.hasNext(); ) { Element link = elementIterator.next(); - //link.attr( "onclick", "loadRestDocs('" + startPath + "\',\'"+ "rest-docs/" + startPath + "/" + link.attr( "href" ) + "\');" ); link.attr( "href", "#" + startPath + "/" + link.attr( "href" ) ); - } Elements codes = body.select( "code" ); @@ -78,14 +76,36 @@ public class RestDocsServlet code.attr( "class", code.attr( "class" ) + " nice-code" ); } - //res.appendChild( body.child( 1 ) ); + //default generated enunciate use h1/h2/h3 which is quite big so transform to h3/h4/h5 + + Elements headers = body.select( "h1" ); + + for ( Iterator elementIterator = headers.iterator(); elementIterator.hasNext(); ) + { + Element header = elementIterator.next(); + header.tagName( "h3" ); + } + + headers = body.select( "h2" ); + + for ( Iterator elementIterator = headers.iterator(); elementIterator.hasNext(); ) + { + Element header = elementIterator.next(); + header.tagName( "h4" ); + } + + headers = body.select( "h3" ); + + for ( Iterator elementIterator = headers.iterator(); elementIterator.hasNext(); ) + { + Element header = elementIterator.next(); + header.tagName( "h5" ); + } Document res = new Document( "" ); res.appendChild( body.select( "div[id=main]" ).first() ); resp.getOutputStream().write( res.outerHtml().getBytes() ); - //IOUtils.copy( is, resp.getOutputStream() ); - //super.doGet( req, resp ); } } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/docs.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/docs.html index f33d0bfde..de072bc92 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/docs.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/docs.html @@ -20,7 +20,7 @@