Compare commits
No commits in common. "master" and "1.1.4" have entirely different histories.
57 changed files with 193 additions and 723 deletions
19
.github/workflows/bld.yml
vendored
19
.github/workflows/bld.yml
vendored
|
@ -1,6 +1,6 @@
|
||||||
name: bld-ci
|
name: bld-ci
|
||||||
|
|
||||||
on: [push, pull_request, workflow_dispatch]
|
on: [ push, pull_request, workflow_dispatch ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bld-project:
|
build-bld-project:
|
||||||
|
@ -8,25 +8,28 @@ jobs:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [17, 21, 23]
|
java-version: [ 17, 20 ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java-version }}
|
- name: Set up JDK ${{ matrix.java-version }}
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: "zulu"
|
distribution: 'zulu'
|
||||||
java-version: ${{ matrix.java-version }}
|
java-version: ${{ matrix.java-version }}
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Grant execute permission for bld
|
||||||
|
run: chmod +x bld
|
||||||
|
|
||||||
|
- name: Download the dependencies
|
||||||
run: ./bld download
|
run: ./bld download
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests with bld
|
||||||
run: >-
|
run: >-
|
||||||
./bld compile test
|
./bld compile test
|
||||||
-DtestsBadgeUrl=https://rife2.com/tests-badge/update/com.uwyn.rife2/rife2-renderers
|
-DtestsBadgeUrl=https://rife2.com/tests-badge/update/com.uwyn.rife2/rife2-renderers
|
||||||
-DtestsBadgeApiKey=${{ secrets.TESTS_BADGE_API_KEY }}
|
-DtestsBadgeApiKey=${{ secrets.TESTS_BADGE_API_KEY }}
|
14
.github/workflows/pages.yml
vendored
14
.github/workflows/pages.yml
vendored
|
@ -3,7 +3,7 @@ name: javadocs-pages
|
||||||
on:
|
on:
|
||||||
# Runs on pushes targeting the default branch
|
# Runs on pushes targeting the default branch
|
||||||
push:
|
push:
|
||||||
branches: ["master"]
|
branches: [ "master" ]
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
@ -30,14 +30,14 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: "zulu"
|
distribution: 'zulu'
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Build Javadocs
|
- name: Build Javadocs
|
||||||
|
@ -47,11 +47,11 @@ jobs:
|
||||||
uses: actions/configure-pages@v3
|
uses: actions/configure-pages@v3
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v1
|
||||||
with:
|
with:
|
||||||
# Upload generated Javadocs repository
|
# Upload generated Javadocs repository
|
||||||
path: "build/javadoc/"
|
path: 'build/javadoc/'
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v1
|
19
.github/workflows/publish.yml
vendored
19
.github/workflows/publish.yml
vendored
|
@ -3,7 +3,7 @@ name: Publish to the Maven Central/Rife2
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
release:
|
release:
|
||||||
types: [released]
|
types: [ released ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bld-project:
|
build-bld-project:
|
||||||
|
@ -11,23 +11,26 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: "temurin"
|
distribution: 'temurin'
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Grant execute permission for bld
|
||||||
|
run: chmod +x bld
|
||||||
|
|
||||||
|
- name: Download the dependencies
|
||||||
run: ./bld download
|
run: ./bld download
|
||||||
|
|
||||||
- name: Import key
|
- name: Import key
|
||||||
run: echo "${{ secrets.SIGN_SECRET_KEY }}" | gpg --batch --import
|
run: echo "${{ secrets.SIGN_SECRET_KEY }}" | gpg --batch --import
|
||||||
|
|
||||||
- name: Publish
|
- name: Publish with bld
|
||||||
run: >-
|
run: >-
|
||||||
./bld compile test publish
|
./bld compile test publish
|
||||||
-DtestsBadgeUrl=https://rife2.com/tests-badge/update/com.uwyn.rife2/rife2-renderers
|
-DtestsBadgeUrl=https://rife2.com/tests-badge/update/com.uwyn.rife2/rife2-renderers
|
||||||
|
@ -38,6 +41,6 @@ jobs:
|
||||||
-DsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}
|
-DsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}
|
||||||
-DsignKey=${{ secrets.SIGN_KEY }}
|
-DsignKey=${{ secrets.SIGN_KEY }}
|
||||||
-DsignPassphrase=${{ secrets.SIGN_PASSPHRASE }}
|
-DsignPassphrase=${{ secrets.SIGN_PASSPHRASE }}
|
||||||
|
|
||||||
- name: Delete GnuPG data
|
- name: Delete GnuPG data
|
||||||
run: rm -rfv $HOME/.gnupg
|
run: rm -rfv $HOME/.gnupg
|
||||||
|
|
6
.idea/bld.xml
generated
6
.idea/bld.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="BldConfiguration">
|
|
||||||
<events />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
5
.idea/codeStyles/codeStyleConfig.xml
generated
|
@ -1,5 +0,0 @@
|
||||||
<component name="ProjectCodeStyleConfiguration">
|
|
||||||
<state>
|
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
|
||||||
</state>
|
|
||||||
</component>
|
|
2
.idea/copyright/Apache_License.xml
generated
2
.idea/copyright/Apache_License.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
<option name="notice" value=" Copyright 2023-&#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. " />
|
<option name="notice" value=" Copyright &#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. " />
|
||||||
<option name="myName" value="Apache License" />
|
<option name="myName" value="Apache License" />
|
||||||
</copyright>
|
</copyright>
|
||||||
</component>
|
</component>
|
12
.idea/icon.svg
generated
12
.idea/icon.svg
generated
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<!-- Created with Vectornator (http://vectornator.io/) -->
|
|
||||||
<svg height="100%" stroke-miterlimit="10" style="fill-rule:nonzero;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;" version="1.1" viewBox="0 0 50 50" width="100%" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<defs/>
|
|
||||||
<g id="Untitled">
|
|
||||||
<g opacity="1">
|
|
||||||
<path d="M31.9421 4.99551C26.8094 7.90585 24.7641 12.0654 24.2025 17.855C23.7876 22.1321 27.3936 27.0983 27.5933 29.9084C27.8096 32.9493 26.063 35.2557 22.623 35.8686C20.4949 36.2477 17.8742 36.0139 14.6092 33.2624C14.6678 38.0258 16.7542 42.433 21.5076 44.1302C26.4211 45.8835 31.2671 44.9143 34.6016 41.9865C39.1593 38.2111 40.2692 32.4953 36.786 26.6511C33.0398 20.3619 29.6701 15.5562 31.9421 4.99551" fill="#fa9052" fill-rule="nonzero" opacity="1" stroke="none"/>
|
|
||||||
<path d="M17.349 14.5478C17.3497 14.5395 17.349 14.5478 17.349 14.5478C17.1626 14.8365 16.9754 15.1245 16.7869 15.4119C15.8906 16.7783 14.949 18.1004 13.9706 19.4087C12.6688 21.1498 10.9828 23.3556 11.1816 25.6096C11.3531 26.7195 12.0143 27.6556 12.9129 28.3061C13.6009 28.7369 14.38 28.9871 15.1883 29.0868C16.1147 29.2013 17.0209 29.1429 17.9083 28.834C19.257 28.1671 19.8037 27.4604 20.0005 26.4317C20.0649 26.1834 20.0437 25.8312 20.0437 25.8312C20.0343 25.73 20.0272 25.6537 20.0152 25.5528C19.9908 25.3475 19.9566 25.1434 19.9147 24.9411C19.8678 24.7142 19.8113 24.4896 19.7476 24.2671C19.7361 24.2271 19.6483 23.9399 19.6927 24.0786C19.6573 23.9677 19.6198 23.8574 19.5812 23.7477C19.4341 23.3294 19.2669 22.9183 19.0904 22.5114C19.0904 22.5114 18.2023 20.4746 17.8867 19.4599C17.3927 17.8737 17.1809 16.2048 17.349 14.5478Z" fill="#2392ff" fill-rule="nonzero" opacity="1" stroke="none"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.9 KiB |
204
.idea/intellij-javadocs-4.0.1.xml
generated
204
.idea/intellij-javadocs-4.0.1.xml
generated
|
@ -1,204 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="JavaDocConfiguration">
|
|
||||||
<GENERAL>
|
|
||||||
<MODE>UPDATE</MODE>
|
|
||||||
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
|
|
||||||
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
|
|
||||||
<LEVELS>
|
|
||||||
<LEVEL>TYPE</LEVEL>
|
|
||||||
<LEVEL>FIELD</LEVEL>
|
|
||||||
<LEVEL>METHOD</LEVEL>
|
|
||||||
</LEVELS>
|
|
||||||
<VISIBILITIES>
|
|
||||||
<VISIBILITY>DEFAULT</VISIBILITY>
|
|
||||||
<VISIBILITY>PROTECTED</VISIBILITY>
|
|
||||||
<VISIBILITY>PUBLIC</VISIBILITY>
|
|
||||||
</VISIBILITIES>
|
|
||||||
</GENERAL>
|
|
||||||
<TEMPLATES>
|
|
||||||
<CLASSES>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The interface ${name}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The enum ${name}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The type ${name}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
<CLASS>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The type ${name}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</CLASS>
|
|
||||||
</CLASSES>
|
|
||||||
<CONSTRUCTORS>
|
|
||||||
<CONSTRUCTOR>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Instantiates a new ${name}.\n
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</CONSTRUCTOR>
|
|
||||||
</CONSTRUCTORS>
|
|
||||||
<METHODS>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Gets ${partName}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${partName}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* Sets ${partName}.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${partName}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The entry point of application.\n
|
|
||||||
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
* @param ${element.parameterList.parameters[0].name} the input arguments\n
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
<METHOD>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* ${name}<#if isNotVoid> ${return}</#if>.\n
|
|
||||||
<#if element.typeParameters?has_content> * \n
|
|
||||||
</#if>
|
|
||||||
<#list element.typeParameters as typeParameter>
|
|
||||||
* @param <${typeParameter.name}> the type parameter\n
|
|
||||||
</#list>
|
|
||||||
<#if element.parameterList.parameters?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.parameterList.parameters as parameter>
|
|
||||||
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
|
|
||||||
</#list>
|
|
||||||
<#if isNotVoid>
|
|
||||||
*\n
|
|
||||||
* @return the ${return}\n
|
|
||||||
</#if>
|
|
||||||
<#if element.throwsList.referenceElements?has_content>
|
|
||||||
*\n
|
|
||||||
</#if>
|
|
||||||
<#list element.throwsList.referenceElements as exception>
|
|
||||||
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
|
|
||||||
</#list>
|
|
||||||
*/</VALUE>
|
|
||||||
</METHOD>
|
|
||||||
</METHODS>
|
|
||||||
<FIELDS>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
* The constant ${element.getName()}.\n
|
|
||||||
*/</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
<#if element.parent.isInterface()>
|
|
||||||
* The constant ${element.getName()}.\n
|
|
||||||
<#else>
|
|
||||||
* The ${name}.\n
|
|
||||||
</#if> */</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
<FIELD>
|
|
||||||
<KEY>.+</KEY>
|
|
||||||
<VALUE>/**\n
|
|
||||||
<#if element.parent.isEnum()>
|
|
||||||
*${name} ${typeName}.\n
|
|
||||||
<#else>
|
|
||||||
* The ${name}.\n
|
|
||||||
</#if>*/</VALUE>
|
|
||||||
</FIELD>
|
|
||||||
</FIELDS>
|
|
||||||
</TEMPLATES>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
7
.idea/libraries/bld.xml
generated
7
.idea/libraries/bld.xml
generated
|
@ -2,12 +2,11 @@
|
||||||
<library name="bld">
|
<library name="bld">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5-sources.jar!/" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<excluded>
|
<excluded>
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||||
|
@ -15,4 +14,4 @@
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/compile.xml
generated
4
.idea/libraries/compile.xml
generated
|
@ -7,7 +7,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/compile" />
|
<root url="file://$PROJECT_DIR$/lib/compile" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/runtime.xml
generated
4
.idea/libraries/runtime.xml
generated
|
@ -7,7 +7,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/test.xml
generated
4
.idea/libraries/test.xml
generated
|
@ -7,7 +7,7 @@
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/test" />
|
<root url="file://$PROJECT_DIR$/lib/test" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
|
||||||
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
|
||||||
</library>
|
</library>
|
||||||
</component>
|
</component>
|
8
.idea/misc.xml
generated
8
.idea/misc.xml
generated
|
@ -1,20 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="EntryPointsManager">
|
<component name="EntryPointsManager">
|
||||||
<pattern value="rife.render.TemplateRenderersBuild" method="jacoco" />
|
<pattern value="rife.render.TemplateRenderersBuild" method="jacoco" />
|
||||||
<pattern value="rife.render.TemplateRenderersBuild" method="pmd" />
|
<pattern value="rife.render.TemplateRenderersBuild" method="pmd" />
|
||||||
<pattern value="rife.render.ValueBean" method="setValue" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="PDMPlugin">
|
<component name="PDMPlugin">
|
||||||
<option name="customRuleSets">
|
<option name="customRuleSets">
|
||||||
<list>
|
<list>
|
||||||
<option value="K:\java\semver\config\pmd.xml" />
|
<option value="K:\java\semver\config\pmd.xml" />
|
||||||
<option value="$PROJECT_DIR$/../bld-jacoco-report/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-checkstyle/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-testng/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-generated-version/config/pmd.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/../bld-pitest/config/pmd.xml" />
|
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
<option name="skipTestSources" value="false" />
|
<option name="skipTestSources" value="false" />
|
||||||
|
|
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
|
@ -3,13 +3,13 @@
|
||||||
"src/main/java",
|
"src/main/java",
|
||||||
"src/main/resources",
|
"src/main/resources",
|
||||||
"src/test/java",
|
"src/test/java",
|
||||||
"src/test/resources",
|
"src/bld/java"
|
||||||
"src/bld/java",
|
|
||||||
"src/bld/resources"
|
|
||||||
],
|
],
|
||||||
"java.configuration.updateBuildConfiguration": "automatic",
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
"java.project.referencedLibraries": [
|
"java.project.referencedLibraries": [
|
||||||
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
"${HOME}bld-1.7.0-SNAPSHOT.jar",
|
||||||
"lib/**/*.jar"
|
"lib/compile/*.jar",
|
||||||
|
"lib/runtime/*.jar",
|
||||||
|
"lib/test/*.jar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
26
README.md
26
README.md
|
@ -1,9 +1,8 @@
|
||||||
[](https://opensource.org/licenses/Apache-2.0)
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
||||||
[](https://rife2.com/bld)
|
[](https://rife2.com/bld)
|
||||||
[](https://github.com/rife2/rife2-template-renderers/releases/latest)
|
[](https://github.com/rife2/rife2-template-renderers/releases/latest)
|
||||||
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/rife2-renderers)
|
[](https://central.sonatype.com/artifact/com.uwyn.rife2/rife2-renderers/1.1.0)
|
||||||
[](https://central.sonatype.com/artifact/com.uwyn.rife2/rife2-renderers/)
|
|
||||||
[](https://s01.oss.sonatype.org/content/repositories/snapshots/com/uwyn/rife2/rife2-renderers/)
|
[](https://s01.oss.sonatype.org/content/repositories/snapshots/com/uwyn/rife2/rife2-renderers/)
|
||||||
[](https://github.com/rife2/rife2-template-renderers/actions/workflows/bld.yml)
|
[](https://github.com/rife2/rife2-template-renderers/actions/workflows/bld.yml)
|
||||||
[](https://github.com/rife2/rife2-template-renderers/actions/workflows/gradle.yml)
|
[](https://github.com/rife2/rife2-template-renderers/actions/workflows/gradle.yml)
|
||||||
|
@ -51,17 +50,16 @@ This project provides a collection of useful template renderers.
|
||||||
|
|
||||||
## Text Renderers
|
## Text Renderers
|
||||||
|
|
||||||
| Renderer | Description |
|
| Renderer | Description |
|
||||||
|:------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------|
|
|:------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------|
|
||||||
| [rife.render.Capitalize](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Capitalize) | Capitalizes a template value |
|
| [rife.render.Capitalize](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Capitalize) | Capitalizes a template value |
|
||||||
| [rife.render.CapitalizeWords](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.CapitalizeWords) | Capitalizes words of a template value |
|
| [rife.render.Lowercase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Lowercase) | Converts a template value to lowercase |
|
||||||
| [rife.render.Lowercase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Lowercase) | Converts a template value to lowercase |
|
| [rife.render.Rot13](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Rot13) | Translates a template value to/from ROT13 |
|
||||||
| [rife.render.Rot13](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Rot13) | Translates a template value to/from ROT13 |
|
| [rife.render.SwapCase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.SwapCase) | Swap case of a template value |
|
||||||
| [rife.render.SwapCase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.SwapCase) | Swaps case of a template value |
|
| [rife.render.Trim](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Trim) | Removes leading and trailing whitespace from a template value |
|
||||||
| [rife.render.Trim](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Trim) | Removes leading and trailing whitespace from a template value |
|
| [rife.render.Uncapitalize](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Uncapitalize) | Uncapitalizes a template value |
|
||||||
| [rife.render.Uncapitalize](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Uncapitalize) | Uncapitalizes a template value |
|
| [rife.render.Uppercase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Uppercase) | Converts a template value to uppercase |
|
||||||
| [rife.render.Uppercase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Uppercase) | Converts a template value to uppercase |
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
Read more in the [documentation](https://github.com/rife2/rife2-template-renderers/wiki).
|
Read more in the [documenation](https://github.com/rife2/rife2-template-renderers/wiki).
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
<!-- BEST PRACTICES -->
|
<!-- BEST PRACTICES -->
|
||||||
<rule ref="category/java/bestpractices.xml">
|
<rule ref="category/java/bestpractices.xml">
|
||||||
<exclude name="AvoidPrintStackTrace"/>
|
<exclude name="AvoidPrintStackTrace"/>
|
||||||
|
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
|
||||||
|
<exclude name="JUnitTestContainsTooManyAsserts"/>
|
||||||
<exclude name="GuardLogStatement"/>
|
<exclude name="GuardLogStatement"/>
|
||||||
<exclude name="UnitTestContainsTooManyAsserts"/>
|
|
||||||
<exclude name="UnitTestShouldUseTestAnnotation"/>
|
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
||||||
|
@ -19,13 +19,19 @@
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="category/java/bestpractices.xml/ReplaceHashtableWithMap">
|
||||||
|
<properties>
|
||||||
|
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration['java.util.Properties']"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
|
||||||
<!-- CODE STYLE -->
|
<!-- CODE STYLE -->
|
||||||
<rule ref="category/java/codestyle.xml">
|
<rule ref="category/java/codestyle.xml">
|
||||||
<exclude name="AtLeastOneConstructor"/>
|
<exclude name="AtLeastOneConstructor"/>
|
||||||
<exclude name="ClassNamingConventions"/>
|
<exclude name="ClassNamingConventions"/>
|
||||||
<exclude name="CommentDefaultAccessModifier"/>
|
|
||||||
<exclude name="ConfusingTernary"/>
|
<exclude name="ConfusingTernary"/>
|
||||||
|
<exclude name="CommentDefaultAccessModifier"/>
|
||||||
<exclude name="FieldNamingConventions"/>
|
<exclude name="FieldNamingConventions"/>
|
||||||
<exclude name="LocalVariableCouldBeFinal"/>
|
<exclude name="LocalVariableCouldBeFinal"/>
|
||||||
<exclude name="LongVariable"/>
|
<exclude name="LongVariable"/>
|
||||||
|
@ -35,9 +41,8 @@
|
||||||
<exclude name="ShortClassName"/>
|
<exclude name="ShortClassName"/>
|
||||||
<exclude name="ShortMethodName"/>
|
<exclude name="ShortMethodName"/>
|
||||||
<exclude name="ShortVariable"/>
|
<exclude name="ShortVariable"/>
|
||||||
<exclude name="UseExplicitTypes"/>
|
|
||||||
<exclude name="UseUnderscoresInNumericLiterals"/>
|
|
||||||
<exclude name="UselessParentheses"/>
|
<exclude name="UselessParentheses"/>
|
||||||
|
<exclude name="UseUnderscoresInNumericLiterals"/>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
|
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
|
||||||
|
@ -53,6 +58,8 @@
|
||||||
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
||||||
<exclude name="CognitiveComplexity"/>
|
<exclude name="CognitiveComplexity"/>
|
||||||
<exclude name="CyclomaticComplexity"/>
|
<exclude name="CyclomaticComplexity"/>
|
||||||
|
<exclude name="ExcessiveClassLength"/>
|
||||||
|
<exclude name="ExcessiveMethodLength"/>
|
||||||
<exclude name="ExcessiveParameterList"/>
|
<exclude name="ExcessiveParameterList"/>
|
||||||
<exclude name="ExcessivePublicCount"/>
|
<exclude name="ExcessivePublicCount"/>
|
||||||
<exclude name="GodClass"/>
|
<exclude name="GodClass"/>
|
||||||
|
@ -106,4 +113,4 @@
|
||||||
<!-- SECURITY -->
|
<!-- SECURITY -->
|
||||||
<rule ref="category/java/security.xml">
|
<rule ref="category/java/security.xml">
|
||||||
</rule>
|
</rule>
|
||||||
</ruleset>
|
</ruleset>
|
Binary file not shown.
|
@ -1,8 +1,8 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
|
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.3
|
||||||
|
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1
|
||||||
|
bld.extension-tests=com.uwyn.rife2:bld-tests-badge:1.4.5
|
||||||
|
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.9
|
bld.version=1.7.5
|
||||||
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.0
|
|
||||||
bld.extension-tests=com.uwyn.rife2:bld-tests-badge:1.4.6
|
|
||||||
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
|
||||||
bld.version=2.2.1
|
|
||||||
|
|
|
@ -1,20 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright 2023-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package rife.render;
|
package rife.render;
|
||||||
|
|
||||||
import rife.bld.BuildCommand;
|
import rife.bld.BuildCommand;
|
||||||
|
@ -27,6 +10,7 @@ import rife.bld.publish.PublishInfo;
|
||||||
import rife.bld.publish.PublishLicense;
|
import rife.bld.publish.PublishLicense;
|
||||||
import rife.bld.publish.PublishScm;
|
import rife.bld.publish.PublishScm;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static rife.bld.dependencies.Repository.*;
|
import static rife.bld.dependencies.Repository.*;
|
||||||
|
@ -40,7 +24,7 @@ public class TemplateRenderersBuild extends Project {
|
||||||
public TemplateRenderersBuild() {
|
public TemplateRenderersBuild() {
|
||||||
pkg = "rife.render";
|
pkg = "rife.render";
|
||||||
name = "rife2-template-renderers";
|
name = "rife2-template-renderers";
|
||||||
version = version(1, 2, 1, "SNAPSHOT");
|
version = version(1, 1, 4);
|
||||||
|
|
||||||
javaRelease = 17;
|
javaRelease = 17;
|
||||||
downloadSources = true;
|
downloadSources = true;
|
||||||
|
@ -48,26 +32,25 @@ public class TemplateRenderersBuild extends Project {
|
||||||
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
||||||
|
|
||||||
scope(compile)
|
scope(compile)
|
||||||
.include(dependency("com.uwyn.rife2", "rife2", version(1, 9, 1)));
|
.include(dependency("com.uwyn.rife2", "rife2", version(1, 7, 3)));
|
||||||
scope(test)
|
scope(test)
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 0)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 0)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)))
|
||||||
.include(dependency("org.assertj", "assertj-core", version(3, 27, 3)));
|
.include(dependency("org.assertj:assertj-core:3.24.2"));
|
||||||
|
|
||||||
javadocOperation().javadocOptions()
|
javadocOperation().javadocOptions()
|
||||||
.docTitle("<a href=\"https://rife2.com\">RIFE2</a> Template Renderers")
|
.docTitle("<a href=\"https://rife2.com\">RIFE2</a> Template Renderers")
|
||||||
.author()
|
|
||||||
.docLint(NO_MISSING)
|
.docLint(NO_MISSING)
|
||||||
.link("https://rife2.github.io/rife2/");
|
.link("https://rife2.github.io/rife2/");
|
||||||
|
|
||||||
publishOperation()
|
publishOperation()
|
||||||
.repository(version.isSnapshot() ? SONATYPE_SNAPSHOTS
|
.repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS.location())
|
||||||
.withCredentials(property("sonatypeUser"), property("sonatypePassword"))
|
.withCredentials(property("sonatypeUser"), property("sonatypePassword"))
|
||||||
: SONATYPE_RELEASES
|
: repository(SONATYPE_RELEASES.location())
|
||||||
.withCredentials(property("sonatypeUser"), property("sonatypePassword")))
|
.withCredentials(property("sonatypeUser"), property("sonatypePassword")))
|
||||||
.repository(version.isSnapshot() ? RIFE2_SNAPSHOTS
|
.repository(version.isSnapshot() ? repository(RIFE2_SNAPSHOTS.location())
|
||||||
.withCredentials(property("rife2Username"), property("rife2Password"))
|
.withCredentials(property("rife2Username"), property("rife2Password"))
|
||||||
: RIFE2_RELEASES
|
: repository(RIFE2_RELEASES.location())
|
||||||
.withCredentials(property("rife2Username"), property("rife2Password")))
|
.withCredentials(property("rife2Username"), property("rife2Password")))
|
||||||
.info(new PublishInfo()
|
.info(new PublishInfo()
|
||||||
.groupId("com.uwyn.rife2")
|
.groupId("com.uwyn.rife2")
|
||||||
|
@ -75,21 +58,13 @@ public class TemplateRenderersBuild extends Project {
|
||||||
.name("RIFE2 Template Renderers")
|
.name("RIFE2 Template Renderers")
|
||||||
.description("Template Renderers for the RIFE2 web framework")
|
.description("Template Renderers for the RIFE2 web framework")
|
||||||
.url("https://github.com/rife2/rife2-template-renderers")
|
.url("https://github.com/rife2/rife2-template-renderers")
|
||||||
.developer(new PublishDeveloper()
|
.developer(new PublishDeveloper().id("ethauvin").name("Erik C. Thauvin").email("erik@thauvin.net")
|
||||||
.id("ethauvin")
|
|
||||||
.name("Erik C. Thauvin")
|
|
||||||
.email("erik@thauvin.net")
|
|
||||||
.url("https://erik.thauvin.net/"))
|
.url("https://erik.thauvin.net/"))
|
||||||
.developer(new PublishDeveloper()
|
.developer(new PublishDeveloper().id("gbevin").name("Geert Bevin").email("gbevin@uwyn.com")
|
||||||
.id("gbevin")
|
|
||||||
.name("Geert Bevin")
|
|
||||||
.email("gbevin@uwyn.com")
|
|
||||||
.url("https://github.com/gbevin"))
|
.url("https://github.com/gbevin"))
|
||||||
.license(new PublishLicense()
|
.license(new PublishLicense().name("The Apache License, Version 2.0")
|
||||||
.name("The Apache License, Version 2.0")
|
.url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
|
||||||
.url("https://www.apache.org/licenses/LICENSE-2.0.txt"))
|
.scm(new PublishScm().connection("scm:git:https://github.com/rife2/rife2-template-renderers.git")
|
||||||
.scm(new PublishScm()
|
|
||||||
.connection("scm:git:https://github.com/rife2/rife2-template-renderers.git")
|
|
||||||
.developerConnection("scm:git:git@github.com:rife2/rife2-template-renderers.git")
|
.developerConnection("scm:git:git@github.com:rife2/rife2-template-renderers.git")
|
||||||
.url("https://github.com/rife2/rife2-template-renderers"))
|
.url("https://github.com/rife2/rife2-template-renderers"))
|
||||||
.signKey(property("signKey"))
|
.signKey(property("signKey"))
|
||||||
|
@ -101,14 +76,14 @@ public class TemplateRenderersBuild extends Project {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BuildCommand(summary = "Generates JaCoCo Reports")
|
@BuildCommand(summary = "Generates JaCoCo Reports")
|
||||||
public void jacoco() throws Exception {
|
public void jacoco() throws IOException {
|
||||||
new JacocoReportOperation()
|
new JacocoReportOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@BuildCommand(summary = "Runs PMD analysis")
|
@BuildCommand(summary = "Runs PMD analysis")
|
||||||
public void pmd() throws Exception {
|
public void pmd() {
|
||||||
new PmdOperation()
|
new PmdOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
.failOnViolation(true)
|
.failOnViolation(true)
|
||||||
|
@ -122,4 +97,4 @@ public class TemplateRenderersBuild extends Project {
|
||||||
.apiKey(property("testsBadgeApiKey"))
|
.apiKey(property("testsBadgeApiKey"))
|
||||||
.fromProject(this));
|
.fromProject(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -21,7 +21,7 @@ import rife.template.Template;
|
||||||
import rife.template.ValueRenderer;
|
import rife.template.ValueRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Abbreviates a template value with ellipses.</p>
|
* <p>Abbreviate a template value with ellipses.</p>
|
||||||
*
|
*
|
||||||
* <p>Usage:</p>
|
* <p>Usage:</p>
|
||||||
*
|
*
|
||||||
|
@ -36,18 +36,7 @@ import rife.template.ValueRenderer;
|
||||||
*/
|
*/
|
||||||
public class Abbreviate implements ValueRenderer {
|
public class Abbreviate implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* <p>Returns the template value abbreviated with ellipses.</p>
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* <p>Two parameters can be specified:</p>
|
|
||||||
* <ul>
|
|
||||||
* <li><code>mark</code>: the string that will be used to abbreviate the value. Default is <code>...</code></li>
|
|
||||||
* <li><code>max</code>: the maximum number of characters to render. Default is <code>-1</code> (no abbreviation).</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value to render
|
|
||||||
* @param differentiator a generic string that can be used to differentiate the rendering
|
|
||||||
* @return the abbreviated value, or the original value if no abbreviation is necessary
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import java.time.ZonedDateTime;
|
||||||
*/
|
*/
|
||||||
public class BeatTime implements ValueRenderer {
|
public class BeatTime implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the current time in Swatch Internet (.beat) Time format.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template instance
|
|
||||||
* @param valueId the value id
|
|
||||||
* @param differentiator the differentiator
|
|
||||||
* @return the rendered value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -37,12 +37,7 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class Capitalize implements ValueRenderer {
|
public class Capitalize implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value by capitalizing it.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template containing the value to be rendered
|
|
||||||
* @param valueId the identifier of the value to render
|
|
||||||
* @param differentiator a string used to differentiate the rendering
|
|
||||||
* @return the capitalized and encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2023-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package rife.render;
|
|
||||||
|
|
||||||
import rife.template.Template;
|
|
||||||
import rife.template.ValueRenderer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Capitalizes words of a template value.</p>
|
|
||||||
*
|
|
||||||
* <p>Usage:</p>
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* <!--v render:rife.render.CapitalizeWords:valueId/-->
|
|
||||||
* {{v render:rife.render.CapitalizeWords:valueId/}}
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
|
||||||
* @see <a href="https://github.com/rife2/rife2-template-renderers/wiki/rife.render.CapitalizeWords">rife.render.CapitalizeWords</a>
|
|
||||||
* @since 1.2
|
|
||||||
*/
|
|
||||||
public class CapitalizeWords implements ValueRenderer {
|
|
||||||
/**
|
|
||||||
* Returns the template value by capitalizing it.
|
|
||||||
*
|
|
||||||
* @param template the template containing the value to be rendered
|
|
||||||
* @param valueId the identifier of the value to render
|
|
||||||
* @param differentiator a string used to differentiate the rendering
|
|
||||||
* @return the capitalized and encoded value
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
|
||||||
return template.getEncoder().encode(RenderUtils.capitalizeWords(template.getValueOrAttribute(differentiator)));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,7 +23,7 @@ import rife.template.ValueRenderer;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Renders the current date in ISO 8601 format.</p>
|
* <p>Return the current date in ISO 8601 format.</p>
|
||||||
*
|
*
|
||||||
* <p>Usage:</p>
|
* <p>Usage:</p>
|
||||||
*
|
*
|
||||||
|
@ -38,12 +38,7 @@ import java.time.ZonedDateTime;
|
||||||
*/
|
*/
|
||||||
public class DateIso implements ValueRenderer {
|
public class DateIso implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the current date in ISO 8601 format, encoded according to the template's encoding rules.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that is currently being rendered
|
|
||||||
* @param valueId the value id that triggers the rendering of this value renderer
|
|
||||||
* @param differentiator a differentiator that may be used to differentiate the rendering of this value renderer
|
|
||||||
* @return the current date in ISO 8601 format, encoded according to the template's encoding rules
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -24,7 +24,7 @@ import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Renders the current date and time in ISO 8601 format.</p>
|
* <p>Return the current date and time in ISO 8601 format.</p>
|
||||||
*
|
*
|
||||||
* <p>Usage:</p>
|
* <p>Usage:</p>
|
||||||
*
|
*
|
||||||
|
@ -39,15 +39,7 @@ import java.time.ZonedDateTime;
|
||||||
*/
|
*/
|
||||||
public class DateTimeIso implements ValueRenderer {
|
public class DateTimeIso implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Renders the current date and time in ISO 8601 format.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* <p>Additionally, it allows specifying a time zone through the template's default value properties with the key
|
|
||||||
* {@code tz}. If no time zone is specified, the system default time zone is used.</p>
|
|
||||||
*
|
|
||||||
* @param template the template that is currently being rendered
|
|
||||||
* @param valueId the id of the value to be rendered
|
|
||||||
* @param differentiator a differentiator that may be used to differentiate the rendering of this value renderer
|
|
||||||
* @return the current date and time in ISO 8601 format
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,7 +23,7 @@ import rife.template.ValueRenderer;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Renders the current date and time in RFC 2822 format.</p>
|
* <p>Return the current date and time in RFC 2822 format.</p>
|
||||||
*
|
*
|
||||||
* <p>Usage:</p>
|
* <p>Usage:</p>
|
||||||
*
|
*
|
||||||
|
@ -38,12 +38,7 @@ import java.time.ZonedDateTime;
|
||||||
*/
|
*/
|
||||||
public class DateTimeRfc2822 implements ValueRenderer {
|
public class DateTimeRfc2822 implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the current date and time in RFC 2822 format.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template instance
|
|
||||||
* @param valueId the value id
|
|
||||||
* @param differentiator the differentiator
|
|
||||||
* @return the current date and time in RFC 2822 format
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -40,12 +40,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
*/
|
*/
|
||||||
public class EncodeBase64 implements ValueRenderer {
|
public class EncodeBase64 implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded to Base64.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the Base64-encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class EncodeHtml implements ValueRenderer {
|
public class EncodeHtml implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded to HTML.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template containing the value to be rendered
|
|
||||||
* @param valueId the identifier of the value to render
|
|
||||||
* @param differentiator a string used to differentiate the rendering
|
|
||||||
* @return the HTML-encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,12 +36,7 @@ import rife.template.ValueRenderer;
|
||||||
*/
|
*/
|
||||||
public class EncodeHtmlEntities implements ValueRenderer {
|
public class EncodeHtmlEntities implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded to HTML decimal entities.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template instance
|
|
||||||
* @param valueId the value id
|
|
||||||
* @param differentiator the differentiator
|
|
||||||
* @return the encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class EncodeJs implements ValueRenderer {
|
public class EncodeJs implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded to JavaScript/ECMAScript.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the JavaScript/ECMAScript-encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class EncodeJson implements ValueRenderer {
|
public class EncodeJson implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded to JSON.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the JSON-encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class EncodeUnicode implements ValueRenderer {
|
public class EncodeUnicode implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded to Unicode escape codes.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the Unicode escape codes-encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class EncodeUrl implements ValueRenderer {
|
public class EncodeUrl implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded to URL.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the URL-encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class EncodeXml implements ValueRenderer {
|
public class EncodeXml implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded to XML.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the XML-encoded value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,12 +36,7 @@ import rife.template.ValueRenderer;
|
||||||
*/
|
*/
|
||||||
public class FormatCreditCard implements ValueRenderer {
|
public class FormatCreditCard implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the last 4 digits of the template credit number value.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the {@link Template}
|
|
||||||
* @param valueId the value id
|
|
||||||
* @param differentiator the differentiator
|
|
||||||
* @return the formatted value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -37,12 +37,7 @@ import rife.tools.Localization;
|
||||||
*/
|
*/
|
||||||
public class Lowercase implements ValueRenderer {
|
public class Lowercase implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value converted to lowercase.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the lowercase value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -35,30 +35,8 @@ import rife.template.ValueRenderer;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class Mask implements ValueRenderer {
|
public class Mask implements ValueRenderer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Renders a template value with characters of the value masked using the specified mask.</p>
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* <p>The mask is specified as a template default value with the following syntax:</p>
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* mask=<mask>[,unmasked=<unmasked>][,fromStart=<fromStart>]
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* <p>Where:</p>
|
|
||||||
*
|
|
||||||
* <ul>
|
|
||||||
* <li><var>mask</var> is the character to use for masking, defaulting to <code>*</code></li>
|
|
||||||
* <li><var>unmasked</var> is the number of characters at the beginning of the value that should be left unmasked,
|
|
||||||
* defaulting to <code>0</code></li>
|
|
||||||
* <li><var>fromStart</var> is a boolean indicating whether the <var>unmasked</var> value should be counted from
|
|
||||||
* the start of the value, defaulting to <code>false</code></li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param template the template to render the value in
|
|
||||||
* @param valueId the ID of the value to render
|
|
||||||
* @param differentiator the differentiator of the value to render
|
|
||||||
* @return the rendered value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,12 +36,7 @@ import rife.template.ValueRenderer;
|
||||||
*/
|
*/
|
||||||
public class Normalize implements ValueRenderer {
|
public class Normalize implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value normalized for inclusion in a URL path.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the normalized value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,12 +36,7 @@ import rife.template.ValueRenderer;
|
||||||
*/
|
*/
|
||||||
public class QrCode implements ValueRenderer {
|
public class QrCode implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value encoded as an SVG QR Code.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the SVG QR Code
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -30,6 +30,7 @@ import java.text.Normalizer;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoField;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -83,7 +84,7 @@ public final class RenderUtils {
|
||||||
DateTimeFormatter.ofPattern("EEE, d MMM yyyy HH:mm:ss zzz").withLocale(Localization.getLocale());
|
DateTimeFormatter.ofPattern("EEE, d MMM yyyy HH:mm:ss zzz").withLocale(Localization.getLocale());
|
||||||
private static final String DEFAULT_USER_AGENT =
|
private static final String DEFAULT_USER_AGENT =
|
||||||
"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0";
|
"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0";
|
||||||
private static final Logger LOGGER = Logger.getLogger(RenderUtils.class.getName());
|
private final static Logger LOGGER = Logger.getLogger(RenderUtils.class.getName());
|
||||||
|
|
||||||
private RenderUtils() {
|
private RenderUtils() {
|
||||||
// no-op
|
// no-op
|
||||||
|
@ -119,43 +120,11 @@ public final class RenderUtils {
|
||||||
*/
|
*/
|
||||||
public static String beatTime(ZonedDateTime zonedDateTime) {
|
public static String beatTime(ZonedDateTime zonedDateTime) {
|
||||||
var zdt = zonedDateTime.withZoneSameInstant(ZoneId.of("UTC+01:00"));
|
var zdt = zonedDateTime.withZoneSameInstant(ZoneId.of("UTC+01:00"));
|
||||||
var beats = (int) ((zdt.getSecond() + (zdt.getMinute() * 60) +
|
var beats = (int) ((zdt.get(ChronoField.SECOND_OF_MINUTE) + (zdt.get(ChronoField.MINUTE_OF_HOUR) * 60) +
|
||||||
(zdt.getHour() * 3600)) / 86.4);
|
(zdt.get(ChronoField.HOUR_OF_DAY) * 3600)) / 86.4);
|
||||||
return String.format("@%03d", beats);
|
return String.format("@%03d", beats);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a {@code String} with the first letter of each word capitalized.
|
|
||||||
*
|
|
||||||
* @param src the source {@code String}
|
|
||||||
* @return the capitalized {@code String}
|
|
||||||
*/
|
|
||||||
public static String capitalizeWords(String src) {
|
|
||||||
if (src == null || src.isBlank()) {
|
|
||||||
return src;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = new StringBuilder();
|
|
||||||
var capitalizeNext = true;
|
|
||||||
|
|
||||||
for (var i = 0; i < src.length(); i++) {
|
|
||||||
var c = src.charAt(i);
|
|
||||||
if (Character.isWhitespace(c)) {
|
|
||||||
capitalizeNext = true;
|
|
||||||
result.append(c);
|
|
||||||
} else {
|
|
||||||
if (capitalizeNext) {
|
|
||||||
result.append(Character.toUpperCase(c));
|
|
||||||
} else {
|
|
||||||
result.append(Character.toLowerCase(c));
|
|
||||||
}
|
|
||||||
capitalizeNext = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Encodes the source {@code String} to the specified encoding.</p>
|
* <p>Encodes the source {@code String} to the specified encoding.</p>
|
||||||
*
|
*
|
||||||
|
@ -227,11 +196,6 @@ public final class RenderUtils {
|
||||||
case '"' -> sb.append("\\\"");
|
case '"' -> sb.append("\\\"");
|
||||||
case '\\' -> sb.append("\\\\");
|
case '\\' -> sb.append("\\\\");
|
||||||
case '/' -> sb.append("\\/");
|
case '/' -> sb.append("\\/");
|
||||||
case '\b' -> sb.append("\\b");
|
|
||||||
case '\n' -> sb.append(("\\n"));
|
|
||||||
case '\t' -> sb.append("\\t");
|
|
||||||
case '\f' -> sb.append("\\f");
|
|
||||||
case '\r' -> sb.append("\\r");
|
|
||||||
default -> sb.append(c);
|
default -> sb.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,9 +212,8 @@ public final class RenderUtils {
|
||||||
public static String fetchUrl(String url, String defaultContent) {
|
public static String fetchUrl(String url, String defaultContent) {
|
||||||
try {
|
try {
|
||||||
var fetchUrl = new URL(url);
|
var fetchUrl = new URL(url);
|
||||||
HttpURLConnection connection = null;
|
|
||||||
try {
|
try {
|
||||||
connection = (HttpURLConnection) fetchUrl.openConnection();
|
var connection = (HttpURLConnection) fetchUrl.openConnection();
|
||||||
connection.setRequestProperty("User-Agent", DEFAULT_USER_AGENT);
|
connection.setRequestProperty("User-Agent", DEFAULT_USER_AGENT);
|
||||||
var code = connection.getResponseCode();
|
var code = connection.getResponseCode();
|
||||||
if (code >= 200 && code <= 399) {
|
if (code >= 200 && code <= 399) {
|
||||||
|
@ -266,15 +229,10 @@ public final class RenderUtils {
|
||||||
if (LOGGER.isLoggable(Level.WARNING)) {
|
if (LOGGER.isLoggable(Level.WARNING)) {
|
||||||
LOGGER.log(Level.WARNING, "An IO error occurred while connecting to " + fetchUrl.getHost(), ioe);
|
LOGGER.log(Level.WARNING, "An IO error occurred while connecting to " + fetchUrl.getHost(), ioe);
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
if (connection != null) {
|
|
||||||
connection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (MalformedURLException ignored) {
|
} catch (MalformedURLException ignored) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultContent;
|
return defaultContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,20 +330,21 @@ public final class RenderUtils {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
var normalized = Normalizer.normalize(src.trim(), Normalizer.Form.NFD).toCharArray();
|
var normalized = Normalizer.normalize(src.trim(), Normalizer.Form.NFD);
|
||||||
|
var sb = new StringBuilder(normalized.length());
|
||||||
var sb = new StringBuilder(normalized.length);
|
boolean space = false;
|
||||||
for (var i = 0; i < normalized.length; i++) {
|
for (var c : normalized.toCharArray()) {
|
||||||
var c = normalized[i];
|
if (c <= '\u007F') { // ascii only
|
||||||
if (c <= '\u007F') { // ASCII only
|
if (!space && c == ' ') {
|
||||||
if (" &()-_=[{]}\\|;:,<.>/".indexOf(c) != -1) { // common separators
|
space = true;
|
||||||
if (!sb.isEmpty() && i != normalized.length - 1 && sb.charAt(sb.length() - 1) != '-') {
|
sb.append('-');
|
||||||
sb.append('-');
|
} else {
|
||||||
|
space = false;
|
||||||
|
if (c >= '0' && c <= '9' || c >= 'a' && c <= 'z') {
|
||||||
|
sb.append(c);
|
||||||
|
} else if (c >= 'A' && c <= 'Z') {
|
||||||
|
sb.append((char) (c + 32)); // lowercase
|
||||||
}
|
}
|
||||||
} else if (c >= '0' && c <= '9' || c >= 'a' && c <= 'z') { // letters & digits
|
|
||||||
sb.append(c);
|
|
||||||
} else if (c >= 'A' && c <= 'Z') { // uppercase letters
|
|
||||||
sb.append((char) (c + 32)); // make lowercase
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -639,5 +598,4 @@ public final class RenderUtils {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,12 +36,7 @@ import rife.template.ValueRenderer;
|
||||||
*/
|
*/
|
||||||
public class Rot13 implements ValueRenderer {
|
public class Rot13 implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value translated to/from ROT13.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the ROT13 value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import rife.template.ValueRenderer;
|
||||||
*/
|
*/
|
||||||
public class ShortenUrl implements ValueRenderer {
|
public class ShortenUrl implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value shortened using <a href="https://is.gd/">is.gid</a>.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the template shortened value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -21,7 +21,7 @@ import rife.template.Template;
|
||||||
import rife.template.ValueRenderer;
|
import rife.template.ValueRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Swaps case of a template value.</p>
|
* <p>Swap case of a template value.</p>
|
||||||
*
|
*
|
||||||
* <p>Usage:</p>
|
* <p>Usage:</p>
|
||||||
*
|
*
|
||||||
|
@ -35,13 +35,9 @@ import rife.template.ValueRenderer;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class SwapCase implements ValueRenderer {
|
public class SwapCase implements ValueRenderer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the template value with swapped case.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the swapped case value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,7 +23,7 @@ import rife.template.ValueRenderer;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Renders the current time in ISO 8601 format.</p>
|
* <p>Return the current time in ISO 8601 format.</p>
|
||||||
*
|
*
|
||||||
* <p>Usage:</p>
|
* <p>Usage:</p>
|
||||||
*
|
*
|
||||||
|
@ -38,12 +38,7 @@ import java.time.ZonedDateTime;
|
||||||
*/
|
*/
|
||||||
public class TimeIso implements ValueRenderer {
|
public class TimeIso implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the current time in ISO 8601 format.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that is currently being rendered
|
|
||||||
* @param valueId the id of the value to be rendered
|
|
||||||
* @param differentiator a differentiator that may be used to differentiate the rendering of this value renderer
|
|
||||||
* @return the current time in ISO 8601 format
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,12 +36,7 @@ import rife.template.ValueRenderer;
|
||||||
*/
|
*/
|
||||||
public class Trim implements ValueRenderer {
|
public class Trim implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Renders the template value by removing leading and trailing whitespace.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template instance
|
|
||||||
* @param valueId the id of the value to render
|
|
||||||
* @param differentiator an optional differentiator to use for cache invalidation
|
|
||||||
* @return the trimmed value, or the original value if it is {@code null} or empty
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -37,12 +37,7 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class Uncapitalize implements ValueRenderer {
|
public class Uncapitalize implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the un-capitalized template value.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template to render
|
|
||||||
* @param valueId the id of the value to render
|
|
||||||
* @param differentiator the differentiator to use for the value lookup
|
|
||||||
* @return the un-capitalized value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -22,7 +22,7 @@ import rife.template.ValueRenderer;
|
||||||
import rife.tools.Localization;
|
import rife.tools.Localization;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Converts a template value to uppercase.</p>
|
* <p>Convert a template value to uppercase.</p>
|
||||||
*
|
*
|
||||||
* <p>Usage:</p>
|
* <p>Usage:</p>
|
||||||
*
|
*
|
||||||
|
@ -37,12 +37,7 @@ import rife.tools.Localization;
|
||||||
*/
|
*/
|
||||||
public class Uppercase implements ValueRenderer {
|
public class Uppercase implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Returns the template value converted to uppercase.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that contains the value
|
|
||||||
* @param valueId the id of the value
|
|
||||||
* @param differentiator the differentiator to use
|
|
||||||
* @return the uppercased value
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,12 +38,7 @@ import java.lang.management.ManagementFactory;
|
||||||
*/
|
*/
|
||||||
public class Uptime implements ValueRenderer {
|
public class Uptime implements ValueRenderer {
|
||||||
/**
|
/**
|
||||||
* Renders the server uptime.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that is currently being rendered
|
|
||||||
* @param valueId the id of the value to render
|
|
||||||
* @param differentiator a differentiator that may be used to differentiate the rendering of this value renderer
|
|
||||||
* @return the server uptime
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -37,13 +37,9 @@ import java.time.ZonedDateTime;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class Year implements ValueRenderer {
|
public class Year implements ValueRenderer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the current year.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param template the template that is currently being rendered
|
|
||||||
* @param valueId the id of the value to render
|
|
||||||
* @param differentiator a differentiator that may be used to differentiate the rendering of this value renderer
|
|
||||||
* @return the current year
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String render(Template template, String valueId, String differentiator) {
|
public String render(Template template, String valueId, String differentiator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -30,7 +30,7 @@ import java.lang.annotation.Target;
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@ExtendWith(DisableOnCiCondition.class)
|
@ExtendWith(DisableOnCiCondition.class)
|
||||||
public @interface DisabledOnCi {
|
public @interface DisabledOnCi {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -55,10 +55,6 @@ class TestEncode {
|
||||||
t.setAttribute(TestCase.FOO, "'\"\\/");
|
t.setAttribute(TestCase.FOO, "'\"\\/");
|
||||||
assertThat(t.getContent()).isEqualTo("\\'\\\"\\\\\\/");
|
assertThat(t.getContent()).isEqualTo("\\'\\\"\\\\\\/");
|
||||||
|
|
||||||
t = TemplateFactory.TXT.get("encodeJs");
|
|
||||||
t.setAttribute(TestCase.FOO, "This is\f\b a\r\n\ttest");
|
|
||||||
assertThat(t.getContent()).isEqualTo("This is\\f\\b a\\r\\n\\ttest");
|
|
||||||
|
|
||||||
t = TemplateFactory.HTML.get("encodeJs");
|
t = TemplateFactory.HTML.get("encodeJs");
|
||||||
t.setAttribute(TestCase.FOO, '"' + TestCase.SAMPLE_TEXT + '"');
|
t.setAttribute(TestCase.FOO, '"' + TestCase.SAMPLE_TEXT + '"');
|
||||||
assertThat(t.getContent()).as("with unicode")
|
assertThat(t.getContent()).as("with unicode")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package rife.render;
|
package rife.render;
|
||||||
|
|
||||||
import org.assertj.core.api.AutoCloseableSoftAssertions;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -40,17 +39,6 @@ class TestRenderUtils {
|
||||||
assertThat(RenderUtils.abbreviate("", 10, "")).as("").isEmpty();
|
assertThat(RenderUtils.abbreviate("", 10, "")).as("").isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testCapitalizeWords() {
|
|
||||||
assertThat(RenderUtils.capitalizeWords("hello world")).isEqualTo("Hello World");
|
|
||||||
assertThat(RenderUtils.capitalizeWords("java programming")).isEqualTo("Java Programming");
|
|
||||||
assertThat(RenderUtils.capitalizeWords("TEST")).isEqualTo("Test");
|
|
||||||
assertThat(RenderUtils.capitalizeWords("multiple spaces")).isEqualTo("Multiple Spaces");
|
|
||||||
assertThat(RenderUtils.capitalizeWords("white\t\fspaces")).isEqualTo("White\t\fSpaces");
|
|
||||||
assertThat(RenderUtils.capitalizeWords("")).isEmpty();
|
|
||||||
assertThat(RenderUtils.capitalizeWords(null)).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testEncode() {
|
void testEncode() {
|
||||||
var p = new Properties();
|
var p = new Properties();
|
||||||
|
@ -108,14 +96,8 @@ class TestRenderUtils {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testNormalize() {
|
void testNormalize() {
|
||||||
assertThat(RenderUtils.normalize("")).as("empty").isEmpty();
|
assertThat(RenderUtils.normalize("")).isEmpty();
|
||||||
assertThat(RenderUtils.normalize(" &()-_=[{]}\\|;:,<.>/")).as("blank").isEmpty();
|
assertThat(RenderUtils.normalize(SAMPLE_GERMAN)).isEqualTo("mochten-sie-ein-paar-apfel");
|
||||||
assertThat(RenderUtils.normalize(SAMPLE_GERMAN)).as("greman").isEqualTo("mochten-sie-ein-paar-apfel");
|
|
||||||
assertThat(RenderUtils.normalize("foo bar, <foo-bar>,foo:bar,foo;(bar), {foo} & bar=foo.bar[foo|bar]"))
|
|
||||||
.as("foo-bar")
|
|
||||||
.isEqualTo("foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar");
|
|
||||||
assertThat(RenderUtils.normalize("News for January 6, 2023 (Paris)")).as("docs example")
|
|
||||||
.isEqualTo("news-for-january-6-2023-paris");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -139,12 +121,10 @@ class TestRenderUtils {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testValidateCreditCard() {
|
void testValidateCreditCard() {
|
||||||
try (var softly = new AutoCloseableSoftAssertions()) {
|
assertThat(RenderUtils.validateCreditCard("4505 4672 3366 6430")).as("visa").isTrue();
|
||||||
softly.assertThat(RenderUtils.validateCreditCard("4505 4672 3366 6430")).as("visa").isTrue();
|
assertThat(RenderUtils.validateCreditCard("5189-5923-3915-0425")).as("mastercard").isTrue();
|
||||||
softly.assertThat(RenderUtils.validateCreditCard("5189-5923-3915-0425")).as("mastercard").isTrue();
|
assertThat(RenderUtils.validateCreditCard("3433634926643302")).as("amex").isTrue();
|
||||||
softly.assertThat(RenderUtils.validateCreditCard("3433634926643302")).as("amex").isTrue();
|
assertThat(RenderUtils.validateCreditCard("6011 1076-8252 0629")).as("discover").isTrue();
|
||||||
softly.assertThat(RenderUtils.validateCreditCard("6011 1076-8252 0629")).as("discover").isTrue();
|
assertThat(RenderUtils.validateCreditCard("0123456789012345")).as("invalid").isFalse();
|
||||||
softly.assertThat(RenderUtils.validateCreditCard("0123456789012345")).as("invalid").isFalse();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue