Skip to content

Commit 5158ee6

Browse files
committed
Merge branch 'albert-github-feature/bug_shortauthor'
2 parents c9e5588 + fd6bd5f commit 5158ee6

17 files changed

Lines changed: 146 additions & 117 deletions

src/docbookgen.cpp

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676

7777
inline void writeDocbookString(TextStream &t,const QCString &s)
7878
{
79-
t << convertToDocBook(s);
79+
t << DocbookGenerator::convertToDocbook(s);
8080
}
8181

8282
inline void writeDocbookCodeString(bool hide,TextStream &t,const QCString &str, size_t &col, size_t stripIndentAmount)
@@ -137,12 +137,12 @@ inline void writeDocbookCodeString(bool hide,TextStream &t,const QCString &str,
137137
static void addIndexTerm(TextStream &t, QCString prim, QCString sec = "")
138138
{
139139
t << "<indexterm><primary>";
140-
t << convertToDocBook(prim);
140+
t << DocbookGenerator::convertToDocbook(prim);
141141
t << "</primary>";
142142
if (!sec.isEmpty())
143143
{
144144
t << "<secondary>";
145-
t << convertToDocBook(sec);
145+
t << DocbookGenerator::convertToDocbook(sec);
146146
t << "</secondary>";
147147
}
148148
t << "</indexterm>\n";
@@ -456,7 +456,7 @@ DB_GEN_C2("IndexSection " << is)
456456
{
457457
QCString dbk_projectName = Config_getString(PROJECT_NAME);
458458
m_t << " <info>\n";
459-
m_t << " <title>" << convertToDocBook(dbk_projectName) << "</title>\n";
459+
m_t << " <title>" << convertToDocbook(dbk_projectName) << "</title>\n";
460460
m_t << " </info>\n";
461461
}
462462
break;
@@ -768,7 +768,7 @@ DB_GEN_C
768768
void DocbookGenerator::docify(const QCString &str)
769769
{
770770
DB_GEN_C
771-
m_t << convertToDocBook(str);
771+
m_t << convertToDocbook(str);
772772
}
773773
static QCString objectLinkToString(const QCString &, const QCString &f,
774774
const QCString &anchor, const QCString &text)
@@ -784,7 +784,7 @@ DB_GEN_C
784784
{
785785
result += "<link linkend=\"_" + stripPath(f) + "\">";
786786
}
787-
result += convertToDocBook(text);
787+
result += DocbookGenerator::convertToDocbook(text);
788788
result += "</link>";
789789
return result;
790790
}
@@ -911,7 +911,7 @@ void DocbookGenerator::startMemberDoc(const QCString &clname, const QCString &me
911911
{
912912
DB_GEN_C2("m_inLevel " << m_inLevel)
913913
openSection();
914-
m_t << " <title>" << convertToDocBook(title);
914+
m_t << " <title>" << convertToDocbook(title);
915915
if (memTotal>1)
916916
{
917917
m_t << "<computeroutput>[" << memCount << "/" << memTotal << "]</computeroutput>";
@@ -1165,7 +1165,7 @@ DB_GEN_C
11651165
title = theTranslator->trCompoundMembers();
11661166
}
11671167
m_t << "<table frame=\"all\">\n";
1168-
if (!title.isEmpty()) m_t << "<title>" << convertToDocBook(title) << "</title>\n";
1168+
if (!title.isEmpty()) m_t << "<title>" << convertToDocbook(title) << "</title>\n";
11691169
m_t << " <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n";
11701170
for (int i = 0; i < ncols; i++)
11711171
{
@@ -1220,12 +1220,12 @@ DB_GEN_C
12201220
m_t << "</entry></row>\n";
12211221
}
12221222

1223-
void DocbookGenerator::startDescTable(const QCString &title,const bool hasInits)
1223+
void DocbookGenerator::startDescTable(const QCString &title,bool hasInits)
12241224
{
12251225
DB_GEN_C
12261226
int ncols = (hasInits?3:2);
12271227
m_t << "<informaltable frame=\"all\">\n";
1228-
if (!title.isEmpty()) m_t << "<title>" << convertToDocBook(title) << "</title>\n";
1228+
if (!title.isEmpty()) m_t << "<title>" << convertToDocbook(title) << "</title>\n";
12291229
m_t << " <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n";
12301230
int i = 1;
12311231
m_t << " <colspec colname='c" << i++ << "'/>\n";
@@ -1411,7 +1411,7 @@ void DocbookGenerator::writeInheritedSectionTitle(
14111411
const QCString &title, const QCString &name)
14121412
{
14131413
DB_GEN_C
1414-
m_t << theTranslator->trInheritedFrom(convertToDocBook(title), objectLinkToString(ref, file, anchor, name));
1414+
m_t << theTranslator->trInheritedFrom(convertToDocbook(title), objectLinkToString(ref, file, anchor, name));
14151415
}
14161416

14171417
void DocbookGenerator::startLocalToc(int level)
@@ -1458,7 +1458,7 @@ void DocbookGenerator::startTocEntry(const SectionInfo *si)
14581458
}
14591459
if (nextLevel <= m_tocState.maxLevel)
14601460
{
1461-
QCString label = convertToDocBook(si->label());
1461+
QCString label = convertToDocbook(si->label());
14621462
m_t << " <tocentry>";
14631463
}
14641464
}
@@ -1481,21 +1481,19 @@ void DocbookGenerator::endTocEntry(const SectionInfo *si)
14811481
static constexpr auto hex="0123456789ABCDEF";
14821482

14831483
/*! Converts a string to an DocBook-encoded string */
1484-
QCString convertToDocBook(const QCString &s, const bool retainNewline)
1484+
QCString DocbookGenerator::convertToDocbook(const QCString &s, bool retainNewline, bool /* citeEntry */)
14851485
{
14861486
if (s.isEmpty()) return s;
14871487
QCString result;
14881488
result.reserve(s.length()+32);
14891489
const char *p = s.data();
1490-
const char *q = nullptr;
1491-
int cnt = 0;
14921490
char c = 0;
14931491
while ((c=*p++))
14941492
{
14951493
switch (c)
14961494
{
14971495
case '\n':
1498-
if (retainNewline)
1496+
if (retainNewline)
14991497
{
15001498
result+="<literallayout>&#160;&#xa;</literallayout>";
15011499
result+=c;
@@ -1504,33 +1502,7 @@ QCString convertToDocBook(const QCString &s, const bool retainNewline)
15041502
case '<': result+="&lt;"; break;
15051503
case '>': result+="&gt;"; break;
15061504
case '&': // possibility to have a special symbol
1507-
q = p;
1508-
cnt = 2; // we have to count & and ; as well
1509-
while ((*q >= 'a' && *q <= 'z') || (*q >= 'A' && *q <= 'Z') || (*q >= '0' && *q <= '9'))
1510-
{
1511-
cnt++;
1512-
q++;
1513-
}
1514-
if (*q == ';')
1515-
{
1516-
--p; // we need & as well
1517-
HtmlEntityMapper::SymType res = HtmlEntityMapper::instance().name2sym(QCString(p).left(cnt));
1518-
if (res == HtmlEntityMapper::Sym_Unknown)
1519-
{
1520-
p++;
1521-
result+="&amp;";
1522-
}
1523-
else
1524-
{
1525-
result+=HtmlEntityMapper::instance().docbook(res);
1526-
q++;
1527-
p = q;
1528-
}
1529-
}
1530-
else
1531-
{
1532-
result+="&amp;";
1533-
}
1505+
p = writeHtmlEntity(result, p-1, [](HtmlEntityMapper::SymType symType) { return HtmlEntityMapper::instance().docbook(symType); }, "&amp;");
15341506
break;
15351507
case '\'': result+="&apos;"; break;
15361508
case '"': result+="&quot;"; break;

src/docbookgen.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class DocbookGenerator final : public OutputGenerator, public OutputGenIntf
178178
void addIndexItem(const QCString &,const QCString &) override;
179179
void writeNonBreakableSpace(int) override;
180180

181-
void startDescTable(const QCString &title,const bool hasInits) override;
181+
void startDescTable(const QCString &title,bool hasInits) override;
182182
void endDescTable() override;
183183
void startDescTableRow() override;
184184
void endDescTableRow() override;
@@ -322,6 +322,7 @@ class DocbookGenerator final : public OutputGenerator, public OutputGenIntf
322322

323323
void startEmbeddedDoc(int) override {}
324324
void endEmbeddedDoc() override {}
325+
static QCString convertToDocbook(const QCString &s, bool retainNewline = false, bool citeEntry = false);
325326

326327
private:
327328
void openSection(const QCString &attr=QCString());
@@ -352,7 +353,6 @@ class DocbookGenerator final : public OutputGenerator, public OutputGenIntf
352353
TocState m_tocState;
353354
};
354355

355-
QCString convertToDocBook(const QCString &s, const bool retainNewline = false);
356356

357357

358358
#endif

0 commit comments

Comments
 (0)