From ed566a162c780faa0d6c84fac8fbbd3738586445 Mon Sep 17 00:00:00 2001 From: Kensuke Matsuzaki Date: Mon, 15 Apr 2013 17:39:19 +0900 Subject: Load prettify's lang-*.js extentions. --- src/main/java/com/gitblit/wicket/pages/BlobPage.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/gitblit/wicket/pages/BlobPage.java') diff --git a/src/main/java/com/gitblit/wicket/pages/BlobPage.java b/src/main/java/com/gitblit/wicket/pages/BlobPage.java index ab0f0f16..295b2eb7 100644 --- a/src/main/java/com/gitblit/wicket/pages/BlobPage.java +++ b/src/main/java/com/gitblit/wicket/pages/BlobPage.java @@ -39,6 +39,8 @@ import com.gitblit.wicket.panels.PathBreadcrumbsPanel; public class BlobPage extends RepositoryPage { + protected String fileExtension; + public BlobPage(PageParameters params) { super(params); @@ -128,10 +130,11 @@ public class BlobPage extends RepositoryPage { if (source == null) { table = missingBlob(blobPath, commit); } else { - table = generateSourceView(source, type == 1); + table = generateSourceView(source, extension, type == 1); } add(new Label("blobText", table).setEscapeModelStrings(false)); add(new Image("blobImage").setVisible(false)); + fileExtension = extension; } } else { // plain text @@ -140,7 +143,7 @@ public class BlobPage extends RepositoryPage { if (source == null) { table = missingBlob(blobPath, commit); } else { - table = generateSourceView(source, false); + table = generateSourceView(source, null, false); } add(new Label("blobText", table).setEscapeModelStrings(false)); add(new Image("blobImage").setVisible(false)); @@ -156,8 +159,8 @@ public class BlobPage extends RepositoryPage { sb.append(""); return sb.toString(); } - - protected String generateSourceView(String source, boolean prettyPrint) { + + protected String generateSourceView(String source, String extension, boolean prettyPrint) { String [] lines = source.split("\n"); StringBuilder sb = new StringBuilder(); @@ -180,7 +183,7 @@ public class BlobPage extends RepositoryPage { sb.append(""); sb.append("
"); if (prettyPrint) { - sb.append("
");
+			sb.append("
");
 		} else {
 			sb.append("
");
 		}
-- 
cgit v1.2.3