Skip to content

Commit ab24617

Browse files
Merge pull request #372 from iolanta-tech/369-httpsschemaorgcreativeworkseries-has-no-title
369 httpsschemaorgcreativeworkseries has no title
2 parents 295b9fb + 44b1e9f commit ab24617

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

iolanta/facets/textual_default/facets.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class Description(Static):
3333
"""
3434

3535

36-
class TextualDefaultFacet(Facet[Widget]): # noqa: WPS214
36+
class TextualDefaultFacet(Facet[Widget]): # noqa: WPS214
3737
"""Default rendering engine."""
3838

39-
query_file_name = 'properties.sparql'
39+
query_file_name = "properties.sparql"
4040
properties_on_the_right = False
4141

4242
@functools.cached_property
@@ -47,10 +47,7 @@ def grouped_properties(self) -> dict[NotLiteralNode, list[Node]]:
4747
this=self.this,
4848
)
4949

50-
property_pairs = [
51-
(row['property'], row['object'])
52-
for row in property_rows
53-
]
50+
property_pairs = [(row["property"], row["object"]) for row in property_rows]
5451

5552
iolanta_lang = str(self.iolanta.language)
5653
property_pairs = [
@@ -79,7 +76,9 @@ def rows(self):
7976
property_value=property_value,
8077
subject=self.this,
8178
property_iri=property_iri,
82-
) if isinstance(property_value, Literal) else PropertyValue(
79+
)
80+
if isinstance(property_value, Literal)
81+
else PropertyValue(
8382
property_value=property_value,
8483
subject=self.this,
8584
property_iri=property_iri,
@@ -130,26 +129,28 @@ def description(self) -> str | Syntax | None:
130129

131130
match literal_value:
132131
case str() as string:
133-
return string
132+
# Escape ALL square brackets - Rich's escape_markup only escapes
133+
# lowercase tags, but [[ItemList]] etc. still cause MarkupError
134+
return string.replace("[", r"\[")
134135

135136
case minidom.Document() as xml_document:
136137
return Syntax(
137138
xml_document.toxml(),
138-
'xml',
139+
"xml",
139140
)
140141

141142
case something_else:
142143
type_of_something_else = type(something_else)
143144
raise ValueError(
144-
f'What is this? {something_else} ' # noqa: WPS326
145-
f'is a {type_of_something_else}!', # noqa: WPS326
145+
f"What is this? {something_else} " # noqa: WPS326
146+
f"is a {type_of_something_else}!", # noqa: WPS326
146147
)
147148

148149
@functools.cached_property
149150
def properties(self) -> Widget | None:
150151
"""Render properties table."""
151152
if not self.grouped_properties:
152-
return Static('No properties found ☹')
153+
return Static("No properties found ☹")
153154

154155
return PropertiesContainer(*self.rows)
155156

@@ -160,7 +161,7 @@ def show(self) -> Widget:
160161

161162
if self.description:
162163
widgets.append(Description(self.description))
163-
164+
164165
widgets.append(self.properties)
165166

166167
return VerticalScroll(*widgets)
@@ -176,11 +177,12 @@ class PageFooter(PageTitle):
176177
}
177178
"""
178179

180+
179181
class InverseProperties(TextualDefaultFacet):
180182
"""Inverse properties view."""
181183

182-
META = Path(__file__).parent / 'textual-inverse-properties.yamlld'
183-
query_file_name = 'inverse-properties.sparql'
184+
META = Path(__file__).parent / "textual-inverse-properties.yamlld"
185+
query_file_name = "inverse-properties.sparql"
184186
properties_on_the_right = True
185187

186188
def show(self) -> Widget:
@@ -189,5 +191,5 @@ def show(self) -> Widget:
189191
VerticalScroll(
190192
self.properties,
191193
),
192-
PageFooter(self.this, extra='[i]& its inverse RDF properties[/i]'),
194+
PageFooter(self.this, extra="[i]& its inverse RDF properties[/i]"),
193195
)

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "iolanta"
3-
version = "2.1.22"
3+
version = "2.1.23"
44
description = "Semantic Web browser"
55
authors = ["Anatoly Scherbakov <altaisoft@gmail.com>"]
66
license = "MIT"
@@ -24,7 +24,7 @@ rich = ">=13.3.1"
2424
textual = ">=0.83.0"
2525
yarl = ">=1.9.4"
2626
boltons = ">=24.0.0"
27-
yaml-ld = ">=1.1.16"
27+
yaml-ld = ">=1.1.17"
2828
reasonable = ">=0.2.6"
2929
oxrdflib = ">=0.4.0"
3030
loguru = ">=0.7.3"

0 commit comments

Comments
 (0)