Skip to content

Commit

Permalink
Fix opening URLs containing "=" (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
tschumpr authored Feb 26, 2024
2 parents 5990fcd + f9f47c8 commit 1873948
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions custom_news_feed/custom_news_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def addLinks(self):
linkWidget = QWidget()
linkBox = QVBoxLayout()
linkBox.setContentsMargins(0,0,0,0)
label= QLabel("<a href=% s>% s</a>" % (link['Url'], link['LinkTitle']))
label= QLabel("<a href='% s'>% s</a>" % (link['Url'], link['LinkTitle']))
label.setTextFormat(Qt.RichText)
label.setOpenExternalLinks(True)
linkBox.addWidget(label)
Expand Down Expand Up @@ -601,7 +601,7 @@ def create_article_widget(self, newsArticle):
textBox.addWidget(text)

if not newsArticle['LinkTitle'] == "":
link = QLabel("<a href=% s>% s</a>" % (newsArticle['LinkUrl'], newsArticle['LinkTitle']))
link = QLabel("<a href='% s'>% s</a>" % (newsArticle['LinkUrl'], newsArticle['LinkTitle']))
link.setTextFormat(Qt.RichText)
link.setOpenExternalLinks(True)
textBox.addWidget(link)
Expand Down
2 changes: 1 addition & 1 deletion custom_news_feed/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name=Custom News Feed
qgisMinimumVersion=3.0
description=This plugin helps you display a newsfeed in QGIS.
about=This QGIS plugin lets you display a feed of articles containing a title, date, text, image and link. The information to display is managed in a JSON-file, that can be provided locally or via url. Custom News Feed plugin is helpful if you want to distriubte news articles organisation-wide.
version=1.2.2
version=1.2.3
author=GeoWerkstatt GmbH
[email protected]

Expand Down
4 changes: 2 additions & 2 deletions custom_news_feed/sample_news/sample_news.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"Title": "How to build a nest in 3 simple steps.",
"Date": "2022-03-05",
"Text": "Many species of birds are economically important as food for human consumption and raw material in manufacturing, with domesticated and undomesticated birds being important sources of eggs, meat, and feathers. Songbirds, parrots, and other species are popular as pets. Guano (bird excrement) is harvested for use as a fertiliser. Birds figure throughout human culture. About 120 to 130 species have become extinct due to human activity since the 17th century, and hundreds more before then. Human activity threatens about 1,200 bird species with extinction, though efforts are underway to protect them. Recreational birdwatching is an important part of the ecotourism industry.",
"LinkUrl": "https://en.wikipedia.org/wiki/Beak",
"LinkUrl": "https://www.geocat.ch/geonetwork/srv/ger/catalog.search#/search?query_string=%7B%22groupOwner%22:%20%7B%2219%22:%20true%7D%7D",
"LinkTitle": "Learn about beaks",
"ImageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQp7KWxTpMgRpXlvzCgM8Q4Jukt3oaZBNuPKA&usqp=CAU",
"StartPublishingDate": "2023-05-12T06:00:00.000Z"
Expand Down Expand Up @@ -64,7 +64,7 @@

"Links": [
{
"Url": "https://en.wikipedia.org/wiki/Bird",
"Url": "https://www.geocat.ch/geonetwork/srv/ger/catalog.search#/search?query_string=%7B%22groupOwner%22:%20%7B%2219%22:%20true%7D%7D",
"LinkTitle": "Everything else about birds"
},
{
Expand Down

0 comments on commit 1873948

Please sign in to comment.