From f8e72bbbb851f1b227b39e10b49fb8e1adf7084f Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 9 Jul 2023 07:44:58 -0700 Subject: [PATCH] fix: doc::Overview --- lib/-adoc/AdocCorpus.cpp | 29 ++++++++++++++++++++++++++++- lib/Metadata/Javadoc.cpp | 7 +++++-- test-files/adoc/test.cpp | 28 +++++++++++++++++++++++++++- test-files/adoc/test.xml | 40 ++++++++++++++++++++++++++++++++++++++-- 4 files changed, 98 insertions(+), 6 deletions(-) diff --git a/lib/-adoc/AdocCorpus.cpp b/lib/-adoc/AdocCorpus.cpp index afda63a21..863088e79 100644 --- a/lib/-adoc/AdocCorpus.cpp +++ b/lib/-adoc/AdocCorpus.cpp @@ -15,6 +15,8 @@ #include #include +#include + namespace clang { namespace mrdox { namespace adoc { @@ -58,7 +60,29 @@ DocVisitor:: operator()( doc::Admonition const& I) { - //dest_ += I.string; + std::string_view label; + switch(I.admonish) + { + case doc::Admonish::note: + label = "NOTE"; + break; + case doc::Admonish::tip: + label = "TIP"; + break; + case doc::Admonish::important: + label = "IMPORTANT"; + break; + case doc::Admonish::caution: + label = "CAUTION"; + break; + case doc::Admonish::warning: + label = "WARNING"; + break; + default: + MRDOX_UNREACHABLE(); + } + dest_ += fmt::format("[{}]\n", label); + (*this)(static_cast(I)); } void @@ -123,6 +147,7 @@ operator()( } } dest_.push_back('\n'); + dest_.push_back('\n'); } void @@ -276,7 +301,9 @@ class DomJavadoc : public dom::LazyObjectImpl for(auto const& t : nodes) doc::visit(*t, visitor); if(! s.empty()) + { list.emplace_back(key, std::move(s)); + } }; dom::Object diff --git a/lib/Metadata/Javadoc.cpp b/lib/Metadata/Javadoc.cpp index 1f8d74e04..612b8a168 100644 --- a/lib/Metadata/Javadoc.cpp +++ b/lib/Metadata/Javadoc.cpp @@ -130,8 +130,11 @@ makeOverview( TParam const*>(it->get())); break; case Kind::paragraph: - ov.brief = static_cast< - Paragraph const*>(it->get()); + if(! ov.brief) + ov.brief = static_cast< + Paragraph const*>(it->get()); + else + ov.blocks.push_back(it->get()); break; default: ov.blocks.push_back(it->get()); diff --git a/test-files/adoc/test.cpp b/test-files/adoc/test.cpp index 9741d6c54..7c614f495 100644 --- a/test-files/adoc/test.cpp +++ b/test-files/adoc/test.cpp @@ -1 +1,27 @@ -struct T {}; +/** The type of string_view used by the library + + String views are used to pass character + buffers into or out of functions. Ownership + of the underlying character buffer is not + transferred; the caller is responsible for + ensuring that the lifetime of character + buffer extends until it is no longer + referenced. + + @note This alias is no longer supported and + should not be used in new code. Please use + `core::string_view` instead. + + This alias is included for backwards + compatibility with earlier versions of the + library. + + However, it will be removed in future releases, + and using it in new code is not recommended. + + Please use the updated version instead to + ensure compatibility with future versions of + the library. + +*/ +struct string_view{}; diff --git a/test-files/adoc/test.xml b/test-files/adoc/test.xml index 58b28f134..f3b633dfc 100644 --- a/test-files/adoc/test.xml +++ b/test-files/adoc/test.xml @@ -2,8 +2,44 @@ - - + + + + + The type of string_view used by the library + + + String views are used to pass character + buffers into or out of functions. Ownership + of the underlying character buffer is not + transferred; the caller is responsible for + ensuring that the lifetime of character + buffer extends until it is no longer + referenced. + + + + + + This alias is no longer supported and + should not be used in new code. Please use + `core::string_view` instead. + + + This alias is included for backwards + compatibility with earlier versions of the + library. + + + However, it will be removed in future releases, + and using it in new code is not recommended. + + + Please use the updated version instead to + ensure compatibility with future versions of + the library. + +