Skip to content

Search highlighting fails if page uses the ItemList macro #1807

@UlrichB22

Description

@UlrichB22

When running a search e.g. for "itemlist" and opening the item help-en/MoinWikiMacros from the search results
(help-en/MoinWikiMacros?regex=itemlist) I am getting the following traceback in the server log:

2024-11-20 14:03:46,157 INFO moin.signalling.log:20 item MoinWiki:help-en/MoinWikiMacros displayed
2024-11-20 14:03:46,824 ERROR moin.items.content:316 An exception happened in _render_data (error_id = 855960e6-f8d1-4c11-b7a8-c793f7222c7b ):
Traceback (most recent call last):
  File "/mypath/src/moin/items/content.py", line 305, in _render_data
    doc = self._expand_document(doc)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mypath/src/moin/items/content.py", line 295, in _expand_document
    doc = highlight_conv(doc)
          ^^^^^^^^^^^^^^^^^^^
  File "/mypath/src/moin/converters/highlight.py", line 60, in __call__
    self.recurse(tree)
  File "/mypath/src/moin/converters/highlight.py", line 48, in recurse
    self.recurse(child)
  File "/mypath/src/moin/converters/highlight.py", line 48, in recurse
    self.recurse(child)
  File "/mypath/src/moin/converters/highlight.py", line 48, in recurse
    self.recurse(child)
  [Previous line repeated 5 more times]
  File "/mypath/src/moin/converters/highlight.py", line 34, in recurse
    if elem.tag.uri == moin_page.namespace:
       ^^^^^^^^
AttributeError: 'CompositeName' object has no attribute 'tag'

Additionally in help-en/MoinWikiMacros the namespace is missing for some ItemList examples with the item "OtherTextItems".

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmacro

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions