summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket/pages/RepositoryPage.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-06-09 19:04:24 -0400
committerJames Moger <james.moger@gitblit.com>2011-06-09 19:04:24 -0400
commitf339f5de2ee6d354f55e14e9340bebc4611535b3 (patch)
tree541f02328b2bb92c5f21164c93e73bdb79ae87d2 /src/com/gitblit/wicket/pages/RepositoryPage.java
parent008322bec70a3a20bd00ed2219215a9f42fe0ca5 (diff)
downloadgitblit-f339f5de2ee6d354f55e14e9340bebc4611535b3.tar.gz
gitblit-f339f5de2ee6d354f55e14e9340bebc4611535b3.zip
Unit testing. Documentation. Simplified settings classes.
Diffstat (limited to 'src/com/gitblit/wicket/pages/RepositoryPage.java')
-rw-r--r--src/com/gitblit/wicket/pages/RepositoryPage.java62
1 files changed, 35 insertions, 27 deletions
diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java
index e2120f77..cff59f26 100644
--- a/src/com/gitblit/wicket/pages/RepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/RepositoryPage.java
@@ -227,40 +227,48 @@ public abstract class RepositoryPage extends BasePage {
}
protected void addFullText(String wicketId, String text, boolean substituteRegex) {
- String html = StringUtils.breakLinesForHtml(text);
+ String html;
if (substituteRegex) {
- Map<String, String> map = new HashMap<String, String>();
- // global regex keys
- if (GitBlit.getBoolean(Keys.regex.global, false)) {
- for (String key : GitBlit.getAllKeys(Keys.regex.global)) {
- if (!key.equals(Keys.regex.global)) {
- String subKey = key.substring(key.lastIndexOf('.') + 1);
- map.put(subKey, GitBlit.getString(key, ""));
- }
+ html = substituteText(text);
+ } else {
+ html = StringUtils.breakLinesForHtml(text);
+ }
+ add(new Label(wicketId, html).setEscapeModelStrings(false));
+ }
+
+ protected String substituteText(String text) {
+ String html = StringUtils.breakLinesForHtml(text);
+ Map<String, String> map = new HashMap<String, String>();
+ // global regex keys
+ if (GitBlit.getBoolean(Keys.regex.global, false)) {
+ for (String key : GitBlit.getAllKeys(Keys.regex.global)) {
+ if (!key.equals(Keys.regex.global)) {
+ String subKey = key.substring(key.lastIndexOf('.') + 1);
+ map.put(subKey, GitBlit.getString(key, ""));
}
}
+ }
- // repository-specific regex keys
- List<String> keys = GitBlit.getAllKeys(Keys.regex._ROOT + "."
- + repositoryName.toLowerCase());
- for (String key : keys) {
- String subKey = key.substring(key.lastIndexOf('.') + 1);
- map.put(subKey, GitBlit.getString(key, ""));
- }
+ // repository-specific regex keys
+ List<String> keys = GitBlit.getAllKeys(Keys.regex._ROOT + "."
+ + repositoryName.toLowerCase());
+ for (String key : keys) {
+ String subKey = key.substring(key.lastIndexOf('.') + 1);
+ map.put(subKey, GitBlit.getString(key, ""));
+ }
- for (Entry<String, String> entry : map.entrySet()) {
- String definition = entry.getValue().trim();
- String[] chunks = definition.split("!!!");
- if (chunks.length == 2) {
- html = html.replaceAll(chunks[0], chunks[1]);
- } else {
- logger.warn(entry.getKey()
- + " improperly formatted. Use !!! to separate match from replacement: "
- + definition);
- }
+ for (Entry<String, String> entry : map.entrySet()) {
+ String definition = entry.getValue().trim();
+ String[] chunks = definition.split("!!!");
+ if (chunks.length == 2) {
+ html = html.replaceAll(chunks[0], chunks[1]);
+ } else {
+ logger.warn(entry.getKey()
+ + " improperly formatted. Use !!! to separate match from replacement: "
+ + definition);
}
}
- add(new Label(wicketId, html).setEscapeModelStrings(false));
+ return html;
}
protected abstract String getPageName();