Revision: 7110
http://languagetool.svn.sourceforge.net/languagetool/?rev=7110&view=rev
Author: dnaber
Date: 2012-05-30 20:54:09 +0000 (Wed, 30 May 2012)
Log Message:
-----------
use dynamic rule id, based on name
Modified Paths:
--------------
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
Modified:
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
===================================================================
---
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
2012-05-30 20:49:55 UTC (rev 7109)
+++
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
2012-05-30 20:54:09 UTC (rev 7110)
@@ -125,7 +125,8 @@
private String createXml(String name, String message, String
incorrectSentence, String correctSentence) {
Language lang = getLanguage()
PatternRule patternRule = createPatternRule(lang)
- String xml = """<rule id="RULE_1" name="${name.encodeAsHTML()}">
+ String ruleId = createRuleIdFromName(name)
+ String xml = """<rule id="${ruleId.encodeAsHTML()}"
name="${name.encodeAsHTML()}">
<pattern>\n"""
for (element in patternRule.getElements()) {
if (element.isRegularExpression()) {
@@ -142,6 +143,10 @@
xml
}
+ String createRuleIdFromName(String name) {
+ return name.toUpperCase().replaceAll("[\\s/]+",
"_").replaceAll("[^A-Z_]", "")
+ }
+
private String getMessage() {
String message = params.message.encodeAsHTML()
message = message.replaceAll("\"(.*?)\"",
"<suggestion>\$1</suggestion>")
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs