| 109 | } |
| 110 | |
| 111 | void fix(QString& htmlPage) |
| 112 | { |
| 113 | const QLatin1String headEndTag("</head>"); |
| 114 | const auto headEndTagPos = htmlPage.indexOf(headEndTag, 0, Qt::CaseInsensitive); |
| 115 | if (headEndTagPos == -1) { |
| 116 | qCWarning(MANPAGE) << "missing" << headEndTag << "on the HTML page."; |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | // Apply our custom style sheet to normalize look of the page. Embed the <style> element |
| 121 | // into the HTML code directly rather than inject it with JavaScript to avoid reloading |
| 122 | // and flickering of large pages such as cmake-modules man page. |
| 123 | if (!m_customStyleSheet.isEmpty()) { |
| 124 | htmlPage.insert(headEndTagPos, m_customStyleSheet); |
| 125 | } |
| 126 | |
| 127 | expandUnsupportedLinks(htmlPage, headEndTagPos); |
| 128 | } |
| 129 | |
| 130 | void expandUnsupportedLinks(QString& htmlPage, int endPos) |
| 131 | { |