mirror of
https://github.com/aclist/dztui.git
synced 2026-08-29 11:17:12 +02:00
feat: parse hyperlinks
This commit is contained in:
parent
6d428ebb0d
commit
c0b5c5bd89
@ -3133,11 +3133,22 @@ class DetailsDialog(GenericDialog):
|
|||||||
for row in response.data:
|
for row in response.data:
|
||||||
self.store.append(row + [Pango.Weight.BOLD])
|
self.store.append(row + [Pango.Weight.BOLD])
|
||||||
self.view.set_model(self.store)
|
self.view.set_model(self.store)
|
||||||
self.description.set_text(response.description)
|
|
||||||
|
text = response.description
|
||||||
|
reg = r"\s(www\.*?)"
|
||||||
|
text = re.sub(reg, " http://" + r"\1", text)
|
||||||
|
reg2 = r"(http.*?)([ ,\r\n]|$)"
|
||||||
|
text = re.sub(reg2, comp(r"\1")+r"\2", text)
|
||||||
|
|
||||||
|
self.description.set_markup(text)
|
||||||
self.success = response.success
|
self.success = response.success
|
||||||
GLib.idle_add(self._load)
|
GLib.idle_add(self._load)
|
||||||
|
|
||||||
|
|
||||||
|
def comp(string):
|
||||||
|
return f'<a href="{string}">{string}</a>'
|
||||||
|
|
||||||
|
|
||||||
class ModDialog(GenericDialog):
|
class ModDialog(GenericDialog):
|
||||||
def __init__(self, record: str):
|
def __init__(self, record: str):
|
||||||
msg = "Enter/double click a row to open in Steam Workshop."
|
msg = "Enter/double click a row to open in Steam Workshop."
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user