@@ -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+
179181class 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 )
0 commit comments