Macros | Functions | Variables
htmlgen.cpp File Reference
#include <stdlib.h>
#include <qdir.h>
#include <qregexp.h>
#include "message.h"
#include "htmlgen.h"
#include "config.h"
#include "util.h"
#include "doxygen.h"
#include "logos.h"
#include "diagram.h"
#include "version.h"
#include "dot.h"
#include "language.h"
#include "htmlhelp.h"
#include "docparser.h"
#include "htmldocvisitor.h"
#include "searchindex.h"
#include "pagedef.h"
#include "debug.h"
#include "dirdef.h"
#include "vhdldocgen.h"
#include "layout.h"
#include "image.h"
#include "ftvhelp.h"
#include "bufstr.h"
#include "resourcemgr.h"

Go to the source code of this file.

Macros

#define DBG_HTML(x)
 

Functions

static void writeClientSearchBox (FTextStream &t, const char *relPath)
 
static void writeServerSearchBox (FTextStream &t, const char *relPath, bool highlightSearch)
 
QCString clearBlock (const char *s, const char *begin, const char *end)
 Clear a text block s from begin to end markers. More...
 
QCString selectBlock (const QCString &s, const QCString &name, bool enable)
 
static QCString getSearchBox (bool serverSide, QCString relPath, bool highlightSearch)
 
static QCString removeEmptyLines (const QCString &s)
 
static QCString substituteHtmlKeywords (const QCString &s, const QCString &title, const QCString &relPath, const QCString &navPath=QCString())
 
static void startSectionHeader (FTextStream &t, const QCString &relPath, int sectionCount)
 
static void endSectionHeader (FTextStream &t)
 
static void startSectionSummary (FTextStream &t, int sectionCount)
 
static void endSectionSummary (FTextStream &t)
 
static void startSectionContent (FTextStream &t, int sectionCount)
 
static void endSectionContent (FTextStream &t)
 
static void startQuickIndexList (FTextStream &t, bool compact, bool topLevel=TRUE)
 
static void endQuickIndexList (FTextStream &t, bool compact)
 
static void startQuickIndexItem (FTextStream &t, const char *l, bool hl, bool, const QCString &relPath)
 
static void endQuickIndexItem (FTextStream &t, const char *l)
 
static bool quickLinkVisible (LayoutNavEntry::Kind kind)
 
static void renderQuickLinksAsTree (FTextStream &t, const QCString &relPath, LayoutNavEntry *root)
 
