Added support for address element

This commit is contained in:
M66B 2023-08-05 16:47:14 +02:00
parent 8e6fcc8742
commit 3ff861edeb
4 changed files with 19 additions and 1 deletions

View File

@ -6,6 +6,10 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
### [Ubirajara](https://en.wikipedia.org/wiki/Ubirajara_jubatus)
### Next version
* Replace [address element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address) by [geo](https://en.wikipedia.org/wiki/Geo_URI_scheme) link
### 1.2091 - 2023-08-05
* Fixed crash

View File

@ -6,6 +6,10 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
### [Ubirajara](https://en.wikipedia.org/wiki/Ubirajara_jubatus)
### Next version
* Replace [address element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address) by [geo](https://en.wikipedia.org/wiki/Geo_URI_scheme) link
### 1.2091 - 2023-08-05
* Fixed crash

View File

@ -539,7 +539,7 @@ public class HtmlHelper {
sheets = parseStyles(parsed.head().select("style"));
Safelist safelist = Safelist.relaxed()
.addTags("hr", "abbr", "big", "font", "dfn", "del", "s", "tt", "mark")
.addTags("hr", "abbr", "big", "font", "dfn", "del", "s", "tt", "mark", "address")
.addAttributes(":all", "class")
.addAttributes(":all", "style")
.addAttributes("span", "dir")
@ -1100,6 +1100,12 @@ public class HtmlHelper {
hs.attr("x-line-after", "true");
}
// Replace addresses by link
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/address
for (Element address : document.select("address"))
address.tagName("a")
.attr("href", "geo:0,0?q=" + Uri.encode(address.text()));
// Paragraphs
for (Element p : document.select("p")) {
p.tagName("div");

View File

@ -6,6 +6,10 @@ For support you can use the contact form.
Ubirajara
Next version
* Replace address element link
1.2091 - 2023-08-05
* Fixed crash