| 49 | } |
| 50 | |
| 51 | QString MacroNavigationContext::html(bool shorten) |
| 52 | { |
| 53 | Q_UNUSED(shorten); |
| 54 | clear(); |
| 55 | |
| 56 | modifyHtml() += QStringLiteral("<html><body><p>"); |
| 57 | |
| 58 | const QUrl url = m_macro->url().toUrl(); |
| 59 | const QString path = url.toLocalFile(); |
| 60 | KTextEditor::Cursor cursor(m_macro->rangeInCurrentRevision().start()); |
| 61 | NavigationAction action(url, cursor); |
| 62 | modifyHtml() += i18nc("%1: macro type, i.e.: 'Function macro' or just 'Macro'" |
| 63 | "%2: the macro name and arguments", |
| 64 | "%1: %2", |
| 65 | (m_macro->isFunctionLike() ? i18n("Function macro") : i18n("Macro")), |
| 66 | importantHighlight(name()) + parameterListString(*m_macro)); |
| 67 | modifyHtml() += QStringLiteral("<br/>"); |
| 68 | modifyHtml() += i18nc("%1: the link to the definition", "Defined in: %1", |
| 69 | createLink(QStringLiteral("%1 :%2").arg(url.fileName()).arg(cursor.line()+1), path, action)); |
| 70 | |
| 71 | modifyHtml() += QStringLiteral(" "); //The action name _must_ stay "show_uses", since that is also used from outside |
| 72 | makeLink(i18n("Show uses"), QStringLiteral("show_uses"), NavigationAction(m_macro.dynamicCast<Declaration>(), NavigationAction::NavigateUses)); |
| 73 | |
| 74 | auto code = m_macro->definition().str(); |
| 75 | modifyHtml() += QLatin1String("<p>") + i18n("Body: "); |
| 76 | modifyHtml() += QLatin1String("<tt>") + code.toHtmlEscaped().replace(QLatin1Char('\n'), QStringLiteral("<br/>")) + QLatin1String("</tt>"); |
| 77 | modifyHtml() += QStringLiteral("</p>"); |
| 78 | |
| 79 | modifyHtml() += QStringLiteral("</p></body></html>"); |
| 80 | return currentHtml(); |
| 81 | } |
| 82 | |
| 83 | QString MacroNavigationContext::retrievePreprocessedBody(const DocumentCursor& /*expansionLocation*/) const |
| 84 | { |
no test coverage detected