static void renderQuickLinksAsTabs (FTextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
 
static void writeDefaultQuickLinks (FTextStream &t, bool compact, HighlightedItem hli, const char *file, const QCString &relPath)
 

Variables

static QCString g_header
 
static QCString g_footer
 
static QCString g_mathjax_code
 

Macro Definition Documentation

#define DBG_HTML (   x)

Definition at line 48 of file htmlgen.cpp.

Function Documentation

QCString clearBlock ( const char *  s,
const char *  begin,
const char *  end 
)

Clear a text block s from begin to end markers.

Definition at line 106 of file htmlgen.cpp.

107 {
108  if (s==0 || begin==0 || end==0) return s;
109  const char *p, *q;
110  int beginLen = qstrlen(begin);
111  int endLen = qstrlen(end);
112  int resLen = 0;
113  for (p=s; (q=strstr(p,begin))!=0; p=q+endLen)
114  {
115  resLen+=(int)(q-p);
116  p=q+beginLen;
117  if ((q=strstr(p,end))==0)
118  {
119  resLen+=beginLen;
120  break;
121  }
122  }
123  resLen+=qstrlen(p);
124  // resLen is the length of the string without the marked block
125 
126  QCString result(resLen+1);
127  char *r;
128  for (r=result.rawData(), p=s; (q=strstr(p,begin))!=0; p=q+endLen)
129  {
130  int l = (int)(q-p);
131  memcpy(r,p,l);
132  r+=l;
133  p=q+beginLen;
134  if ((q=strstr(p,end))==0)
135  {
136  memcpy(r,begin,beginLen);
137  r+=beginLen;
138  break;
139  }
140  }
141  qstrcpy(r,p);
142  return result;
143 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
char * rawData() const
Definition: qcstring.h:216
static QCString result
static QStrList * l
Definition: config.cpp:1044
Q_EXPORT uint qstrlen(const char *str)
Definition: qcstring.h:81
p
Definition: test.py:223
Q_EXPORT char * qstrcpy(char *dst, const char *src)
Definition: qcstring.h:87
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
static QCString * s
Definition: config.cpp:1042
static void endQuickIndexItem ( FTextStream t,
const char *  l 
)
static

Definition at line 1930 of file htmlgen.cpp.

1931 {
1932  t << "</span>";
1933  if (l) t << "</a>";
1934  t << "</li>\n";
1935 }
static QStrList * l
Definition: config.cpp:1044
static void endQuickIndexList ( FTextStream t,
bool  compact 
)
static

Definition at line 1903 of file htmlgen.cpp.

1904 {
1905  if (compact)
1906  {
1907  t << " </ul>\n";
1908  t << " </div>\n";
1909  }
1910  else
1911  {
1912  t << "</ul>\n";
1913  }
1914 }
static void endSectionContent ( FTextStream t)
static

Definition at line 1321 of file htmlgen.cpp.

1322 {
1323  //t << "<!-- endSectionContent -->";
1324  t << "</div>" << endl;
1325 }
QTextStream & endl(QTextStream &s)
static void endSectionHeader ( FTextStream t)
static

Definition at line 1277 of file htmlgen.cpp.

1278 {
1279  //t << "<!-- endSectionHeader -->";
1280  t << "</div>" << endl;
1281 }
QTextStream & endl(QTextStream &s)
static void endSectionSummary ( FTextStream t)
static

Definition at line 1295 of file htmlgen.cpp.

1296 {
1297  //t << "<!-- endSectionSummary -->";
1298  static bool dynamicSections = Config_getBool("HTML_DYNAMIC_SECTIONS");
1299  if (dynamicSections)
1300  {
1301  t << "</div>" << endl;
1302  }
1303 }
#define Config_getBool(val)
Definition: config.cpp:664
QTextStream & endl(QTextStream &s)
static QCString getSearchBox ( bool  serverSide,
QCString  relPath,
bool  highlightSearch 
)
static

Definition at line 171 of file htmlgen.cpp.

172 {
174  FTextStream t(&result);
175  if (serverSide)
176  {
177  writeServerSearchBox(t, relPath, highlightSearch);
178  }
179  else
180  {
181  writeClientSearchBox(t, relPath);
182  }
183  return QCString(result);
184 }
static QCString result
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
static void writeServerSearchBox(FTextStream &t, const char *relPath, bool highlightSearch)
Definition: htmlgen.cpp:75
static void writeClientSearchBox(FTextStream &t, const char *relPath)
Definition: htmlgen.cpp:55
static bool quickLinkVisible ( LayoutNavEntry::Kind  kind)
static

Definition at line 1937 of file htmlgen.cpp.

1938 {
1939  static bool showFiles = Config_getBool("SHOW_FILES");
1940  static bool showNamespaces = Config_getBool("SHOW_NAMESPACES");
1941  switch (kind)
1942  {
1943  case LayoutNavEntry::MainPage: return TRUE;
1944  case LayoutNavEntry::User: return TRUE;
1945  case LayoutNavEntry::UserGroup: return TRUE;
1946  case LayoutNavEntry::Pages: return indexedPages>0;
1948  case LayoutNavEntry::Namespaces: return documentedNamespaces>0 && showNamespaces;
1949  case LayoutNavEntry::NamespaceList: return documentedNamespaces>0 && showNamespaces;
1956  case LayoutNavEntry::Files: return documentedHtmlFiles>0 && showFiles;
1957  case LayoutNavEntry::FileList: return documentedHtmlFiles>0 && showFiles;
1959  //case LayoutNavEntry::Dirs: return documentedDirs>0;
1961  }
1962  return FALSE;
1963 }
static PageSDict * exampleSDict
Definition: doxygen.h:101
int documentedHtmlFiles
Definition: index.cpp:65
int documentedFileMembers[FMHL_Total]
Definition: index.cpp:63
int documentedClassMembers[CMHL_Total]
Definition: index.cpp:62
const bool FALSE
Definition: qglobal.h:370
int count() const
Definition: sortdict.h:284
int hierarchyClasses
Definition: index.cpp:57
int indexedPages
Definition: index.cpp:61
#define Config_getBool(val)
Definition: config.cpp:664
int documentedGroups
Definition: index.cpp:59
int documentedNamespaces
Definition: index.cpp:60
int documentedNamespaceMembers[NMHL_Total]
Definition: index.cpp:64
const bool TRUE
Definition: qglobal.h:371
int annotatedClasses
Definition: index.cpp:55
static QCString removeEmptyLines ( const QCString s)
static

Definition at line 186 of file htmlgen.cpp.

187 {
188  BufStr out(s.length()+1);
189  const char *p=s.data();
190  if (p)
191  {
192  char c;
193  while ((c=*p++))
194  {
195  if (c=='\n')
196  {
197  const char *e = p;
198  while (*e==' ' || *e=='\t') e++;
199  if (*e=='\n')
200  {
201  p=e;
202  }
203  else out.addChar(c);
204  }
205  else
206  {
207  out.addChar(c);
208  }
209  }
210  }
211  out.addChar('\0');
212  //printf("removeEmptyLines(%s)=%s\n",s.data(),out.data());
213  return out.data();
214 }
uint length() const
Definition: qcstring.h:195
const double e
p
Definition: test.py:223
const char * data() const
Definition: qcstring.h:207
Buffer used to store strings.
Definition: bufstr.h:30
static void renderQuickLinksAsTabs ( FTextStream t,
const QCString relPath,
LayoutNavEntry hlEntry,
LayoutNavEntry::Kind  kind,
bool  highlightParent,
bool  highlightSearch 
)
static

Definition at line 1996 of file htmlgen.cpp.

1999 {
2000  if (hlEntry->parent()) // first draw the tabs for the parent of hlEntry
2001  {
2002  renderQuickLinksAsTabs(t,relPath,hlEntry->parent(),kind,highlightParent,highlightSearch);
2003  }
2004  if (hlEntry->parent() && hlEntry->parent()->children().count()>0) // draw tabs for row containing hlEntry
2005  {
2006  bool topLevel = hlEntry->parent()->parent()==0;
2007  QListIterator<LayoutNavEntry> li(hlEntry->parent()->children());
2009 
2010  int count=0;
2011  for (li.toFirst();(entry=li.current());++li)
2012  {
2013  if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2014  }
2015  if (count>0) // at least one item is visible
2016  {
2017  startQuickIndexList(t,TRUE,topLevel);
2018  for (li.toFirst();(entry=li.current());++li)
2019  {
2020  if (entry->visible() && quickLinkVisible(entry->kind()))
2021  {
2022  QCString url = entry->url();
2023  startQuickIndexItem(t,url,
2024  entry==hlEntry &&
2025  (entry->children().count()>0 ||
2026  (entry->kind()==kind && !highlightParent)
2027  ),
2028  TRUE,relPath);
2029  t << fixSpaces(entry->title());
2030  endQuickIndexItem(t,url);
2031  }
2032  }
2033  if (hlEntry->parent()==LayoutDocManager::instance().rootNavEntry()) // first row is special as it contains the search box
2034  {
2035  static bool searchEngine = Config_getBool("SEARCHENGINE");
2036  static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH");
2037  if (searchEngine)
2038  {
2039  t << " <li>\n";
2040  if (!serverBasedSearch) // pure client side search
2041  {
2042  writeClientSearchBox(t,relPath);
2043  t << " </li>\n";
2044  }
2045  else // server based search
2046  {
2047  writeServerSearchBox(t,relPath,highlightSearch);
2048  if (!highlightSearch)
2049  {
2050  t << " </li>\n";
2051  }
2052  }
2053  }
2054  if (!highlightSearch) // on the search page the index will be ended by the
2055  // page itself
2056  {
2058  }
2059  }
2060  else // normal case for other rows than first one
2061  {
2063  }
2064  }
2065  }
2066 }
QList< Entry > entry
static LayoutDocManager & instance()
Definition: layout.cpp:1359
static bool quickLinkVisible(LayoutNavEntry::Kind kind)
Definition: htmlgen.cpp:1937
const QList< LayoutNavEntry > & children() const
Definition: layout.h:157
Base class for the layout of a navigation item at the top of the HTML pages.
Definition: layout.h:118
uint count() const
Definition: qlist.h:66
uint count() const
Definition: qlist.h:131
static void startQuickIndexList(FTextStream &t, bool compact, bool topLevel=TRUE)
Definition: htmlgen.cpp:1883
type * current() const
Definition: qlist.h:146
#define Config_getBool(val)
Definition: config.cpp:664
LayoutNavEntry * rootNavEntry() const
Definition: layout.cpp:1370
static void writeServerSearchBox(FTextStream &t, const char *relPath, bool highlightSearch)
Definition: htmlgen.cpp:75
static void renderQuickLinksAsTabs(FTextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
Definition: htmlgen.cpp:1996
QCString fixSpaces(const QCString &s)
Definition: index.cpp:223
static void endQuickIndexItem(FTextStream &t, const char *l)
Definition: htmlgen.cpp:1930
static void startQuickIndexItem(FTextStream &t, const char *l, bool hl, bool, const QCString &relPath)
Definition: htmlgen.cpp:1916
static void endQuickIndexList(FTextStream &t, bool compact)
Definition: htmlgen.cpp:1903
LayoutNavEntry * parent() const
Definition: layout.h:147
static void writeClientSearchBox(FTextStream &t, const char *relPath)
Definition: htmlgen.cpp:55
const bool TRUE
Definition: qglobal.h:371
static void renderQuickLinksAsTree ( FTextStream t,
const QCString relPath,
LayoutNavEntry root 
)
static

Definition at line 1965 of file htmlgen.cpp.

1967 {
1970  int count=0;
1971  for (li.toFirst();(entry=li.current());++li)
1972  {
1973  if (entry->visible() && quickLinkVisible(entry->kind())) count++;
1974  }
1975  if (count>0) // at least one item is visible
1976  {
1978  for (li.toFirst();(entry=li.current());++li)
1979  {
1980  if (entry->visible() && quickLinkVisible(entry->kind()))
1981  {
1982  QCString url = entry->url();
1983  t << "<li><a href=\"" << relPath << url << "\"><span>";
1984  t << fixSpaces(entry->title());
1985  t << "</span></a>\n";
1986  // recursive into child list
1987  renderQuickLinksAsTree(t,relPath,entry);
1988  t << "</li>";
1989  }
1990  }
1992  }
1993 }
QList< Entry > entry
const bool FALSE
Definition: qglobal.h:370
static bool quickLinkVisible(LayoutNavEntry::Kind kind)
Definition: htmlgen.cpp:1937
static void renderQuickLinksAsTree(FTextStream &t, const QCString &relPath, LayoutNavEntry *root)
Definition: htmlgen.cpp:1965
const QList< LayoutNavEntry > & children() const
Definition: layout.h:157
Base class for the layout of a navigation item at the top of the HTML pages.
Definition: layout.h:118
static void startQuickIndexList(FTextStream &t, bool compact, bool topLevel=TRUE)
Definition: htmlgen.cpp:1883
type * current() const
Definition: qlist.h:146
QCString fixSpaces(const QCString &s)
Definition: index.cpp:223
static void endQuickIndexList(FTextStream &t, bool compact)
Definition: htmlgen.cpp:1903
QCString selectBlock ( const QCString s,
const QCString name,
bool  enable 
)

Definition at line 146 of file htmlgen.cpp.

147 {
148  // TODO: this is an expensive function that is called a lot -> optimize it
149  const QCString begin = "<!--BEGIN " + name + "-->";
150  const QCString end = "<!--END " + name + "-->";
151  const QCString nobegin = "<!--BEGIN !" + name + "-->";
152  const QCString noend = "<!--END !" + name + "-->";
153 
154  QCString result = s;
155  if (enable)
156  {
157  result = substitute(result, begin, "");
158  result = substitute(result, end, "");
159  result = clearBlock(result, nobegin, noend);
160  }
161  else
162  {
163  result = substitute(result, nobegin, "");
164  result = substitute(result, noend, "");
165  result = clearBlock(result, begin, end);
166  }
167 
168  return result;
169 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
static QCString result
QCString clearBlock(const char *s, const char *begin, const char *end)
Clear a text block s from begin to end markers.
Definition: htmlgen.cpp:106
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
static QCString * s
Definition: config.cpp:1042
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
static void startQuickIndexItem ( FTextStream t,
const char *  l,
bool  hl,
bool  ,
const QCString relPath 
)
static

Definition at line 1916 of file htmlgen.cpp.

1919 {
1920  t << " <li";
1921  if (hl)
1922  {
1923  t << " class=\"current\"";
1924  }
1925  t << ">";
1926  if (l) t << "<a href=\"" << correctURL(l,relPath) << "\">";
1927  t << "<span>";
1928 }
static QStrList * l
Definition: config.cpp:1044
QCString correctURL(const QCString &url, const QCString &relPath)
Definition: util.cpp:8084
static void startQuickIndexList ( FTextStream t,
bool  compact,
bool  topLevel = TRUE 
)
static

Definition at line 1883 of file htmlgen.cpp.

1884 {
1885  if (compact)
1886  {
1887  if (topLevel)
1888  {
1889  t << " <div id=\"navrow1\" class=\"tabs\">\n";
1890  }
1891  else
1892  {
1893  t << " <div id=\"navrow2\" class=\"tabs2\">\n";
1894  }
1895  t << " <ul class=\"tablist\">\n";
1896  }
1897  else
1898  {
1899  t << "<ul>";
1900  }
1901 }
static void startSectionContent ( FTextStream t,
int  sectionCount 
)
static

Definition at line 1305 of file htmlgen.cpp.

1306 {
1307  //t << "<!-- startSectionContent -->";
1308  static bool dynamicSections = Config_getBool("HTML_DYNAMIC_SECTIONS");
1309  if (dynamicSections)
1310  {
1311  t << "<div id=\"dynsection-" << sectionCount << "-content\" "
1312  "class=\"dyncontent\" "
1313  "style=\"display:none;\">" << endl;
1314  }
1315  else
1316  {
1317  t << "<div class=\"dyncontent\">" << endl;
1318  }
1319 }
#define Config_getBool(val)
Definition: config.cpp:664
QTextStream & endl(QTextStream &s)
static void startSectionHeader ( FTextStream t,
const QCString relPath,
int  sectionCount 
)
static

Definition at line 1257 of file htmlgen.cpp.

1259 {
1260  //t << "<!-- startSectionHeader -->";
1261  static bool dynamicSections = Config_getBool("HTML_DYNAMIC_SECTIONS");
1262  if (dynamicSections)
1263  {
1264  t << "<div id=\"dynsection-" << sectionCount << "\" "
1265  "onclick=\"return toggleVisibility(this)\" "
1266  "class=\"dynheader closed\" "
1267  "style=\"cursor:pointer;\">" << endl;
1268  t << " <img id=\"dynsection-" << sectionCount << "-trigger\" src=\""
1269  << relPath << "closed.png\" alt=\"+\"/> ";
1270  }
1271  else
1272  {
1273  t << "<div class=\"dynheader\">" << endl;
1274  }
1275 }
#define Config_getBool(val)
Definition: config.cpp:664
QTextStream & endl(QTextStream &s)
static void startSectionSummary ( FTextStream t,
int  sectionCount 
)
static

Definition at line 1283 of file htmlgen.cpp.

1284 {
1285  //t << "<!-- startSectionSummary -->";
1286  static bool dynamicSections = Config_getBool("HTML_DYNAMIC_SECTIONS");
1287  if (dynamicSections)
1288  {
1289  t << "<div id=\"dynsection-" << sectionCount << "-summary\" "
1290  "class=\"dynsummary\" "
1291  "style=\"display:block;\">" << endl;
1292  }
1293 }
#define Config_getBool(val)
Definition: config.cpp:664
QTextStream & endl(QTextStream &s)
static QCString substituteHtmlKeywords ( const QCString s,
const QCString title,
const QCString relPath,
const QCString navPath = QCString() 
)
static

Definition at line 216 of file htmlgen.cpp.

220 {
221  // Build CSS/Javascript tags depending on treeview, search engine settings
222  QCString cssFile;
223  QStrList extraCssFile;
224  QCString generatedBy;
225  QCString treeViewCssJs;
226  QCString searchCssJs;
227  QCString searchBox;
228  QCString mathJaxJs;
229  QCString extraCssText;
230 
231  static QCString projectName = Config_getString("PROJECT_NAME");
232  static bool timeStamp = Config_getBool("HTML_TIMESTAMP");
233  static bool treeView = Config_getBool("GENERATE_TREEVIEW");
234  static bool searchEngine = Config_getBool("SEARCHENGINE");
235  static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH");
236  static bool mathJax = Config_getBool("USE_MATHJAX");
237  static QCString mathJaxFormat = Config_getEnum("MATHJAX_FORMAT");
238  static bool disableIndex = Config_getBool("DISABLE_INDEX");
239  static bool hasProjectName = !projectName.isEmpty();
240  static bool hasProjectNumber = !Config_getString("PROJECT_NUMBER").isEmpty();
241  static bool hasProjectBrief = !Config_getString("PROJECT_BRIEF").isEmpty();
242  static bool hasProjectLogo = !Config_getString("PROJECT_LOGO").isEmpty();
243  static bool titleArea = (hasProjectName || hasProjectBrief || hasProjectLogo || (disableIndex && searchEngine));
244 
245  cssFile = Config_getString("HTML_STYLESHEET");
246  if (cssFile.isEmpty())
247  {
248  cssFile = "doxygen.css";
249  }
250  else
251  {
252  QFileInfo cssfi(cssFile);
253  if (cssfi.exists())
254  {
255  cssFile = cssfi.fileName().utf8();
256  }
257  else
258  {
259  cssFile = "doxygen.css";
260  }
261  }
262 
263  extraCssText = "";
264  extraCssFile = Config_getList("HTML_EXTRA_STYLESHEET");
265  for (uint i=0; i<extraCssFile.count(); ++i)
266  {
267  QCString fileName(extraCssFile.at(i));
268  if (!fileName.isEmpty())
269  {
270  QFileInfo fi(fileName);
271  if (fi.exists())
272  {
273  extraCssText += "<link href=\"$relpath^"+stripPath(fileName)+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
274  }
275  }
276  }
277 
278  if (timeStamp)
279  {
280  generatedBy = theTranslator->trGeneratedAt(dateToString(TRUE), convertToHtml(Config_getString("PROJECT_NAME")));
281  }
282  else
283  {
284  generatedBy = theTranslator->trGeneratedBy();
285  }
286 
287  if (treeView)
288  {
289  treeViewCssJs = "<link href=\"$relpath^navtree.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
290  "<script type=\"text/javascript\" src=\"$relpath^resize.js\"></script>\n"
291  "<script type=\"text/javascript\" src=\"$relpath^navtreedata.js\"></script>\n"
292  "<script type=\"text/javascript\" src=\"$relpath^navtree.js\"></script>\n"
293  "<script type=\"text/javascript\">\n"
294  " $(document).ready(initResizable);\n"
295  " $(window).load(resizeHeight);\n"
296  "</script>";
297  }
298 
299  if (searchEngine)
300  {
301  searchCssJs = "<link href=\"$relpath^search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
302  if (!serverBasedSearch)
303  {
304  searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/searchdata.js\"></script>\n";
305  }
306  searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n";
307 
308  if (!serverBasedSearch)
309  {
310  searchCssJs += "<script type=\"text/javascript\">\n"
311  " $(document).ready(function() { init_search(); });\n"
312  "</script>";
313  }
314  else
315  {
316  searchCssJs += "<script type=\"text/javascript\">\n"
317  " $(document).ready(function() {\n"
318  " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
319  " });\n"
320  "</script>\n";
321 
322  // OPENSEARCH_PROVIDER {
323  searchCssJs += "<link rel=\"search\" href=\"" + relPath +
324  "search_opensearch.php?v=opensearch.xml\" "
325  "type=\"application/opensearchdescription+xml\" title=\"" +
326  (hasProjectName ? projectName : QCString("Doxygen")) +
327  "\"/>";
328  // OPENSEARCH_PROVIDER }
329  }
330  searchBox = getSearchBox(serverBasedSearch, relPath, FALSE);
331  }
332 
333  if (mathJax)
334  {
335  QCString path = Config_getString("MATHJAX_RELPATH");
336  if (path.isEmpty() || path.left(2)=="..") // relative path
337  {
338  path.prepend(relPath);
339  }
340  mathJaxJs = "<script type=\"text/x-mathjax-config\">\n"
341  " MathJax.Hub.Config({\n"
342  " extensions: [\"tex2jax.js\"";
343  QStrList &mathJaxExtensions = Config_getList("MATHJAX_EXTENSIONS");
344  const char *s = mathJaxExtensions.first();
345  while (s)
346  {
347  mathJaxJs+= ", \""+QCString(s)+".js\"";
348  s = mathJaxExtensions.next();
349  }
350  if (mathJaxFormat.isEmpty())
351  {
352  mathJaxFormat = "HTML-CSS";
353  }
354  mathJaxJs += "],\n"
355  " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n"
356  "});\n";
357  if (!g_mathjax_code.isEmpty())
358  {
359  mathJaxJs += g_mathjax_code;
360  mathJaxJs += "\n";
361  }
362  mathJaxJs += "</script>";
363  mathJaxJs += "<script type=\"text/javascript\" src=\"" + path + "MathJax.js\"></script>\n";
364  }
365 
366  // first substitute generic keywords
368  convertToHtml(Config_getString("PROJECT_NAME")),
369  convertToHtml(Config_getString("PROJECT_NUMBER")),
370  convertToHtml(Config_getString("PROJECT_BRIEF")));
371 
372  // additional HTML only keywords
373  result = substitute(result,"$navpath",navPath);
374  result = substitute(result,"$stylesheet",cssFile);
375  result = substitute(result,"$treeview",treeViewCssJs);
376  result = substitute(result,"$searchbox",searchBox);
377  result = substitute(result,"$search",searchCssJs);
378  result = substitute(result,"$mathjax",mathJaxJs);
379  result = substitute(result,"$generatedby",generatedBy);
380  result = substitute(result,"$extrastylesheet",extraCssText);
381  result = substitute(result,"$relpath$",relPath); //<-- obsolete: for backwards compatibility only
382  result = substitute(result,"$relpath^",relPath); //<-- must be last
383 
384  // additional HTML only conditional blocks
385  result = selectBlock(result,"DISABLE_INDEX",disableIndex);
386  result = selectBlock(result,"GENERATE_TREEVIEW",treeView);
387  result = selectBlock(result,"SEARCHENGINE",searchEngine);
388  result = selectBlock(result,"TITLEAREA",titleArea);
389  result = selectBlock(result,"PROJECT_NAME",hasProjectName);
390  result = selectBlock(result,"PROJECT_NUMBER",hasProjectNumber);
391  result = selectBlock(result,"PROJECT_BRIEF",hasProjectBrief);
392  result = selectBlock(result,"PROJECT_LOGO",hasProjectLogo);
393 
394  result = removeEmptyLines(result);
395 
396  return result;
397 }
QCString substituteKeywords(const QCString &s, const char *title, const char *projName, const char *projNum, const char *projBrief)
Definition: util.cpp:5122
static QCString result
bool isEmpty() const
Definition: qcstring.h:189
type * first()
Definition: qinternallist.h:87
const bool FALSE
Definition: qglobal.h:370
static QCString stripPath(const QCString &s)
Definition: tagreader.cpp:1287
#define Config_getList(val)
Definition: config.cpp:662
QCString left(uint len) const
Definition: qcstring.cpp:213
#define Config_getEnum(val)
Definition: config.cpp:663
static QCString removeEmptyLines(const QCString &s)
Definition: htmlgen.cpp:186
virtual QCString trGeneratedBy()=0
fileName
Definition: dumpTree.py:9
QCString convertToHtml(const char *s, bool keepEntities)
Definition: util.cpp:5746
QCString & prepend(const char *s)
Definition: qcstring.cpp:387
QCString dateToString(bool includeTime)
Definition: util.cpp:2473
#define Config_getString(val)
Definition: config.cpp:660
#define Config_getBool(val)
Definition: config.cpp:664
QCString selectBlock(const QCString &s, const QCString &name, bool enable)
Definition: htmlgen.cpp:146
type * next()
Definition: qinternallist.h:89
virtual QCString trGeneratedAt(const char *date, const char *projName)=0
static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch)
Definition: htmlgen.cpp:171
static QCString g_mathjax_code
Definition: htmlgen.cpp:52
Translator * theTranslator
Definition: language.cpp:157
type * at(uint i)
Definition: qinternallist.h:81
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
uint count() const
Definition: qinternallist.h:56
unsigned uint
Definition: qglobal.h:351
const bool TRUE
Definition: qglobal.h:371
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
static void writeClientSearchBox ( FTextStream t,
const char *  relPath 
)
static

Definition at line 55 of file htmlgen.cpp.

56 {
57  t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
58  t << " <span class=\"left\">\n";
59  t << " <img id=\"MSearchSelect\" src=\"" << relPath << "search/mag_sel.png\"\n";
60  t << " onmouseover=\"return searchBox.OnSearchSelectShow()\"\n";
61  t << " onmouseout=\"return searchBox.OnSearchSelectHide()\"\n";
62  t << " alt=\"\"/>\n";
63  t << " <input type=\"text\" id=\"MSearchField\" value=\""
64  << theTranslator->trSearch() << "\" accesskey=\"S\"\n";
65  t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
66  t << " onblur=\"searchBox.OnSearchFieldFocus(false)\" \n";
67  t << " onkeyup=\"searchBox.OnSearchFieldChange(event)\"/>\n";
68  t << " </span><span class=\"right\">\n";
69  t << " <a id=\"MSearchClose\" href=\"javascript:searchBox.CloseResultsWindow()\">"
70  << "<img id=\"MSearchCloseImg\" border=\"0\" src=\"" << relPath << "search/close.png\" alt=\"\"/></a>\n";
71  t << " </span>\n";
72  t << " </div>\n";
73 }
virtual QCString trSearch()=0
Translator * theTranslator
Definition: language.cpp:157
static void writeDefaultQuickLinks ( FTextStream t,
bool  compact,
HighlightedItem  hli,
const char *  file,
const QCString relPath 
)
static

Definition at line 2068 of file htmlgen.cpp.

2072 {
2075  LayoutNavEntry::Kind altKind = (LayoutNavEntry::Kind)-1; // fall back for the old layout file
2076  bool highlightParent=FALSE;
2077  switch (hli) // map HLI enums to LayoutNavEntry::Kind enums
2078  {
2079  case HLI_Main: kind = LayoutNavEntry::MainPage; break;
2080  case HLI_Modules: kind = LayoutNavEntry::Modules; break;
2081  //case HLI_Directories: kind = LayoutNavEntry::Dirs; break;
2083  case HLI_Hierarchy: kind = LayoutNavEntry::ClassHierarchy; break;
2084  case HLI_Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break;
2085  case HLI_Annotated: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break;
2086  case HLI_Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break;
2088  case HLI_Functions: kind = LayoutNavEntry::ClassMembers; break;
2089  case HLI_Globals: kind = LayoutNavEntry::FileGlobals; break;
2090  case HLI_Pages: kind = LayoutNavEntry::Pages; break;
2091  case HLI_Examples: kind = LayoutNavEntry::Examples; break;
2092  case HLI_UserGroup: kind = LayoutNavEntry::UserGroup; break;
2094  highlightParent = TRUE; break;
2096  highlightParent = TRUE; break;
2098  highlightParent = TRUE; break;
2099  case HLI_None: break;
2100  case HLI_Search: break;
2101  }
2102 
2103  if (compact)
2104  {
2105  // find highlighted index item
2106  LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : 0);
2107  if (!hlEntry && altKind!=(LayoutNavEntry::Kind)-1) { hlEntry=root->find(altKind); kind=altKind; }
2108  if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index...
2109  {
2110  highlightParent=TRUE;
2111  hlEntry = root->children().getFirst();
2112  if (hlEntry==0)
2113  {
2114  return; // argl, empty index!
2115  }
2116  }
2117  if (kind==LayoutNavEntry::UserGroup)
2118  {
2119  LayoutNavEntry *e = hlEntry->children().getFirst();
2120  if (e)
2121  {
2122  hlEntry = e;
2123  }
2124  }
2125  renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HLI_Search);
2126  }
2127  else
2128  {
2129  renderQuickLinksAsTree(t,relPath,root);
2130  }
2131 }
LayoutNavEntry * find(LayoutNavEntry::Kind k, const char *file=0) const
Definition: layout.cpp:76
const bool FALSE
Definition: qglobal.h:370
static LayoutDocManager & instance()
Definition: layout.cpp:1359
static void renderQuickLinksAsTree(FTextStream &t, const QCString &relPath, LayoutNavEntry *root)
Definition: htmlgen.cpp:1965
const QList< LayoutNavEntry > & children() const
Definition: layout.h:157
Base class for the layout of a navigation item at the top of the HTML pages.
Definition: layout.h:118
const double e
type * getFirst() const
Definition: qlist.h:95
LayoutNavEntry * rootNavEntry() const
Definition: layout.cpp:1370
static void renderQuickLinksAsTabs(FTextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
Definition: htmlgen.cpp:1996
const bool TRUE
Definition: qglobal.h:371
static void writeServerSearchBox ( FTextStream t,
const char *  relPath,
bool  highlightSearch 
)
static

Definition at line 75 of file htmlgen.cpp.

76 {
77  static bool externalSearch = Config_getBool("EXTERNAL_SEARCH");
78  t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
79  t << " <div class=\"left\">\n";
80  t << " <form id=\"FSearchBox\" action=\"" << relPath;
81  if (externalSearch)
82  {
83  t << "search" << Doxygen::htmlFileExtension;
84  }
85  else
86  {
87  t << "search.php";
88  }
89  t << "\" method=\"get\">\n";
90  t << " <img id=\"MSearchSelect\" src=\"" << relPath << "search/mag.png\" alt=\"\"/>\n";
91  if (!highlightSearch)
92  {
93  t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\""
94  << theTranslator->trSearch() << "\" size=\"20\" accesskey=\"S\" \n";
95  t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
96  t << " onblur=\"searchBox.OnSearchFieldFocus(false)\"/>\n";
97  t << " </form>\n";
98  t << " </div><div class=\"right\"></div>\n";
99  t << " </div>\n";
100  }
101 }
static QCString htmlFileExtension
Definition: doxygen.h:130
#define Config_getBool(val)
Definition: config.cpp:664
virtual QCString trSearch()=0
Translator * theTranslator
Definition: language.cpp:157

Variable Documentation

QCString g_footer
static

Definition at line 51 of file htmlgen.cpp.

QCString g_header
static

Definition at line 50 of file htmlgen.cpp.

QCString g_mathjax_code
static

Definition at line 52 of file htmlgen.cpp.