diff --git a/.travis.yml b/.travis.yml index da300e7..603fb92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,18 @@ sudo: false + jdk: - oraclejdk8 + script: - ./gradlew build jacocoTestReport --info --stacktrace + after_success: - bash <(curl -s https://codecov.io/bash) + before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ + cache: directories: - $HOME/.gradle/caches/ diff --git a/CHANGELOG.md b/CHANGELOG.md index fe9e15e..1504da2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### 1.0.10 - `nameColumnIndex` extension property added #23 - dependencies versions bump +- `tagEscapingStrategyColumnName` added ### 1.0.9 - task description added diff --git a/README.md b/README.md index 7ffef28..b63385b 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,8 @@ something already escaped in source: * `escapeSlashes` - default=`true`, if set to false slashes (`\`) won't be escaped * `normalizationForm` - default=[Normalizer.Form.NFC](http://docs.oracle.com/javase/8/docs/api/java/text/Normalizer.Form.html#NFC) if set to `null` Unicode normalization won't be performed, see [javadoc of Normalizer](http://docs.oracle.com/javase/8/docs/api/java/text/Normalizer.Form.html#NFC) for more details + +#### (X)HTML tags escaping * `tagEscapingStrategy` - default=`IF_TAGS_ABSENT`, defines X(H)TML tag brackets (< and >) escaping strategy possible values: * `ALWAYS` - brackets are always escaped. Eg. "<" in source becomes "&lt;" in output XML @@ -137,6 +139,8 @@ possible values: * `IF_TAGS_ABSENT` - Brackets aren't escaped if text contains tags. Eg. <b>bold</b> will be passed without change, but "if x<4 then…" becomes "if x&lt;4 then…". See [JSoup](http://jsoup.org) - library used to detect tags +* `tagEscapingStrategyColumnName` - default=unset (no column), name of the column containing non-default tag escaping strategy, if cell is non-empty then strategy + defined there is used instead of global one #### CSV format: * `csvStrategy` - default=`null` (library default strategy, equivalent of diff --git a/build.gradle b/build.gradle index 1d0f40c..16dbef3 100644 --- a/build.gradle +++ b/build.gradle @@ -6,8 +6,8 @@ buildscript { } plugins { - id 'com.gradle.plugin-publish' version '0.9.5' - id 'com.jfrog.bintray' version '1.7.1' + id 'com.gradle.plugin-publish' version '0.9.6' + id 'com.jfrog.bintray' version '1.7.2' } apply plugin: 'groovy' @@ -26,9 +26,9 @@ dependencies { compile 'org.codehaus.groovy:groovy:2.4.7' compile 'org.marketcetera.fork:commons-csv:2.4.2' compile 'org.apache.poi:ooxml-schemas:1.3' - compile 'org.apache.poi:poi-ooxml:3.14' - compile 'org.apache.poi:poi:3.14' - compile 'org.jsoup:jsoup:1.9.2' + compile 'org.apache.poi:poi-ooxml:3.15' + compile 'org.apache.poi:poi:3.15' + compile 'org.jsoup:jsoup:1.10.1' testCompile 'junit:junit:4.12' testCompile 'org.assertj:assertj-core:3.5.2' } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 3baa851..6ffa237 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a26ae1e..898fa31 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Aug 07 03:49:40 CEST 2016 +#Tue Oct 25 01:53:31 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip diff --git a/gradlew b/gradlew index 27309d9..9aa616c 100755 --- a/gradlew +++ b/gradlew @@ -161,4 +161,9 @@ function splitJvmOpts() { eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then + cd "$(dirname "$0")" +fi + exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat index 832fdb6..f955316 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -49,7 +49,6 @@ goto fail @rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/src/main/groovy/pl/droidsonroids/gradle/localization/SourceInfo.groovy b/src/main/groovy/pl/droidsonroids/gradle/localization/SourceInfo.groovy index 34e6eea..34d7f0a 100644 --- a/src/main/groovy/pl/droidsonroids/gradle/localization/SourceInfo.groovy +++ b/src/main/groovy/pl/droidsonroids/gradle/localization/SourceInfo.groovy @@ -44,6 +44,9 @@ class SourceInfo { } def reservedColumns = [config.commentColumnName, config.translatableColumnName, config.formattedColumnName] + if (config.tagEscapingStrategyColumnName != null) { + reservedColumns.add(config.tagEscapingStrategyColumnName) + } reservedColumns.addAll(config.ignorableColumns) header.eachWithIndex { columnName, i -> diff --git a/src/test/groovy/pl/droidsonroids/gradle/localization/LocalizationPluginTestBase.groovy b/src/test/groovy/pl/droidsonroids/gradle/localization/LocalizationPluginTestBase.groovy index 80889b8..12e9d7b 100644 --- a/src/test/groovy/pl/droidsonroids/gradle/localization/LocalizationPluginTestBase.groovy +++ b/src/test/groovy/pl/droidsonroids/gradle/localization/LocalizationPluginTestBase.groovy @@ -7,6 +7,7 @@ abstract class LocalizationPluginTestBase { void parseTestFile(String fileName) { def config = new ConfigExtension() config.csvFileURI = getClass().getResource(fileName).toURI() + config.tagEscapingStrategyColumnName = 'tagEscapingStrategy' parseTestFile(config) } diff --git a/src/test/groovy/pl/droidsonroids/gradle/localization/ParseCSVTest.groovy b/src/test/groovy/pl/droidsonroids/gradle/localization/ParseCSVTest.groovy index 42d6ad4..9da7f4d 100644 --- a/src/test/groovy/pl/droidsonroids/gradle/localization/ParseCSVTest.groovy +++ b/src/test/groovy/pl/droidsonroids/gradle/localization/ParseCSVTest.groovy @@ -9,6 +9,7 @@ class ParseCSVTest extends LocalizationPluginTestBase { void testCsvFileConfig() { def config = new ConfigExtension() config.csvFile = new File(getClass().getResource('valid.csv').getPath()) + config.tagEscapingStrategyColumnName = 'tagEscapingStrategy' parseTestFile(config) } diff --git a/src/test/resources/pl/droidsonroids/gradle/localization/valid.csv b/src/test/resources/pl/droidsonroids/gradle/localization/valid.csv index ede8dc7..3523228 100644 --- a/src/test/resources/pl/droidsonroids/gradle/localization/valid.csv +++ b/src/test/resources/pl/droidsonroids/gradle/localization/valid.csv @@ -1,4 +1,4 @@ -name ,default ,pl ,comment ,translatable,formatted +name ,default ,pl ,comment ,translatable,formatted,tagEscapingStrategy app ,Application, ,,false cow[one] ,cow ,krowa file ,File ,"Plik" ,file label , @@ -7,4 +7,5 @@ cow[other],cows ,krowy,comment days[],tuesday,,, days[],wednesday,,, -percent,%d %s,,,false,false \ No newline at end of file +percent,%d %s,,,false,false +tag,test,,,false,false,ALWAYS \ No newline at end of file