diff --git a/novelwriter/core/indexdata.py b/novelwriter/core/indexdata.py index 9a9ce74c..131361f0 100644 --- a/novelwriter/core/indexdata.py +++ b/novelwriter/core/indexdata.py @@ -269,6 +269,10 @@ class IndexHeading: def synopsis(self) -> str: return self._comments.get("summary", "") + @property + def comments(self) -> dict[str, str]: + return self._comments + @property def tag(self) -> str: return self._tag diff --git a/tests/test_core/test_core_indexdata.py b/tests/test_core/test_core_indexdata.py index 1563e4fe..9e1080f8 100644 --- a/tests/test_core/test_core_indexdata.py +++ b/tests/test_core/test_core_indexdata.py @@ -217,6 +217,13 @@ def testCoreIndexData_IndexHeading(): head.setComment(nwComment.SYNOPSIS.name, "", "In the beginning ...") assert head.synopsis == "In the beginning ..." + # Set Story Structure Comment + head.setComment(nwComment.STORY.name, "crisis", "It exploded!") + assert head.comments == { + "summary": "In the beginning ...", + "story.crisis": "It exploded!", + } + # Set Tag head.setTag("Stuff") assert head.tag == "stuff" # Case insensitive @@ -232,6 +239,7 @@ def testCoreIndexData_IndexHeading(): "meta": {"level": "H1", "title": "", "line": 42, "tag": "stuff", "counts": (42, 4, 2)}, "refs": {"stuff": "@object"}, "summary": "In the beginning ...", + "story.crisis": "It exploded!", } # Unpack KeyError