]> source.dussan.org Git - archiva.git/commitdiff
resize a bit doc h1/h2/h3 are quite big
authorOlivier Lamy <olamy@apache.org>
Sat, 6 Oct 2012 15:12:45 +0000 (15:12 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 6 Oct 2012 15:12:45 +0000 (15:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1395092 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/docs/RestDocsServlet.java
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/docs.html

index a7f0e0fe87754c27675f9459422f09efdd336b9f..76cf0667f78622a4ffbb2a2147934c464ee6c2b0 100644 (file)
@@ -65,9 +65,7 @@ public class RestDocsServlet
         for ( Iterator<Element> 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<Element> elementIterator = headers.iterator(); elementIterator.hasNext(); )
+        {
+            Element header = elementIterator.next();
+            header.tagName( "h3" );
+        }
+
+        headers = body.select( "h2" );
+
+        for ( Iterator<Element> elementIterator = headers.iterator(); elementIterator.hasNext(); )
+        {
+            Element header = elementIterator.next();
+            header.tagName( "h4" );
+        }
+
+        headers = body.select( "h3" );
+
+        for ( Iterator<Element> 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 );
     }
 }
index f33d0bfdea50b77ff0d2d83b72a2cfd6e6be6419..de072bc92415ba609413ecd095f0fcce5937b48d 100644 (file)
@@ -20,7 +20,7 @@
 <script id="rest_docs" type="text/html">
     <div id="rest-doc-header">
       <div class="page-header">
-        <div><b>${$.i18n.prop('docs.rest.header')}</b></div>
+        <h3><b>${$.i18n.prop('docs.rest.header')}</b></h3>
       </div>
       <div id="docs_rest_choice">
         <ul>