diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-04 16:27:39 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-07 15:08:42 +0000 |
commit | c2d0e1ac39b7aa96263e9311128eda56fa0f9aa7 (patch) | |
tree | 525f2fcb9551471238f78841511684590fff5fd2 /sources/shiboken2/generator/qtdoc/qtdocgenerator.h | |
parent | 4c54e22072765f0b3654e03482943d0fe1a6a0e7 (diff) |
QtXmlToSphinx: Refactor link handling
Forward declare QtXmlToSphinx::LinkContext as a public struct
and move the definition to the source file.
Replace the linkTag/linkTagEnding strings by an enumeration for the
type and flags for storing the bold/italic state.
Move the formatting to an operator<<(QTextStream,LinkContext)
for clarity.
Streamline the code checking the link text against the reference
in handleLinkText(), avoiding some unnecessary tests.
Add an 'External' type for external pages which do not have a role
keyword.
This fixes:
- Undoes a breakage introduced by c5582d3120249a902681454b2319df765ffa2cd8
converting all link refs to RST labels, clobbering the '~' used for some
function references. This is now limited to page type links.
- Broken handling of links within italic/bold: The assignment
to the linkTag variable by type would clobber the previously assigned
italic/bold markers
- Enable external links without role
Task-number: PYSIDE-363
Change-Id: I2e9a8cd80df93a77f3c6c9f8593243b35eeeb56e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/generator/qtdoc/qtdocgenerator.h')
-rw-r--r-- | sources/shiboken2/generator/qtdoc/qtdocgenerator.h | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h index d68eb1ea5..e467abe90 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h @@ -49,6 +49,8 @@ class QtDocGenerator; class QtXmlToSphinx { public: + struct LinkContext; + struct InlineImage { QString tag; @@ -114,17 +116,6 @@ public: } private: - struct LinkContext - { - LinkContext(const QString &ref, const QString &lType) : linkRef(ref), type(lType) {} - - QString linkTag; - QString linkRef; - QString linkText; - QString linkTagEnding; - QString type; - }; - QString resolveContextForMethod(const QString& methodName) const; QString expandFunction(const QString& function) const; QString transform(const QString& doc); @@ -161,7 +152,7 @@ private: void handleAnchorTag(QXmlStreamReader& reader); LinkContext *handleLinkStart(const QString &type, QString ref) const; - void handleLinkText(LinkContext *linkContext, QString linktext) const; + void handleLinkText(LinkContext *linkContext, const QString &linktext) const; void handleLinkEnd(LinkContext *linkContext); typedef void (QtXmlToSphinx::*TagHandler)(QXmlStreamReader&); |