34
34
import com .syntevo .bugtraq .BugtraqFormatter ;
35
35
import com .syntevo .bugtraq .BugtraqFormatter .OutputHandler ;
36
36
37
- public class MessageProcessor {
37
+ public class BugtraqProcessor {
38
38
39
39
private final Logger logger = LoggerFactory .getLogger (getClass ());
40
40
41
41
private final IStoredSettings settings ;
42
42
43
- public MessageProcessor (IStoredSettings settings ) {
43
+ public BugtraqProcessor (IStoredSettings settings ) {
44
44
this .settings = settings ;
45
45
}
46
46
@@ -59,7 +59,7 @@ public String processCommitMessage(Repository repository, RepositoryModel model,
59
59
switch (model .commitMessageRenderer ) {
60
60
case MARKDOWN :
61
61
try {
62
- String prepared = processCommitMessageRegex (repository , model .name , text );
62
+ String prepared = processTextRegex (repository , model .name , text );
63
63
return MarkdownUtils .transformMarkdown (prepared );
64
64
} catch (Exception e ) {
65
65
logger .error ("Failed to render commit message as markdown" , e );
@@ -86,21 +86,35 @@ public String processCommitMessage(Repository repository, RepositoryModel model,
86
86
*/
87
87
public String processPlainCommitMessage (Repository repository , String repositoryName , String text ) {
88
88
String html = StringUtils .escapeForHtml (text , false );
89
- html = processCommitMessageRegex (repository , repositoryName , html );
89
+ html = processTextRegex (repository , repositoryName , html );
90
90
return StringUtils .breakLinesForHtml (html );
91
91
92
92
}
93
93
94
+ /**
95
+ * Returns an processed version of the text with any global or
96
+ * repository-specific regular expression substitution applied.
97
+ *
98
+ * @param repository
99
+ * @param repositoryName
100
+ * @param text
101
+ * @return processed version of the text
102
+ */
103
+ public String processText (Repository repository , String repositoryName , String text ) {
104
+ String html = processTextRegex (repository , repositoryName , text );
105
+ return html ;
106
+ }
107
+
94
108
/**
95
109
* Apply globally or per-repository specified regex substitutions to the
96
- * commit message .
110
+ * text .
97
111
*
98
112
* @param repository
99
113
* @param repositoryName
100
114
* @param text
101
- * @return the processed commit message
115
+ * @return the processed text
102
116
*/
103
- protected String processCommitMessageRegex (Repository repository , String repositoryName , String text ) {
117
+ protected String processTextRegex (Repository repository , String repositoryName , String text ) {
104
118
Map <String , String > map = new HashMap <String , String >();
105
119
// global regex keys
106
120
if (settings .getBoolean (Keys .regex .global , false )) {
0 commit comments