You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2011/09/12 18:44:00 UTC

svn commit: r1169824 - /openejb/trunk/sandbox/tools/src/main/java/org/apache/openejb/tools/examples/GenerateIndex.java

Author: rmannibucau
Date: Mon Sep 12 16:44:00 2011
New Revision: 1169824

URL: http://svn.apache.org/viewvc?rev=1169824&view=rev
Log:
fixing example links in markdown

Modified:
    openejb/trunk/sandbox/tools/src/main/java/org/apache/openejb/tools/examples/GenerateIndex.java

Modified: openejb/trunk/sandbox/tools/src/main/java/org/apache/openejb/tools/examples/GenerateIndex.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/tools/src/main/java/org/apache/openejb/tools/examples/GenerateIndex.java?rev=1169824&r1=1169823&r2=1169824&view=diff
==============================================================================
--- openejb/trunk/sandbox/tools/src/main/java/org/apache/openejb/tools/examples/GenerateIndex.java (original)
+++ openejb/trunk/sandbox/tools/src/main/java/org/apache/openejb/tools/examples/GenerateIndex.java Mon Sep 12 16:44:00 2011
@@ -120,7 +120,7 @@ public class GenerateIndex {
 
 		Map<String, String> exampleNames = new TreeMap<String, String>(Collections.reverseOrder()); // to start with the longest
 		for (File example : examples) {
-			exampleNames.put(example.getName(), "../" + example.getName()); // value is the link... should be enough
+			exampleNames.put(example.getName(), "../" + example.getName() + "/index.html"); // value is the link... should be enough
 		}
 		
         for (File example : examples) {
@@ -134,13 +134,13 @@ public class GenerateIndex {
                 File readme = new File(example, rd.trim());
                 if (readme.exists()) {
                     try {
-                        html = PROCESSOR.markdown(FileUtils.readFileToString(readme));
-
-						// auto link examples
+                        String content = FileUtils.readFileToString(readme);
+                        // auto link examples
                         // all example names should start with a space in the md if it was not already replaced
 						for (Map.Entry<String, String> exampleName : exampleNames.entrySet()){
-							html = html.replace(" " + exampleName.getKey(), "[" + exampleName.getKey() + "](" + exampleName.getValue() + ")");
+							content = content.replace(" " + exampleName.getKey(), " <a href=\"" + exampleName.getValue() + "\">" + exampleName.getKey() + "</a>");
 						}
+                        html = PROCESSOR.markdown(content);
                         break;
                     } catch (IOException e) {
                         LOGGER.warn("can't read readme file for example " + example.getName());