mirror of
https://github.com/aclist/dztui.git
synced 2026-08-25 17:32:36 +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:
|
||||
self.store.append(row + [Pango.Weight.BOLD])
|
||||
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
|
||||
GLib.idle_add(self._load)
|
||||
|
||||
|
||||
def comp(string):
|
||||
return f'<a href="{string}">{string}</a>'
|
||||
|
||||
|
||||
class ModDialog(GenericDialog):
|
||||
def __init__(self, record: str):
|
||||
msg = "Enter/double click a row to open in Steam Workshop."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user