22 startMark.prepend(
"$$$"_L1);
23 endMark.prepend(
"<!-- @@@"_L1);
26 qsizetype start = html.indexOf(startMark);
28 start = html.indexOf(
"-->"_L1, start);
30 qsizetype end = html.indexOf(endMark, start);
32 start += qsizetype(std::char_traits<
char>::length(
"-->"));
33 contents = html.mid(start, end - start);
61 const auto skipFirstParagraphIfNeeded = [html](qsizetype &index){
62 const bool shouldSkipFirstParagraph = html->indexOf(QLatin1String(
"<p><i>")) == index ||
63 html->indexOf(QLatin1String(
"<p><tt>")) == index ||
64 html->indexOf(QLatin1String(
"<p><b>")) == index ||
65 html->indexOf(QLatin1String(
"<p>[Conditional]</p>")) == index;
67 if (shouldSkipFirstParagraph)
68 index = html->indexOf(QLatin1String(
"</p>"), index) + lengthOfEndParagraphTag;
74 qsizetype index = html->indexOf(QLatin1String(
"<p>"));
75 if (index != -1 && index < firstIndexOfParagraphTag) {
76 skipFirstParagraphIfNeeded(index);
77 qsizetype endIndex = html->indexOf(QLatin1String(
"</p>"), index + lengthOfStartParagraphTag);
79 *html = html->mid(index, endIndex - index);
110 if (mode == ExtractionMode::Simplified) {
111 result = getContentsByMarks(code, element +
"-brief"_L1 , element);
113 if (!result.isEmpty()) {
114 const auto tailToRemove =
"More..."_L1;
115 const auto lastIndex = result.lastIndexOf(tailToRemove);
117 result.remove(lastIndex, tailToRemove.length());
120 result = getContentsByMarks(code, element +
"-description"_L1, element);
122 if (!result.isEmpty()) {
123 const auto headerToRemove =
"Detailed Description"_L1;
124 const auto firstIndex = result.indexOf(headerToRemove);
125 if (firstIndex != -1)
126 result.remove(firstIndex, headerToRemove.length());
130 stripAllHtml(&result);
131 return result.trimmed();
138 QString startMark = QString::fromLatin1(
"<a name=\"%1-prop\">").arg(keyword);
139 qsizetype startIndex = code.indexOf(startMark);
140 if (startIndex == -1) {
142 startMark = QString::fromLatin1(
143 "<td class=\"tblQmlPropNode\"><p>\n<span class=\"name\">%1</span>")
145 startIndex = code.indexOf(startMark);
148 if (startIndex != -1) {
149 result = code.mid(startIndex + startMark.size());
150 startIndex = result.indexOf(QLatin1String(
"<div class=\"qmldoc\"><p>"));
152 result = getContentsByMarks(code, keyword +
"-prop"_L1, keyword );
153 startIndex = result.indexOf(QLatin1String(
"<p>"));
156 if (startIndex == -1)
158 result = result.mid(startIndex);
159 if (mode == ExtractionMode::Simplified)
160 processOutput(&result);
161 stripAllHtml(&result);
162 return result.trimmed();
168 QString mark = QString::fromLatin1(
"$$$%1[overload1]$$$%1").arg(keyword);
169 qsizetype startIndex = code.indexOf(mark);
170 if (startIndex != -1) {
171 startIndex = code.indexOf(
"-->"_L1, startIndex + mark.length());
172 if (startIndex == -1)
176 mark = QString::fromLatin1(
"<span class=\"name\">%1</span>")
178 startIndex = code.indexOf(mark);
179 if (startIndex != -1)
180 startIndex += mark.length();
185 startIndex = code.indexOf(QLatin1String(
"<div class=\"qmldoc\"><p>"), startIndex);
186 if (startIndex == -1)
189 QString endMark = QString::fromLatin1(
"<!-- @@@");
190 qsizetype endIndex = code.indexOf(endMark, startIndex);
191 QString contents = code.mid(startIndex, endIndex);
192 if (mode == ExtractionMode::Simplified)
193 processOutput(&contents);
194 stripAllHtml(&contents);
195 return contents.trimmed();
200 using namespace QQmlJS::Dom;
202 case DomType::QmlObject:
203 m_extractor = std::make_unique<ExtractQmlType>();
205 case DomType::Binding:
206 case DomType::PropertyDefinition:
207 m_extractor = std::make_unique<ExtractQmlProperty>();
209 case DomType::MethodInfo:
210 m_extractor = std::make_unique<ExtractQmlMethodOrSignal>();