From 90d5e02cca934cdf8d582873f5bf13e710c12393 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Fri, 25 Oct 2013 07:55:56 -0400 Subject: [PATCH] Remove "show readme" flag in favor of automatic detection --- src/main/java/com/gitblit/utils/MarkdownUtils.java | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/gitblit/utils/MarkdownUtils.java b/src/main/java/com/gitblit/utils/MarkdownUtils.java index 33d7a6a..f9c07fb 100644 --- a/src/main/java/com/gitblit/utils/MarkdownUtils.java +++ b/src/main/java/com/gitblit/utils/MarkdownUtils.java @@ -33,6 +33,21 @@ public class MarkdownUtils { /** + * Returns the html version of the plain source text. + * + * @param text + * @return html version of plain text + * @throws java.text.ParseException + */ + public static String transformPlainText(String text) { + // url auto-linking + text = text.replaceAll("((http|https)://[0-9A-Za-z-_=\\?\\.\\$#&/]*)", "<a href=\"$1\">$1</a>"); + String html = "<pre>" + text + "</pre>"; + return html; + } + + + /** * Returns the html version of the markdown source text. * * @param markdown -- Gitblit v1.9.1