add three emoji sequences (experimental feature)

Sat, 09 Oct 2021 17:46:12 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 09 Oct 2021 17:46:12 +0200
changeset 234
d71bc6db42ef
parent 233
9219e2d4117b
child 235
4258b9e010ae

add three emoji sequences (experimental feature)

src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog-de.jspf file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog.jspf file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt	Sun Sep 26 14:59:36 2021 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt	Sat Oct 09 17:46:12 2021 +0200
@@ -30,6 +30,7 @@
 import com.vladsch.flexmark.html.HtmlRenderer
 import com.vladsch.flexmark.parser.Parser
 import com.vladsch.flexmark.util.data.MutableDataSet
+import com.vladsch.flexmark.util.data.SharedDataKeys
 import de.uapcore.lightpit.entities.*
 import de.uapcore.lightpit.types.IssueCategory
 import de.uapcore.lightpit.types.IssueStatus
@@ -68,19 +69,30 @@
     val version: Version? = null,
     val component: Component? = null
 ) : View() {
+    private val parser: Parser
+    private val renderer: HtmlRenderer
 
     init {
         val options = MutableDataSet()
-            .set(Parser.EXTENSIONS, listOf(TablesExtension.create(), StrikethroughExtension.create()))
-        val parser = Parser.builder(options).build()
-        val renderer = HtmlRenderer.builder(options).build()
-        val process = fun(it: String) = renderer.render(parser.parse(it))
+            .set(SharedDataKeys.EXTENSIONS, listOf(TablesExtension.create(), StrikethroughExtension.create()))
+        parser = Parser.builder(options).build()
+        renderer = HtmlRenderer.builder(options
+            .set(HtmlRenderer.ESCAPE_HTML, true)
+        ).build()
 
-        issue.description = process(issue.description ?: "")
+        issue.description = formatMarkdown(issue.description ?: "")
         for (comment in comments) {
-            comment.commentFormatted = process(comment.comment)
+            comment.commentFormatted = formatMarkdown(comment.comment)
         }
     }
+
+    private fun formatEmojis(text: String) = text
+        .replace("(/)", "&#9989;")
+        .replace("(x)", "&#10060;")
+        .replace("(!)", "&#9889;")
+
+    private fun formatMarkdown(text: String) =
+        renderer.render(parser.parse(formatEmojis(text)))
 }
 
 class IssueEditView(
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sun Sep 26 14:59:36 2021 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sat Oct 09 17:46:12 2021 +0200
@@ -33,6 +33,7 @@
     <li>Gesamtanzahl der Kommentare wird nun angezeigt.</li>
     <li>Spalte für zugewiesener Entwickler zu den Vorgangstabellen hinzugefügt.</li>
     <li>E-Mail Link in Vorgangsansicht hinzugefügt, wenn der Zugewiesene eine Mailadresse hat.</li>
+    <li>Formatierung für Status-Icons hinzugefügt, die als Text eingegeben werden: (/), (x) sowie (!)</li>
     <li>Installationsanweisungen hinzugefügt.</li>
 </ul>
 
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sun Sep 26 14:59:36 2021 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sat Oct 09 17:46:12 2021 +0200
@@ -27,76 +27,77 @@
 <h3>Version 1.0 (snapshot)</h3>
 
 <ul>
-    <li>Removes multi selection of versions within an issue.</li>
-    <li>Adds possibility to deactivate a component.</li>
-    <li>Adds release and end of life dates to versions.</li>
-    <li>Adds the total number of comments to the caption.</li>
-    <li>Adds assignee to the issue overview tables.</li>
-    <li>Adds mailto link in issue view when the assignee has a mail address.</li>
-    <li>Adds install instructions.</li>
+    <li>Remove multi selection of versions within an issue.</li>
+    <li>Add possibility to deactivate a component.</li>
+    <li>Add release and end of life dates to versions.</li>
+    <li>Add the total number of comments to the caption.</li>
+    <li>Add assignee to the issue overview tables.</li>
+    <li>Add mailto link in issue view when the assignee has a mail address.</li>
+    <li>Add formatting for (/), (x), and (!) status indicators.</li>
+    <li>Add install instructions.</li>
 </ul>
 
 <h3>Version 0.6</h3>
 
 <ul>
-    <li>Adds about page.</li>
-    <li>Adds possibility to edit own comments.</li>
-    <li>Adds possibility to leave a comment when editing an issue.</li>
-    <li>Improves Issue View.</li>
-    <li>Changes sort order of versions in the versions overview to be the same as in the left menu.</li>
-    <li>Removes unused width from the left menu.</li>
-    <li>Fixes duplicates in the components and versions lists.</li>
-    <li>Fixes issue form not loaded with the correct version info.</li>
-    <li>Fixes leaking prepared statements.</li>
+    <li>Add about page.</li>
+    <li>Add possibility to edit own comments.</li>
+    <li>Add possibility to leave a comment when editing an issue.</li>
+    <li>Improve Issue View.</li>
+    <li>Change sort order of versions in the versions overview to be the same as in the left menu.</li>
+    <li>Remove unused width from the left menu.</li>
+    <li>Fix duplicates in the components and versions lists.</li>
+    <li>Fix issue form not loaded with the correct version info.</li>
+    <li>Fix leaking prepared statements.</li>
 </ul>
 
 <h3>Version 0.5</h3>
 
 <ul>
-    <li>Adds separate issue detail view.</li>
-    <li>Adds manual project ordering.</li>
-    <li>Adds <em>Create Another</em> checkbox to the issue form.</li>
-    <li>Adds tooltip to dates displaying the time.</li>
-    <li>Adds markdown support for descriptions and comments.</li>
-    <li>Adds a mailto Link to the display name above comments where possible.</li>
-    <li>Increases maximum length of project names.</li>
+    <li>Add separate issue detail view.</li>
+    <li>Add manual project ordering.</li>
+    <li>Add <em>Create Another</em> checkbox to the issue form.</li>
+    <li>Add tooltip to dates displaying the time.</li>
+    <li>Add markdown support for descriptions and comments.</li>
+    <li>Add a mailto Link to the display name above comments where possible.</li>
+    <li>Increase maximum length of project names.</li>
     <li>Highlight ETA when it has passed.</li>
-    <li>Hides deprecated versions from left menu.</li>
-    <li>Greatly reduces footprint of used markdown library.</li>
-    <li>Fixes text in the version status tags not being translated.</li>
-    <li>Fixes <em>Updated</em> date not updated when a comment has been added.</li>
-    <li>Fixes border rendering issues in Chrome.</li>
-    <li>Fixes UTF-8 not being used everywhere.</li>
-    <li>Fixes comments not supporting line breaks.</li>
-    <li>Migrates the Project from Java to Kotlin</li>
+    <li>Hide deprecated versions from left menu.</li>
+    <li>Greatly reduce footprint of used markdown library.</li>
+    <li>Fix text in the version status tags not being translated.</li>
+    <li>Fix <em>Updated</em> date not updated when a comment has been added.</li>
+    <li>Fix border rendering issues in Chrome.</li>
+    <li>Fix UTF-8 not being used everywhere.</li>
+    <li>Fix comments not supporting line breaks.</li>
+    <li>Migrate the Project from Java to Kotlin</li>
 </ul>
 
 <h3>Version 0.4</h3>
 
 <ul>
-    <li>Adds components.</li>
-    <li>Adds automatic issue assignedment based on project and/or component lead.</li>
-    <li>Adds comments.</li>
-    <li>Adds version overview.</li>
-    <li>Adds colored status indicators to versions.</li>
-    <li>Changes sort order of issues to move completed issues to the bottom.</li>
+    <li>Add components.</li>
+    <li>Add automatic issue assignedment based on project and/or component lead.</li>
+    <li>Add comments.</li>
+    <li>Add version overview.</li>
+    <li>Add colored status indicators to versions.</li>
+    <li>Change sort order of issues to move completed issues to the bottom.</li>
     <li>Overall improvement of URLs.</li>
 </ul>
 
 <h3>Version 0.3</h3>
 
 <ul>
-    <li>Adds colored tags for issue types and issue status.</li>
-    <li>Removes separate progress bars for affected and reported issue lists.</li>
-    <li>Fixes issue status <em>Scheduled</em> already considered <em>in progress</em>.</li>
+    <li>Add colored tags for issue types and issue status.</li>
+    <li>Remove separate progress bars for affected and reported issue lists.</li>
+    <li>Fix issue status <em>Scheduled</em> already considered <em>in progress</em>.</li>
 </ul>
 
 <h3>Version 0.2</h3>
 
 <ul>
-    <li>Adds progress bar for projects and their versions.</li>
-    <li>Adds issues per version list.</li>
-    <li>Changes height of issue description text area.</li>
+    <li>Add progress bar for projects and their versions.</li>
+    <li>Add issues per version list.</li>
+    <li>Change height of issue description text area.</li>
 </ul>
 
 <h3>Version 0.1</h3>

mercurial