diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-06-18 13:50:09 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-18 22:30:18 +0000 |
commit | 6f20dba6d25dac1a78558a07f4a7e0430546c03a (patch) | |
tree | 0221978137a5d2fcec75f7a4474cad126256697b | |
parent | 999dd469bed2c533089465274f0e436a98134e78 (diff) |
shiboken6/Doc generator: Fix HTTP URLs in documentation
Always use as "external", do not reformat them as RST labels.
Fixes for example the link to the Sinclair ZX Spectrum page in the QLCDnumber
documentation, which appeared as WebXML link tag and was reformatted.
Change-Id: Ibf0195365488979bdfd3e08cdd59e77860ac30f6
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit 705b80e6a427ac9d27e0e1911e1bdcfb17634b12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp index 20681f426..52d8f4614 100644 --- a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp +++ b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp @@ -69,6 +69,11 @@ QString msgFallbackWarning(const QXmlStreamReader &reader, const QString &contex return msgTagWarning(reader, context, tag, message); } +static bool isHttpLink(const QString &ref) +{ + return ref.startsWith(u"http://") || ref.startsWith(u"https://"); +} + struct QtXmlToSphinx::LinkContext { enum Type @@ -931,7 +936,9 @@ QtXmlToSphinx::LinkContext *QtXmlToSphinx::handleLinkStart(const QString &type, else if (m_insideItalic) result->flags |= LinkContext::InsideItalic; - if (type == functionLinkType() && !m_context.isEmpty()) { + if (type == u"external" || isHttpLink(ref)) { + result->type = LinkContext::External; + } else if (type == functionLinkType() && !m_context.isEmpty()) { result->type = LinkContext::Method; const auto rawlinklist = QStringView{result->linkRef}.split(QLatin1Char('.')); if (rawlinklist.size() == 1 || rawlinklist.constFirst() == m_context) { @@ -953,12 +960,8 @@ QtXmlToSphinx::LinkContext *QtXmlToSphinx::handleLinkStart(const QString &type, // Module, external web page or reference if (result->linkRef == m_parameters.moduleName) result->type = LinkContext::Module; - else if (result->linkRef.startsWith(QLatin1String("http"))) - result->type = LinkContext::External; else result->type = LinkContext::Reference; - } else if (type == QLatin1String("external")) { - result->type = LinkContext::External; } else { result->type = LinkContext::Reference; } |