diff --git a/_unittests/ut_sphinxext/test_quote_extension.py b/_unittests/ut_sphinxext/test_quote_extension.py index f4efe7cd..310aae60 100644 --- a/_unittests/ut_sphinxext/test_quote_extension.py +++ b/_unittests/ut_sphinxext/test_quote_extension.py @@ -219,6 +219,7 @@ def test_quote_show(self): :lid: label1 :pages: 234 :year: 2018 + :title1: true this code should appear___ diff --git a/src/pyquickhelper/sphinxext/sphinx_quote_extension.py b/src/pyquickhelper/sphinxext/sphinx_quote_extension.py index 2fedd552..44dc97dd 100644 --- a/src/pyquickhelper/sphinxext/sphinx_quote_extension.py +++ b/src/pyquickhelper/sphinxext/sphinx_quote_extension.py @@ -34,6 +34,7 @@ class QuoteNode(BaseAdmonition): * *lid* or *label* * *index*, additional index words beside the title and the author * *date*, if the text was written or declared at specific date + * *title1*, by default, the author comes first, if True, the title is Example:: @@ -70,6 +71,7 @@ class QuoteNode(BaseAdmonition): 'class': directives.class_option, 'index': directives.unchanged, 'date': directives.unchanged, + 'title1': directives.unchanged, } def run(self): @@ -111,6 +113,7 @@ def __(text): source = __(self.options.get('source', "").strip()) index = __(self.options.get('index', "").strip()) date = __(self.options.get('date', "").strip()) + title1 = __(self.options.get('title1', "").strip()) in ('1', 1, 'True', True, 'true') indexes = [] if index: @@ -123,21 +126,38 @@ def __(text): else: tnl = [] # pragma: no cover - if author: - tnl.append("**{0}**, ".format(author)) - indexes.append(author) - if book: - tnl.append("*{0}*".format(book)) - indexes.append(book) - if manga: - tnl.append("*{0}*".format(manga)) - indexes.append(manga) - if show: - tnl.append("*{0}*".format(show)) - indexes.append(show) - if film: - tnl.append("*{0}*".format(film)) - indexes.append(film) + if title1: + if book: + tnl.append("**{0}**".format(book)) + indexes.append(book) + if manga: + tnl.append("**{0}**".format(manga)) + indexes.append(manga) + if show: + tnl.append("**{0}**".format(show)) + indexes.append(show) + if film: + tnl.append("**{0}**".format(film)) + indexes.append(film) + if author: + tnl.append("*{0}*, ".format(author)) + indexes.append(author) + else: + if author: + tnl.append("**{0}**, ".format(author)) + indexes.append(author) + if book: + tnl.append("*{0}*".format(book)) + indexes.append(book) + if manga: + tnl.append("*{0}*".format(manga)) + indexes.append(manga) + if show: + tnl.append("*{0}*".format(show)) + indexes.append(show) + if film: + tnl.append("*{0}*".format(film)) + indexes.append(film) if pages: tnl.append(", {0}".format(pages)) if date: