fix #1798 add fe:replace

This commit is contained in:
Shinsuke Sugaya 2018-08-07 06:31:52 +09:00
parent c0c0dd00a8
commit aaff38b63c
3 changed files with 19 additions and 1 deletions

View file

@ -318,4 +318,11 @@ public class FessFunctions {
}
return StringUtil.EMPTY;
}
public static String replace(final Object input, final String regex, final String replacement) {
if (input == null) {
return StringUtil.EMPTY;
}
return input.toString().replaceAll(regex, replacement);
}
}

View file

@ -226,4 +226,15 @@
<function-signature>java.lang.String join(java.lang.Object)</function-signature>
<example>${fe:join(values)}</example>
</function>
<function>
<description>
Returns a string resulting from replacing in an input string all occurrences
of a "before" string into an "after" substring.
</description>
<name>replace</name>
<function-class>org.codelibs.fess.taglib.FessFunctions</function-class>
<function-signature>java.lang.String replace(java.lang.Object, java.lang.String, java.lang.String)</function-signature>
<example>${fe:replace(input, regex, replacement)}</example>
</function>
</taglib>

View file

@ -102,7 +102,7 @@
class="btn btn-xs btn-danger"
data-toggle="modal" data-target="#confirmToDelete"
data-docid="${f:u(doc.doc_id)}"
data-title="${doc.content_title}"
data-title="${fe:replace(doc.content_title, '<[^>]+>', '')}"
data-url="${f:h(doc.url_link)}">
<i class="fa fa-trash"></i>
<la:message key="labels.search_list_button_delete" />