From c505e787b21046805768575c453d6f7f0676259b Mon Sep 17 00:00:00 2001 From: Shengyu Zhang Date: Sat, 10 Aug 2024 17:27:22 +0800 Subject: [PATCH] fix(schema): Strip reference values (#36) * fix(schema): Strip reference values * docs: Update changelog --- docs/changelog.rst | 8 ++++++++ src/sphinxnotes/any/schema.py | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 8121dc6..f68da4d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -18,6 +18,14 @@ Change Log Version 2.x =========== +.. + .. version:: 2.5 + + - Add new Sphinx Domain classifier (:pull:`27`) + - Strip rST markups in index description (:pull:`32`) + - refactor: Combing and document srcdir, outdir, reldir + - Fix referenceable field with multiple lines form (:issue:`34`) + .. version:: 2.4.0 :date: 2023-08-26 diff --git a/src/sphinxnotes/any/schema.py b/src/sphinxnotes/any/schema.py index 484c936..3c2b78b 100644 --- a/src/sphinxnotes/any/schema.py +++ b/src/sphinxnotes/any/schema.py @@ -102,7 +102,6 @@ def _as_lines(self, rawval:str) -> list[str]: return rawval.split('\n') - def value_of(self, rawval:str|None) -> None|str|list[str]: if rawval is None: assert not self.required @@ -283,7 +282,7 @@ def references_of(self, obj:Object) -> set[tuple[str,str]]: elif isinstance(val, str): refs.append((name, val)) elif isinstance(val, list): - refs += [(name, x) for x in val] + refs += [(name, x.strip()) for x in val if x.strip() != ''] return set(refs)