Doxygen
Loading...
Searching...
No Matches
htmlgen.cpp File Reference
#include <stdlib.h>
#include <assert.h>
#include <mutex>
#include "message.h"
#include "htmlgen.h"
#include "config.h"
#include "util.h"
#include "doxygen.h"
#include "diagram.h"
#include "version.h"
#include "dot.h"
#include "dotcallgraph.h"
#include "dotclassgraph.h"
#include "dotdirdeps.h"
#include "dotgfxhierarchytable.h"
#include "dotgroupcollaboration.h"
#include "dotincldepgraph.h"
#include "language.h"
#include "htmlhelp.h"
#include "docparser.h"
#include "docnode.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 "resourcemgr.h"
#include "tooltip.h"
#include "growbuf.h"
#include "fileinfo.h"
#include "dir.h"
#include "utf8.h"
#include "textstream.h"
#include "indexlist.h"
#include "datetime.h"
#include "portable.h"
#include "outputlist.h"
#include "stringutil.h"
Include dependency graph for htmlgen.cpp:

Go to the source code of this file.

Macros

#define DBG_HTML(x)

Functions

static void writeClientSearchBox (TextStream &t, const QCString &relPath)
static void writeServerSearchBox (TextStream &t, const QCString &relPath, bool highlightSearch)
static QCString getConvertLatexMacro ()
 Convert a set of LaTeX commands \(re)newcommand to a form readable by MathJax LaTeX syntax:
static QCString getSearchBox (bool serverSide, QCString relPath, bool highlightSearch)
static QCString substituteHtmlKeywords (const QCString &file, const QCString &str, const QCString &title, const QCString &relPath, const QCString &navPath=QCString())
static void fillColorStyleMap (const QCString &definitions, StringUnorderedMap &map)
static void fillColorStyleMaps ()
static QCString replaceVariables (const QCString &input)
static void writeDefaultStyleSheet (TextStream &t)
static void startSectionHeader (TextStream &t, const QCString &relPath, int sectionCount)
static void endSectionHeader (TextStream &t)
static void startSectionSummary (TextStream &t, int sectionCount)
static void endSectionSummary (TextStream &t)
static void startSectionContent (TextStream &t, int sectionCount)
static void endSectionContent (TextStream &t)
static void startQuickIndexList (TextStream &t, bool topLevel=TRUE)
static void endQuickIndexList (TextStream &t)
static void startQuickIndexItem (TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
static void endQuickIndexItem (TextStream &t, const QCString &l)
static bool quickLinkVisible (LayoutNavEntry::Kind kind)
static void renderQuickLinksAsTree (TextStream &t, const QCString &relPath, LayoutNavEntry *root)
static void renderQuickLinksAsTabs (TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
static void writeDefaultQuickLinks (TextStream &t, HighlightedItem hli, const QCString &file, const QCString &relPath, bool extraTabs)

Variables

static QCString g_header
static QCString g_header_file
static QCString g_footer_file
static QCString g_footer
static QCString g_mathjax_code
static QCString g_latex_macro
static constexpr auto hex ="0123456789ABCDEF"
static const SelectionMarkerInfo htmlMarkerInfo = { '<', "<!--BEGIN ",10,"<!--END ",8,"-->",3 }
static StringUnorderedMap g_lightMap
static StringUnorderedMap g_darkMap
static std::mutex g_indexLock

Macro Definition Documentation

◆ DBG_HTML

#define DBG_HTML ( x)

Definition at line 62 of file htmlgen.cpp.

Referenced by HtmlGenerator::endIndent(), HtmlGenerator::endInlineMemberDoc(), HtmlGenerator::endInlineMemberName(), HtmlGenerator::endInlineMemberType(), HtmlGenerator::endLabels(), HtmlGenerator::endMemberDescription(), HtmlGenerator::endMemberDoc(), HtmlGenerator::endMemberDocList(), HtmlGenerator::endMemberDocName(), HtmlGenerator::endMemberDocPrefixItem(), HtmlGenerator::endMemberDocSimple(), HtmlGenerator::endMemberHeader(), HtmlGenerator::endMemberList(), HtmlGenerator::endMemberSections(), HtmlGenerator::endMemberSubtitle(), HtmlGenerator::endParameterExtra(), HtmlGenerator::endParameterList(), HtmlGenerator::endParameterName(), HtmlGenerator::endParameterType(), HtmlGenerator::exceptionEntry(), HtmlGenerator::insertMemberAlign(), HtmlGenerator::startIndent(), HtmlGenerator::startInlineMemberDoc(), HtmlGenerator::startInlineMemberName(), HtmlGenerator::startInlineMemberType(), HtmlGenerator::startLabels(), HtmlGenerator::startMemberDescription(), HtmlGenerator::startMemberDoc(), HtmlGenerator::startMemberDocList(), HtmlGenerator::startMemberDocName(), HtmlGenerator::startMemberDocPrefixItem(), HtmlGenerator::startMemberDocSimple(), HtmlGenerator::startMemberHeader(), HtmlGenerator::startMemberItem(), HtmlGenerator::startMemberList(), HtmlGenerator::startMemberSections(), HtmlGenerator::startMemberSubtitle(), HtmlGenerator::startParameterExtra(), HtmlGenerator::startParameterList(), HtmlGenerator::startParameterName(), HtmlGenerator::startParameterType(), HtmlGenerator::writeInheritedSectionTitle(), and HtmlGenerator::writeLabel().

Function Documentation

◆ endQuickIndexItem()

void endQuickIndexItem ( TextStream & t,
const QCString & l )
static

Definition at line 2668 of file htmlgen.cpp.

2669{
2670 t << "</span>";
2671 if (!l.isEmpty()) t << "</a>";
2672 t << "</li>\n";
2673}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150

References QCString::isEmpty().

Referenced by renderQuickLinksAsTabs().

◆ endQuickIndexList()

void endQuickIndexList ( TextStream & t)
static

Definition at line 2641 of file htmlgen.cpp.

2642{
2643 if (!Config_getBool(DISABLE_INDEX))
2644 {
2645 t << " </ul>\n";
2646 t << " </div>\n";
2647 }
2648 else
2649 {
2650 t << "</ul>\n";
2651 }
2652}
#define Config_getBool(name)
Definition config.h:33

References Config_getBool.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ endSectionContent()

void endSectionContent ( TextStream & t)
static

Definition at line 1956 of file htmlgen.cpp.

1957{
1958 //t << "<!-- endSectionContent -->";
1959 t << "</div>\n";
1960}

Referenced by HtmlGenerator::endCallGraph(), HtmlGenerator::endClassDiagram(), HtmlGenerator::endDirDepGraph(), HtmlGenerator::endDotGraph(), HtmlGenerator::endGroupCollaboration(), and HtmlGenerator::endInclDepGraph().

◆ endSectionHeader()

void endSectionHeader ( TextStream & t)
static

◆ endSectionSummary()

void endSectionSummary ( TextStream & t)
static

Definition at line 1930 of file htmlgen.cpp.

1931{
1932 //t << "<!-- endSectionSummary -->";
1933 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1934 if (dynamicSections)
1935 {
1936 t << "</div>\n";
1937 }
1938}

References Config_getBool.

Referenced by HtmlGenerator::endCallGraph(), HtmlGenerator::endClassDiagram(), HtmlGenerator::endDirDepGraph(), HtmlGenerator::endDotGraph(), HtmlGenerator::endGroupCollaboration(), and HtmlGenerator::endInclDepGraph().

◆ fillColorStyleMap()

void fillColorStyleMap ( const QCString & definitions,
StringUnorderedMap & map )
static

Definition at line 632 of file htmlgen.cpp.

633{
634 int p=0,i=0;
635 while ((i=definitions.find('\n',p))!=-1)
636 {
637 QCString line = definitions.mid(p,i-p);
638 if (line.startsWith("--"))
639 {
640 int separator = line.find(':');
641 assert(separator!=-1);
642 std::string key = line.left(separator).str();
643 int semi = line.findRev(';');
644 assert(semi!=-1);
645 std::string value = line.mid(separator+1,semi-separator-1).stripWhiteSpace().str();
646 map.emplace(key,value);
647 //printf("var(%s)=%s\n",qPrint(key),qPrint(value));
648 }
649 p=i+1;
650 }
651}
This is an alternative implementation of QCString.
Definition qcstring.h:101
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
bool startsWith(const char *s) const
Definition qcstring.h:492
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
const std::string & str() const
Definition qcstring.h:537
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:91
QCString left(size_t len) const
Definition qcstring.h:214

References QCString::find(), QCString::findRev(), QCString::left(), QCString::mid(), QCString::startsWith(), QCString::str(), and QCString::stripWhiteSpace().

Referenced by fillColorStyleMaps().

◆ fillColorStyleMaps()

void fillColorStyleMaps ( )
static

Definition at line 653 of file htmlgen.cpp.

654{
656 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
657 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
658 {
659 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("lightmode_settings.css")),g_lightMap);
660 }
661 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
662 {
663 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("darkmode_settings.css")),g_darkMap);
664 }
665}
Singleton for managing resources compiled into an executable.
Definition resourcemgr.h:37
static ResourceMgr & instance()
Returns the one and only instance of this class.
QCString getAsString(const QCString &name) const
Gets the resource data as a C string.
#define Config_getEnum(name)
Definition config.h:35
static void fillColorStyleMap(const QCString &definitions, StringUnorderedMap &map)
Definition htmlgen.cpp:632
static StringUnorderedMap g_lightMap
Definition htmlgen.cpp:629
static StringUnorderedMap g_darkMap
Definition htmlgen.cpp:630
QCString replaceColorMarkers(const QCString &str)
Replaces any markers of the form ##AA in input string str by new markers of the form #AABBCC,...
Definition util.cpp:6285

References Config_getEnum, fillColorStyleMap(), g_darkMap, g_lightMap, ResourceMgr::getAsString(), ResourceMgr::instance(), and replaceColorMarkers().

Referenced by HtmlGenerator::init(), and HtmlGenerator::writeStyleSheetFile().

◆ getConvertLatexMacro()

QCString getConvertLatexMacro ( )
static

Convert a set of LaTeX commands \(re)newcommand to a form readable by MathJax LaTeX syntax:

\newcommand{\cmd}{replacement}
or
\renewcommand{\cmd}{replacement}

MathJax syntax:

cmd: "{replacement}"

LaTeX syntax:

\newcommand{\cmd}[nr]{replacement}
or
\renewcommand{\cmd}[nr]{replacement}

MathJax syntax:

cmd: ["{replacement}",nr]

Definition at line 149 of file htmlgen.cpp.

150{
151 QCString macrofile = Config_getString(FORMULA_MACROFILE);
152 if (macrofile.isEmpty()) return "";
153 QCString s = fileToString(macrofile);
154 macrofile = FileInfo(macrofile.str()).absFilePath();
155 size_t size = s.length();
156 GrowBuf out(size);
157 const char *data = s.data();
158 int line = 1;
159 int cnt = 0;
160 size_t i = 0;
161 QCString nr;
162 while (i < size)
163 {
164 nr = "";
165 // skip initial white space, but count lines
166 while (i < size && (data[i] == ' ' || data[i] == '\t' || data[i] == '\n'))
167 {
168 if (data[i] == '\n') line++;
169 i++;
170 }
171 if (i >= size) break;
172 // check for \newcommand or \renewcommand
173 if (data[i] != '\\')
174 {
175 warn(macrofile,line, "file contains non valid code, expected '\\' got '{:c}'",data[i]);
176 return "";
177 }
178 i++;
179 if (literal_at(data+i,"newcommand"))
180 {
181 i += strlen("newcommand");
182 }
183 else if (literal_at(data+i,"renewcommand"))
184 {
185 i += strlen("renewcommand");
186 }
187 else
188 {
189 warn(macrofile,line, "file contains non valid code, expected 'newcommand' or 'renewcommand'");
190 return "";
191 }
192 // handle {cmd}
193 if (data[i] != '{')
194 {
195 warn(macrofile,line, "file contains non valid code, expected '{{' got '{:c}'",data[i]);
196 return "";
197 }
198 i++;
199 if (data[i] != '\\')
200 {
201 warn(macrofile,line, "file contains non valid code, expected '\\' got '{:c}'",data[i]);
202 return "";
203 }
204 i++;
205 // run till }, i.e. cmd
206 out.addStr(" ");
207 while (i < size && (data[i] != '}')) out.addChar(data[i++]);
208 if (i >= size)
209 {
210 warn(macrofile,line, "file contains non valid code, no closing '}}' for command");
211 return "";
212 }
213 out.addChar(':');
214 out.addChar(' ');
215 i++;
216
217 if (data[i] == '[')
218 {
219 // handle [nr]
220 // run till ]
221 out.addChar('[');
222 i++;
223 while (i < size && (data[i] != ']')) nr += data[i++];
224 if (i >= size)
225 {
226 warn(macrofile,line, "file contains non valid code, no closing ']'");
227 return "";
228 }
229 i++;
230 }
231 else if (data[i] != '{')
232 {
233 warn(macrofile,line, "file contains non valid code, expected '[' or '{{' got '{:c}'",data[i]);
234 return "";
235 }
236 // handle {replacement}
237 // retest as the '[' part might have advanced so we can have a new '{'
238 if (data[i] != '{')
239 {
240 warn(macrofile,line, "file contains non valid code, expected '{{' got '{:c}'",data[i]);
241 return "";
242 }
243 out.addChar('"');
244 out.addChar('{');
245 i++;
246 // run till }
247 cnt = 1;
248 while (i < size && cnt)
249 {
250 switch(data[i])
251 {
252 case '\\':
253 out.addChar('\\'); // need to escape it for MathJax js code
254 out.addChar('\\');
255 i++;
256 if (data[i] == '\\') // we have an escaped backslash
257 {
258 out.addChar('\\');
259 out.addChar('\\');
260 i++;
261 }
262 else if (data[i] != '"') out.addChar(data[i++]); // double quote handled separately
263 break;
264 case '{':
265 cnt++;
266 out.addChar(data[i++]);
267 break;
268 case '}':
269 cnt--;
270 if (cnt) out.addChar(data[i]);
271 i++;
272 break;
273 case '"':
274 out.addChar('\\'); // need to escape it for MathJax js code
275 out.addChar(data[i++]);
276 break;
277 case '\n':
278 line++;
279 out.addChar(data[i++]);
280 break;
281 default:
282 out.addChar(data[i++]);
283 break;
284 }
285 }
286 if (i > size)
287 {
288 warn(macrofile,line, "file contains non valid code, no closing '}}' for replacement");
289 return "";
290 }
291 out.addChar('}');
292 out.addChar('"');
293 if (!nr.isEmpty())
294 {
295 out.addChar(',');
296 out.addStr(nr);
297 }
298 if (!nr.isEmpty())
299 {
300 out.addChar(']');
301 }
302 out.addChar(',');
303 out.addChar('\n');
304 }
305 out.addChar(0);
306 return out.get();
307}
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
std::string absFilePath() const
Definition fileinfo.cpp:101
Class representing a string buffer optimized for growing.
Definition growbuf.h:28
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
#define Config_getString(name)
Definition config.h:32
#define warn(file, line, fmt,...)
Definition message.h:97
bool literal_at(const char *data, const char(&str)[N])
returns TRUE iff data points to a substring that matches string literal str
Definition stringutil.h:98
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1441

References FileInfo::absFilePath(), GrowBuf::addChar(), GrowBuf::addStr(), Config_getString, QCString::data(), fileToString(), GrowBuf::get(), QCString::isEmpty(), QCString::length(), literal_at(), QCString::str(), and warn.

Referenced by HtmlGenerator::getMathJaxMacros(), and HtmlGenerator::init().

◆ getSearchBox()

QCString getSearchBox ( bool serverSide,
QCString relPath,
bool highlightSearch )
static

Definition at line 309 of file htmlgen.cpp.

310{
311 TextStream t;
312 if (serverSide)
313 {
314 writeServerSearchBox(t, relPath, highlightSearch);
315 }
316 else
317 {
318 writeClientSearchBox(t, relPath);
319 }
320 return t.str();
321}
Text streaming class that buffers data.
Definition textstream.h:36
std::string str() const
Return the contents of the buffer as a std::string object.
Definition textstream.h:229
static void writeServerSearchBox(TextStream &t, const QCString &relPath, bool highlightSearch)
Definition htmlgen.cpp:98
static void writeClientSearchBox(TextStream &t, const QCString &relPath)
Definition htmlgen.cpp:76

References TextStream::str(), writeClientSearchBox(), and writeServerSearchBox().

Referenced by substituteHtmlKeywords().

◆ quickLinkVisible()

bool quickLinkVisible ( LayoutNavEntry::Kind kind)
static

Definition at line 2675 of file htmlgen.cpp.

2676{
2677 const auto &index = Index::instance();
2678 bool showNamespaces = Config_getBool(SHOW_NAMESPACES);
2679 bool showFiles = Config_getBool(SHOW_FILES);
2680 switch (kind)
2681 {
2682 case LayoutNavEntry::MainPage: return TRUE;
2683 case LayoutNavEntry::User: return TRUE;
2684 case LayoutNavEntry::UserGroup: return TRUE;
2685 case LayoutNavEntry::Pages: return index.numIndexedPages()>0;
2686 case LayoutNavEntry::Topics: return index.numDocumentedGroups()>0;
2687 case LayoutNavEntry::Modules: return index.numDocumentedModules()>0;
2688 case LayoutNavEntry::ModuleList: return index.numDocumentedModules()>0;
2689 case LayoutNavEntry::ModuleMembers: return index.numDocumentedModuleMembers(ModuleMemberHighlight::All)>0;
2690 case LayoutNavEntry::Namespaces: return showNamespaces && index.numDocumentedNamespaces()>0;
2691 case LayoutNavEntry::NamespaceList: return showNamespaces && index.numDocumentedNamespaces()>0;
2692 case LayoutNavEntry::NamespaceMembers: return showNamespaces && index.numDocumentedNamespaceMembers(NamespaceMemberHighlight::All)>0;
2693 case LayoutNavEntry::Concepts: return index.numDocumentedConcepts()>0;
2694 case LayoutNavEntry::Classes: return index.numAnnotatedClasses()>0;
2695 case LayoutNavEntry::ClassList: return index.numAnnotatedClasses()>0;
2696 case LayoutNavEntry::ClassIndex: return index.numAnnotatedClasses()>0;
2697 case LayoutNavEntry::ClassHierarchy: return index.numHierarchyClasses()>0;
2698 case LayoutNavEntry::ClassMembers: return index.numDocumentedClassMembers(ClassMemberHighlight::All)>0;
2699 case LayoutNavEntry::Files: return showFiles && index.numDocumentedFiles()>0;
2700 case LayoutNavEntry::FileList: return showFiles && index.numDocumentedFiles()>0;
2701 case LayoutNavEntry::FileGlobals: return showFiles && index.numDocumentedFileMembers(FileMemberHighlight::All)>0;
2702 case LayoutNavEntry::Examples: return !Doxygen::exampleLinkedMap->empty();
2703 case LayoutNavEntry::Interfaces: return index.numAnnotatedInterfaces()>0;
2704 case LayoutNavEntry::InterfaceList: return index.numAnnotatedInterfaces()>0;
2705 case LayoutNavEntry::InterfaceIndex: return index.numAnnotatedInterfaces()>0;
2706 case LayoutNavEntry::InterfaceHierarchy: return index.numHierarchyInterfaces()>0;
2707 case LayoutNavEntry::Structs: return index.numAnnotatedStructs()>0;
2708 case LayoutNavEntry::StructList: return index.numAnnotatedStructs()>0;
2709 case LayoutNavEntry::StructIndex: return index.numAnnotatedStructs()>0;
2710 case LayoutNavEntry::Exceptions: return index.numAnnotatedExceptions()>0;
2711 case LayoutNavEntry::ExceptionList: return index.numAnnotatedExceptions()>0;
2712 case LayoutNavEntry::ExceptionIndex: return index.numAnnotatedExceptions()>0;
2713 case LayoutNavEntry::ExceptionHierarchy: return index.numHierarchyExceptions()>0;
2714 case LayoutNavEntry::None: // should never happen, means not properly initialized
2715 assert(kind != LayoutNavEntry::None);
2716 return FALSE;
2717 }
2718 return FALSE;
2719}
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:99
static Index & instance()
Definition index.cpp:106
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References ClassMemberHighlight::All, FileMemberHighlight::All, ModuleMemberHighlight::All, NamespaceMemberHighlight::All, Config_getBool, Doxygen::exampleLinkedMap, FALSE, Index::instance(), and TRUE.

Referenced by renderQuickLinksAsJs(), renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ renderQuickLinksAsTabs()

void renderQuickLinksAsTabs ( TextStream & t,
const QCString & relPath,
LayoutNavEntry * hlEntry,
LayoutNavEntry::Kind kind,
bool highlightParent,
bool highlightSearch )
static

Definition at line 2750 of file htmlgen.cpp.

2753{
2754 if (hlEntry->parent()) // first draw the tabs for the parent of hlEntry
2755 {
2756 renderQuickLinksAsTabs(t,relPath,hlEntry->parent(),kind,highlightParent,highlightSearch);
2757 }
2758 if (hlEntry->parent() && !hlEntry->parent()->children().empty()) // draw tabs for row containing hlEntry
2759 {
2760 bool topLevel = hlEntry->parent()->parent()==nullptr;
2761 int count=0;
2762 for (const auto &entry : hlEntry->parent()->children())
2763 {
2764 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2765 }
2766 if (count>0) // at least one item is visible
2767 {
2768 startQuickIndexList(t,topLevel);
2769 for (const auto &entry : hlEntry->parent()->children())
2770 {
2771 if (entry->visible() && quickLinkVisible(entry->kind()))
2772 {
2773 QCString url = entry->url();
2774 startQuickIndexItem(t,url,
2775 entry.get()==hlEntry &&
2776 (!entry->children().empty() ||
2777 (entry->kind()==kind && !highlightParent)
2778 ),
2779 TRUE,relPath);
2780 t << fixSpaces(entry->title());
2781 endQuickIndexItem(t,url);
2782 }
2783 }
2784 if (hlEntry->parent()==LayoutDocManager::instance().rootNavEntry()) // first row is special as it contains the search box
2785 {
2786 bool searchEngine = Config_getBool(SEARCHENGINE);
2787 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2788 bool disableIndex = Config_getBool(DISABLE_INDEX);
2789 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2790 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2791 // case where DISABLE_INDEX=NO & GENERATE_TREEVIEW=YES & FULL_SIDEBAR=YES has search box in the side panel
2792 if (searchEngine)
2793 {
2794 t << " <li>\n";
2795 if (disableIndex || !generateTreeView || !fullSidebar)
2796 {
2797 if (!serverBasedSearch) // pure client side search
2798 {
2799 writeClientSearchBox(t,relPath);
2800 t << " </li>\n";
2801 }
2802 else // server based search
2803 {
2804 writeServerSearchBox(t,relPath,highlightSearch);
2805 if (!highlightSearch)
2806 {
2807 t << " </li>\n";
2808 }
2809 }
2810 }
2811 else
2812 {
2813 t << " </li>\n";
2814 }
2815 }
2816 if (!highlightSearch || Config_getBool(FULL_SIDEBAR))
2817 // on the search page the index will be ended by the page itself if the search box is part of the navigation bar
2818 {
2820 }
2821 }
2822 else // normal case for other rows than first one
2823 {
2825 }
2826 }
2827 }
2828}
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1435
static void endQuickIndexList(TextStream &t)
Definition htmlgen.cpp:2641
static void startQuickIndexList(TextStream &t, bool topLevel=TRUE)
Definition htmlgen.cpp:2621
static void startQuickIndexItem(TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
Definition htmlgen.cpp:2654
static void renderQuickLinksAsTabs(TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
Definition htmlgen.cpp:2750
static void endQuickIndexItem(TextStream &t, const QCString &l)
Definition htmlgen.cpp:2668
static bool quickLinkVisible(LayoutNavEntry::Kind kind)
Definition htmlgen.cpp:2675
const LayoutNavEntryList & children() const
Definition layout.h:219
LayoutNavEntry * parent() const
Definition layout.h:212
QCString fixSpaces(const QCString &s)
Definition util.h:471

References LayoutNavEntry::children(), Config_getBool, endQuickIndexItem(), endQuickIndexList(), fixSpaces(), LayoutDocManager::instance(), LayoutNavEntry::parent(), quickLinkVisible(), renderQuickLinksAsTabs(), startQuickIndexItem(), startQuickIndexList(), TRUE, writeClientSearchBox(), and writeServerSearchBox().

Referenced by renderQuickLinksAsTabs(), and writeDefaultQuickLinks().

◆ renderQuickLinksAsTree()

void renderQuickLinksAsTree ( TextStream & t,
const QCString & relPath,
LayoutNavEntry * root )
static

Definition at line 2721 of file htmlgen.cpp.

2723{
2724 int count=0;
2725 for (const auto &entry : root->children())
2726 {
2727 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2728 }
2729 if (count>0) // at least one item is visible
2730 {
2732 for (const auto &entry : root->children())
2733 {
2734 if (entry->visible() && quickLinkVisible(entry->kind()))
2735 {
2736 QCString url = entry->url();
2737 t << "<li><a href=\"" << relPath << url << "\"><span>";
2738 t << fixSpaces(entry->title());
2739 t << "</span></a>\n";
2740 // recursive into child list
2741 renderQuickLinksAsTree(t,relPath,entry.get());
2742 t << "</li>";
2743 }
2744 }
2746 }
2747}
static void renderQuickLinksAsTree(TextStream &t, const QCString &relPath, LayoutNavEntry *root)
Definition htmlgen.cpp:2721

References LayoutNavEntry::children(), endQuickIndexList(), fixSpaces(), quickLinkVisible(), renderQuickLinksAsTree(), and startQuickIndexList().

Referenced by renderQuickLinksAsTree(), and writeDefaultQuickLinks().

◆ replaceVariables()

QCString replaceVariables ( const QCString & input)
static

Definition at line 667 of file htmlgen.cpp.

668{
669 auto doReplacements = [&input](const StringUnorderedMap &mapping) -> QCString
670 {
671 GrowBuf output;
672 int p=0,i=0;
673 while ((i=input.find("var(",p))!=-1)
674 {
675 output.addStr(input.data()+p,i-p);
676 int j=input.find(")",i+4);
677 assert(j!=-1);
678 auto it = mapping.find(input.mid(i+4,j-i-4).str()); // find variable
679 if (it==mapping.end())
680 { // should be found
681 err("failed to find value variable {}. It is not longer defined in doxygen.css\n",input.mid(i+4,j-i-4));
682 }
683 else
684 {
685 //printf("replace '%s' by '%s'\n",qPrint(input.mid(i+4,j-i-4)),qPrint(it->second));
686 output.addStr(it->second); // add it value
687 }
688 p=j+1;
689 }
690 output.addStr(input.data()+p,input.length()-p);
691 output.addChar(0);
692 return output.get();
693 };
694
695 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
696 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
697 {
698 return doReplacements(g_lightMap);
699 }
700 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
701 {
702 return doReplacements(g_darkMap);
703 }
704 else
705 {
706 return input;
707 }
708}
void addChar(char c)
Definition growbuf.h:69
void addStr(const QCString &s)
Definition growbuf.h:72
char * get()
Definition growbuf.h:114
std::unordered_map< std::string, std::string > StringUnorderedMap
Definition containers.h:28
#define err(fmt,...)
Definition message.h:127

References GrowBuf::addChar(), GrowBuf::addStr(), Config_getEnum, QCString::data(), err, QCString::find(), g_darkMap, g_lightMap, GrowBuf::get(), QCString::length(), QCString::mid(), and QCString::str().

Referenced by HtmlGenerator::getNavTreeCss(), HtmlGenerator::init(), writeDefaultStyleSheet(), and HtmlGenerator::writeSearchData().

◆ startQuickIndexItem()

void startQuickIndexItem ( TextStream & t,
const QCString & l,
bool hl,
bool ,
const QCString & relPath )
static

Definition at line 2654 of file htmlgen.cpp.

2657{
2658 t << " <li";
2659 if (hl)
2660 {
2661 t << " class=\"current\"";
2662 }
2663 t << ">";
2664 if (!l.isEmpty()) t << "<a href=\"" << correctURL(l,relPath) << "\">";
2665 t << "<span>";
2666}
QCString correctURL(const QCString &url, const QCString &relPath)
Corrects URL url according to the relative path relPath.
Definition util.cpp:6404

References correctURL(), and QCString::isEmpty().

Referenced by renderQuickLinksAsTabs().

◆ startQuickIndexList()

void startQuickIndexList ( TextStream & t,
bool topLevel = TRUE )
static

Definition at line 2621 of file htmlgen.cpp.

2622{
2623 if (!Config_getBool(DISABLE_INDEX))
2624 {
2625 if (topLevel)
2626 {
2627 t << " <div id=\"navrow1\" class=\"tabs\">\n";
2628 }
2629 else
2630 {
2631 t << " <div id=\"navrow2\" class=\"tabs2\">\n";
2632 }
2633 t << " <ul class=\"tablist\">\n";
2634 }
2635 else
2636 {
2637 t << "<ul>";
2638 }
2639}

References Config_getBool, and TRUE.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ startSectionContent()

void startSectionContent ( TextStream & t,
int sectionCount )
static

Definition at line 1940 of file htmlgen.cpp.

1941{
1942 //t << "<!-- startSectionContent -->";
1943 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1944 if (dynamicSections)
1945 {
1946 t << "<div id=\"dynsection-" << sectionCount << "-content\" "
1947 "class=\"dyncontent\" "
1948 "style=\"display:none;\">\n";
1949 }
1950 else
1951 {
1952 t << "<div class=\"dyncontent\">\n";
1953 }
1954}

References Config_getBool.

Referenced by HtmlGenerator::endCallGraph(), HtmlGenerator::endClassDiagram(), HtmlGenerator::endDirDepGraph(), HtmlGenerator::endDotGraph(), HtmlGenerator::endGroupCollaboration(), and HtmlGenerator::endInclDepGraph().

◆ startSectionHeader()

void startSectionHeader ( TextStream & t,
const QCString & relPath,
int sectionCount )
static

Definition at line 1893 of file htmlgen.cpp.

1895{
1896 //t << "<!-- startSectionHeader -->";
1897 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1898 if (dynamicSections)
1899 {
1900 t << "<div id=\"dynsection-" << sectionCount << "\" "
1901 "onclick=\"return dynsection.toggleVisibility(this)\" "
1902 "class=\"dynheader closed\" "
1903 "style=\"cursor:pointer;\">"
1904 "<span class=\"dynarrow\"><span class=\"arrowhead closed\"></span></span>";
1905 }
1906 else
1907 {
1908 t << "<div class=\"dynheader\">\n";
1909 }
1910}

References Config_getBool.

Referenced by HtmlGenerator::startCallGraph(), HtmlGenerator::startClassDiagram(), HtmlGenerator::startDirDepGraph(), HtmlGenerator::startDotGraph(), HtmlGenerator::startGroupCollaboration(), and HtmlGenerator::startInclDepGraph().

◆ startSectionSummary()

void startSectionSummary ( TextStream & t,
int sectionCount )
static

Definition at line 1918 of file htmlgen.cpp.

1919{
1920 //t << "<!-- startSectionSummary -->";
1921 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1922 if (dynamicSections)
1923 {
1924 t << "<div id=\"dynsection-" << sectionCount << "-summary\" "
1925 "class=\"dynsummary\" "
1926 "style=\"display:block;\">\n";
1927 }
1928}

References Config_getBool.

Referenced by HtmlGenerator::endCallGraph(), HtmlGenerator::endClassDiagram(), HtmlGenerator::endDirDepGraph(), HtmlGenerator::endDotGraph(), HtmlGenerator::endGroupCollaboration(), and HtmlGenerator::endInclDepGraph().

◆ substituteHtmlKeywords()

QCString substituteHtmlKeywords ( const QCString & file,
const QCString & str,
const QCString & title,
const QCString & relPath,
const QCString & navPath = QCString() )
static

Definition at line 323 of file htmlgen.cpp.

328{
329 // Build CSS/JavaScript tags depending on treeview, search engine settings
330 QCString cssFile;
331 QCString generatedBy;
332 QCString treeViewCssJs;
333 QCString searchCssJs;
334 QCString searchBox;
335 QCString mathJaxJs;
336 QCString extraCssText;
337
338 QCString projectName = Config_getString(PROJECT_NAME);
339 bool treeView = Config_getBool(GENERATE_TREEVIEW);
340 bool searchEngine = Config_getBool(SEARCHENGINE);
341 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
342 bool mathJax = Config_getBool(USE_MATHJAX);
343 QCString mathJaxFormat = Config_getEnumAsString(MATHJAX_FORMAT);
344 bool disableIndex = Config_getBool(DISABLE_INDEX);
345 bool hasProjectName = !projectName.isEmpty();
346 bool hasProjectNumber = !Config_getString(PROJECT_NUMBER).isEmpty();
347 bool hasProjectBrief = !Config_getString(PROJECT_BRIEF).isEmpty();
348 bool hasProjectLogo = !Config_getString(PROJECT_LOGO).isEmpty();
349 bool hasProjectIcon = !Config_getString(PROJECT_ICON).isEmpty();
350 bool hasFullSideBar = Config_getBool(FULL_SIDEBAR) && /*disableIndex &&*/ treeView;
351 bool hasCopyClipboard = Config_getBool(HTML_COPY_CLIPBOARD);
352 bool hasCookie = treeView || searchEngine || Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE;
353 static bool titleArea = (hasProjectName || hasProjectBrief || hasProjectLogo || (disableIndex && searchEngine));
354
355 cssFile = Config_getString(HTML_STYLESHEET);
356 if (cssFile.isEmpty())
357 {
358 cssFile = "doxygen.css";
359 }
360 else
361 {
362 if (!cssFile.startsWith("http:") && !cssFile.startsWith("https:"))
363 {
364 FileInfo cssfi(cssFile.str());
365 if (cssfi.exists())
366 {
367 cssFile = cssfi.fileName();
368 }
369 else
370 {
371 cssFile = "doxygen.css";
372 }
373 }
374 }
375
376 extraCssText = "";
377 const StringVector &extraCssFile = Config_getList(HTML_EXTRA_STYLESHEET);
378 for (const auto &fileName : extraCssFile)
379 {
380 if (!fileName.empty())
381 {
382 QCString htmlStyleSheet = fileName.c_str();
383 if (htmlStyleSheet.startsWith("http:") || htmlStyleSheet.startsWith("https:"))
384 {
385 extraCssText += "<link href=\""+htmlStyleSheet+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
386 }
387 else
388 {
389 FileInfo fi(fileName);
390 if (fi.exists())
391 {
392 extraCssText += "<link href=\"$relpath^"+stripPath(fileName.c_str())+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
393 }
394 }
395 }
396 }
397
398 switch (Config_getEnum(TIMESTAMP))
399 {
400 case TIMESTAMP_t::YES:
401 case TIMESTAMP_t::DATETIME:
402 generatedBy = theTranslator->trGeneratedAt(dateToString(DateTimeType::DateTime),
403 convertToHtml(Config_getString(PROJECT_NAME)));
404 break;
405 case TIMESTAMP_t::DATE:
406 generatedBy = theTranslator->trGeneratedAt(dateToString(DateTimeType::Date),
407 convertToHtml(Config_getString(PROJECT_NAME)));
408 break;
409 case TIMESTAMP_t::NO:
410 generatedBy = theTranslator->trGeneratedBy();
411 break;
412 }
413 if (treeView)
414 {
415 treeViewCssJs = "<link href=\"$relpath^navtree.css\" rel=\"stylesheet\" type=\"text/css\"/>\n"
416 "<script type=\"text/javascript\" src=\"$relpath^navtreedata.js\"></script>\n"
417 "<script type=\"text/javascript\" src=\"$relpath^navtree.js\"></script>\n";
418 }
419
420 if (searchEngine)
421 {
422 searchCssJs = "<link href=\"$relpath^search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
423 if (!serverBasedSearch)
424 {
425 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/searchdata.js\"></script>\n";
426 }
427 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n";
428
429 if (!serverBasedSearch)
430 {
431 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS) || Config_getBool(FULL_SIDEBAR))
432 {
433 searchCssJs += "<script type=\"text/javascript\">\n"
434 " $(function() { init_search(); });\n"
435 "</script>";
436 }
437 }
438 else
439 {
440 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
441 {
442 searchCssJs += "<script type=\"text/javascript\">\n"
443 " $(function() {\n"
444 " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
445 " });\n"
446 "</script>\n";
447 }
448
449 // OPENSEARCH_PROVIDER {
450 searchCssJs += "<link rel=\"search\" href=\"" + relPath +
451 "search_opensearch.php?v=opensearch.xml\" "
452 "type=\"application/opensearchdescription+xml\" title=\"" +
453 (hasProjectName ? projectName : QCString("Doxygen")) +
454 "\"/>";
455 // OPENSEARCH_PROVIDER }
456 }
457 searchBox = getSearchBox(serverBasedSearch, relPath, FALSE);
458 }
459
460 if (mathJax)
461 {
462 auto mathJaxVersion = Config_getEnum(MATHJAX_VERSION);
463 QCString path = Config_getString(MATHJAX_RELPATH);
464 if (path.isEmpty() || path.startsWith("..")) // relative path
465 {
466 path.prepend(relPath);
467 }
468
469 switch (mathJaxVersion)
470 {
471 case MATHJAX_VERSION_t::MathJax_3:
472 {
473 mathJaxJs += // "<script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n" // needed for IE11 only, see #10354
474 "<script type=\"text/javascript\">\n"
475 "window.MathJax = {\n"
476 " options: {\n"
477 " ignoreHtmlClass: 'tex2jax_ignore',\n"
478 " processHtmlClass: 'tex2jax_process'\n"
479 " }";
480 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
481 if (!mathJaxExtensions.empty() || !g_latex_macro.isEmpty())
482 {
483 mathJaxJs+= ",\n";
484 if (!mathJaxExtensions.empty())
485 {
486 bool first = true;
487 mathJaxJs+= " loader: {\n"
488 " load: [";
489 for (const auto &s : mathJaxExtensions)
490 {
491 if (!first) mathJaxJs+= ",";
492 mathJaxJs+= "'[tex]/"+QCString(s.c_str())+"'";
493 first = false;
494 }
495 mathJaxJs+= "]\n"
496 " },\n";
497 }
498 mathJaxJs+= " tex: {\n"
499 " macros: {";
500 if (!g_latex_macro.isEmpty())
501 {
502 mathJaxJs += g_latex_macro+" ";
503 }
504 mathJaxJs+="},\n"
505 " packages: ['base','configmacros'";
506 if (!g_latex_macro.isEmpty())
507 {
508 mathJaxJs+= ",'newcommand'";
509 }
510 for (const auto &s : mathJaxExtensions)
511 {
512 mathJaxJs+= ",'"+QCString(s.c_str())+"'";
513 }
514 mathJaxJs += "]\n"
515 " }\n";
516 }
517 else
518 {
519 mathJaxJs += "\n";
520 }
521 mathJaxJs += "};\n";
522 // MATHJAX_CODEFILE
523 if (!g_mathjax_code.isEmpty())
524 {
525 mathJaxJs += g_mathjax_code;
526 mathJaxJs += "\n";
527 }
528 mathJaxJs += "</script>\n";
529 mathJaxJs += "<script type=\"text/javascript\" id=\"MathJax-script\" async=\"async\" src=\"" +
530 path + "es5/tex-" + mathJaxFormat.lower() + ".js\">";
531 mathJaxJs+="</script>\n";
532 }
533 break;
534 case MATHJAX_VERSION_t::MathJax_2:
535 {
536 mathJaxJs = "<script type=\"text/x-mathjax-config\">\n"
537 "MathJax.Hub.Config({\n"
538 " extensions: [\"tex2jax.js\"";
539 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
540 for (const auto &s : mathJaxExtensions)
541 {
542 mathJaxJs+= ", \""+QCString(s.c_str())+".js\"";
543 }
544 if (mathJaxFormat.isEmpty())
545 {
546 mathJaxFormat = "HTML-CSS";
547 }
548 mathJaxJs += "],\n"
549 " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n";
550 if (!g_latex_macro.isEmpty())
551 {
552 mathJaxJs += " TeX: { Macros: {\n";
553 mathJaxJs += g_latex_macro;
554 mathJaxJs += "\n"
555 " } }\n";
556 }
557 mathJaxJs += "});\n";
558 if (!g_mathjax_code.isEmpty())
559 {
560 mathJaxJs += g_mathjax_code;
561 mathJaxJs += "\n";
562 }
563 mathJaxJs += "</script>\n";
564 mathJaxJs += "<script type=\"text/javascript\" async=\"async\" src=\"" + path + "MathJax.js\"></script>\n";
565 }
566 break;
567 }
568 }
569
570 QCString darkModeJs;
571 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
572 {
573 darkModeJs="<script type=\"text/javascript\" src=\"$relpath^darkmode_toggle.js\"></script>\n";
574 }
575
576 if (hasCookie) // extend the $treeview tag to avoid breaking old files used with HTML_HEADER
577 {
578 treeViewCssJs+="<script type=\"text/javascript\" src=\"$relpath^cookie.js\"></script>\n";
579 }
580
581 // first substitute generic keywords
582 QCString result = substituteKeywords(file,str,title,
583 convertToHtml(Config_getString(PROJECT_NAME)),
584 convertToHtml(Config_getString(PROJECT_NUMBER)),
585 convertToHtml(Config_getString(PROJECT_BRIEF)));
586
587 // then do the HTML specific keywords
588 result = substituteKeywords(file,result,
589 {
590 // keyword value getter
591 { "$navpath", [&]() { return navPath; } },
592 { "$stylesheet", [&]() { return cssFile; } },
593 { "$treeview", [&]() { return treeViewCssJs; } },
594 { "$searchbox", [&]() { return searchBox; } },
595 { "$search", [&]() { return searchCssJs; } },
596 { "$mathjax", [&]() { return mathJaxJs; } },
597 { "$darkmode", [&]() { return darkModeJs; } },
598 { "$generatedby", [&]() { return generatedBy; } },
599 { "$extrastylesheet",[&]() { return extraCssText; } },
600 { "$relpath$", [&]() { return relPath; } } //<-- obsolete: for backwards compatibility only
601 });
602
603 result = substitute(result,"$relpath^",relPath); //<-- must be done after the previous substitutions
604
605 // remove conditional blocks
606 result = selectBlocks(result,
607 {
608 // keyword, is enabled
609 { "FULL_SIDEBAR", hasFullSideBar },
610 { "DISABLE_INDEX", disableIndex },
611 { "GENERATE_TREEVIEW", treeView },
612 { "SEARCHENGINE", searchEngine },
613 { "TITLEAREA", titleArea },
614 { "PROJECT_NAME", hasProjectName },
615 { "PROJECT_NUMBER", hasProjectNumber },
616 { "PROJECT_BRIEF", hasProjectBrief },
617 { "PROJECT_LOGO", hasProjectLogo },
618 { "PROJECT_ICON", hasProjectIcon },
619 { "COPY_CLIPBOARD", hasCopyClipboard },
621
622 result = removeEmptyLines(result);
623
624 return result;
625}
QCString & prepend(const char *s)
Definition qcstring.h:407
QCString lower() const
Definition qcstring.h:234
#define Config_getList(name)
Definition config.h:38
#define Config_getEnumAsString(name)
Definition config.h:36
std::vector< std::string > StringVector
Definition containers.h:33
QCString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
Definition datetime.cpp:63
static QCString g_mathjax_code
Definition htmlgen.cpp:68
static const SelectionMarkerInfo htmlMarkerInfo
Definition htmlgen.cpp:72
static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch)
Definition htmlgen.cpp:309
static QCString g_latex_macro
Definition htmlgen.cpp:69
Translator * theTranslator
Definition language.cpp:71
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477
QCString convertToHtml(const QCString &s, bool keepEntities)
Definition util.cpp:4479
QCString stripPath(const QCString &s)
Definition util.cpp:5464
QCString removeEmptyLines(const QCString &s)
Definition util.cpp:7063
QCString selectBlocks(const QCString &s, const SelectionBlockList &blockList, const SelectionMarkerInfo &markerInfo)
remove disabled blocks and all block markers from s and return the result as a string
Definition util.cpp:6886
QCString substituteKeywords(const QCString &file, const QCString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:3571

References Config_getBool, Config_getEnum, Config_getEnumAsString, Config_getList, Config_getString, convertToHtml(), Date, DateTime, dateToString(), FileInfo::exists(), FALSE, FileInfo::fileName(), g_latex_macro, g_mathjax_code, getSearchBox(), htmlMarkerInfo, QCString::isEmpty(), QCString::lower(), QCString::prepend(), removeEmptyLines(), selectBlocks(), QCString::startsWith(), QCString::str(), stripPath(), substitute(), substituteKeywords(), and theTranslator.

Referenced by HtmlGenerator::init(), HtmlGenerator::startFile(), HtmlGenerator::writeExternalSearchPage(), HtmlGenerator::writePageFooter(), and HtmlGenerator::writeSearchPage().

◆ writeClientSearchBox()

void writeClientSearchBox ( TextStream & t,
const QCString & relPath )
static

Definition at line 76 of file htmlgen.cpp.

77{
78 t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
79 t << " <span class=\"left\">\n";
80 t << " <span id=\"MSearchSelect\" class=\"search-icon\" ";
81 t << "onmouseover=\"return searchBox.OnSearchSelectShow()\" ";
82 t << "onmouseout=\"return searchBox.OnSearchSelectHide()\">";
83 t << "<span class=\"search-icon-dropdown\"></span></span>\n";
84 t << " <input type=\"text\" id=\"MSearchField\" value=\"\" placeholder=\""
85 << theTranslator->trSearch() << "\" accesskey=\"S\"\n";
86 t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
87 t << " onblur=\"searchBox.OnSearchFieldFocus(false)\" \n";
88 t << " onkeyup=\"searchBox.OnSearchFieldChange(event)\"/>\n";
89 t << " </span><span class=\"right\">\n";
90 t << " <a id=\"MSearchClose\" href=\"javascript:searchBox.CloseResultsWindow()\">"
91 << "<div id=\"MSearchCloseImg\" class=\"close-icon\"></div></a>\n";
92 t << " </span>\n";
93 t << " </div>\n";
94}

References theTranslator.

Referenced by getSearchBox(), and renderQuickLinksAsTabs().

◆ writeDefaultQuickLinks()

void writeDefaultQuickLinks ( TextStream & t,
HighlightedItem hli,
const QCString & file,
const QCString & relPath,
bool extraTabs )
static

Definition at line 2830 of file htmlgen.cpp.

2835{
2836 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2837 bool searchEngine = Config_getBool(SEARCHENGINE);
2838 bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
2839 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2840 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2841 bool disableIndex = Config_getBool(DISABLE_INDEX);
2842 bool dynamicMenus = Config_getBool(HTML_DYNAMIC_MENUS);
2844 LayoutNavEntry::Kind kind = LayoutNavEntry::None;
2845 LayoutNavEntry::Kind altKind = LayoutNavEntry::None; // fall back for the old layout file
2846 bool highlightParent=false;
2847 switch (hli) // map HLI enums to LayoutNavEntry::Kind enums
2848 {
2849 case HighlightedItem::Main: kind = LayoutNavEntry::MainPage; break;
2850 case HighlightedItem::Topics: kind = LayoutNavEntry::Topics; break;
2851 case HighlightedItem::Modules: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules; break;
2852 case HighlightedItem::Namespaces: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; break;
2853 case HighlightedItem::ClassHierarchy: kind = LayoutNavEntry::ClassHierarchy; break;
2854 case HighlightedItem::InterfaceHierarchy: kind = LayoutNavEntry::InterfaceHierarchy; break;
2855 case HighlightedItem::ExceptionHierarchy: kind = LayoutNavEntry::ExceptionHierarchy; break;
2856 case HighlightedItem::Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break;
2857 case HighlightedItem::Concepts: kind = LayoutNavEntry::Concepts; break;
2858 case HighlightedItem::Interfaces: kind = LayoutNavEntry::InterfaceIndex; altKind = LayoutNavEntry::Interfaces; break;
2859 case HighlightedItem::Structs: kind = LayoutNavEntry::StructIndex; altKind = LayoutNavEntry::Structs; break;
2860 case HighlightedItem::Exceptions: kind = LayoutNavEntry::ExceptionIndex; altKind = LayoutNavEntry::Exceptions; break;
2861 case HighlightedItem::AnnotatedClasses: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break;
2862 case HighlightedItem::AnnotatedInterfaces: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces; break;
2863 case HighlightedItem::AnnotatedStructs: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs; break;
2864 case HighlightedItem::AnnotatedExceptions: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions; break;
2865 case HighlightedItem::Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break;
2866 case HighlightedItem::NamespaceMembers: kind = LayoutNavEntry::NamespaceMembers; break;
2867 case HighlightedItem::ModuleMembers: kind = LayoutNavEntry::ModuleMembers; break;
2868 case HighlightedItem::Functions: kind = LayoutNavEntry::ClassMembers; break;
2869 case HighlightedItem::Globals: kind = LayoutNavEntry::FileGlobals; break;
2870 case HighlightedItem::Pages: kind = LayoutNavEntry::Pages; break;
2871 case HighlightedItem::Examples: kind = LayoutNavEntry::Examples; break;
2872 case HighlightedItem::UserGroup: kind = LayoutNavEntry::UserGroup; break;
2873 case HighlightedItem::ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes;
2874 highlightParent = true; break;
2875 case HighlightedItem::ConceptVisible: kind = LayoutNavEntry::Concepts;
2876 highlightParent = true; break;
2877 case HighlightedItem::ModuleVisible: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules;
2878 highlightParent = true; break;
2879 case HighlightedItem::InterfaceVisible: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces;
2880 highlightParent = true; break;
2881 case HighlightedItem::StructVisible: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs;
2882 highlightParent = true; break;
2883 case HighlightedItem::ExceptionVisible: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions;
2884 highlightParent = true; break;
2885 case HighlightedItem::NamespaceVisible: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces;
2886 highlightParent = true; break;
2887 case HighlightedItem::FileVisible: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files;
2888 highlightParent = true; break;
2889 case HighlightedItem::None: break;
2890 case HighlightedItem::Search: break;
2891 }
2892
2893 if (!disableIndex && dynamicMenus)
2894 {
2895 QCString searchPage;
2896 if (externalSearch)
2897 {
2898 searchPage = "search" + Doxygen::htmlFileExtension;
2899 }
2900 else
2901 {
2902 searchPage = "search.php";
2903 }
2904 t << "<script type=\"text/javascript\" src=\"" << relPath << "menudata.js\"></script>\n";
2905 t << "<script type=\"text/javascript\" src=\"" << relPath << "menu.js\"></script>\n";
2906 t << "<script type=\"text/javascript\">\n";
2907 t << "$(function() {\n";
2908 t << " initMenu('" << relPath << "',"
2909 << (searchEngine && !(generateTreeView && fullSidebar)?"true":"false") << ","
2910 << (serverBasedSearch?"true":"false") << ",'"
2911 << searchPage << "','"
2912 << theTranslator->trSearch() << "',"
2913 << (generateTreeView?"true":"false")
2914 << ");\n";
2915 if (searchEngine)
2916 {
2917 if (!serverBasedSearch)
2918 {
2919 if (!disableIndex && dynamicMenus && !fullSidebar)
2920 {
2921 t << " $(function() { init_search(); });\n";
2922 }
2923 }
2924 else
2925 {
2926 t << " $(function() {\n"
2927 << " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n";
2928 t << " });\n";
2929 }
2930 }
2931 t << "});\n";
2932 t << "</script>\n";
2933 t << "<div id=\"main-nav\"></div>\n";
2934 }
2935 else if (!disableIndex) // && !Config_getBool(HTML_DYNAMIC_MENUS)
2936 {
2937 // find highlighted index item
2938 LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : QCString());
2939 if (!hlEntry && altKind!=LayoutNavEntry::None) { hlEntry=root->find(altKind); kind=altKind; }
2940 if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index...
2941 {
2942 highlightParent=TRUE;
2943 hlEntry = root->children().front().get();
2944 if (hlEntry==nullptr)
2945 {
2946 return; // argl, empty index!
2947 }
2948 }
2949 if (kind==LayoutNavEntry::UserGroup)
2950 {
2951 LayoutNavEntry *e = hlEntry->children().front().get();
2952 if (e)
2953 {
2954 hlEntry = e;
2955 }
2956 }
2957 t << "<div id=\"main-nav\">\n";
2958 renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HighlightedItem::Search);
2959 if (!extraTabs)
2960 {
2961 t << "</div><!-- main-nav -->\n";
2962 }
2963 }
2964 else if (!generateTreeView)
2965 {
2966 renderQuickLinksAsTree(t,relPath,root);
2967 }
2968 if (generateTreeView && !disableIndex && fullSidebar && !extraTabs)
2969 {
2970 t << "<div id=\"container\"><div id=\"doc-content\">\n";
2971 }
2972}
static QCString htmlFileExtension
Definition doxygen.h:122
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition layout.cpp:1446
@ AnnotatedExceptions
Definition index.h:76
@ InterfaceVisible
Definition index.h:89
@ InterfaceHierarchy
Definition index.h:66
@ AnnotatedInterfaces
Definition index.h:74
@ NamespaceMembers
Definition index.h:78
@ AnnotatedClasses
Definition index.h:73
@ AnnotatedStructs
Definition index.h:75
@ ExceptionVisible
Definition index.h:91
@ NamespaceVisible
Definition index.h:92
@ ExceptionHierarchy
Definition index.h:67
Base class for the layout of a navigation item at the top of the HTML pages.
Definition layout.h:156
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
Definition layout.cpp:133
Kind
Definition layout.h:193

References AnnotatedClasses, AnnotatedExceptions, AnnotatedInterfaces, AnnotatedStructs, LayoutNavEntry::children(), Classes, ClassHierarchy, ClassVisible, Concepts, ConceptVisible, Config_getBool, Examples, ExceptionHierarchy, Exceptions, ExceptionVisible, Files, FileVisible, LayoutNavEntry::find(), Functions, Globals, Doxygen::htmlFileExtension, LayoutDocManager::instance(), InterfaceHierarchy, Interfaces, InterfaceVisible, Main, ModuleMembers, Modules, ModuleVisible, NamespaceMembers, Namespaces, NamespaceVisible, None, Pages, renderQuickLinksAsTabs(), renderQuickLinksAsTree(), LayoutDocManager::rootNavEntry(), Search, Structs, StructVisible, theTranslator, Topics, TRUE, and UserGroup.

Referenced by HtmlGenerator::writeExternalSearchPage(), HtmlGenerator::writeQuickLinks(), and HtmlGenerator::writeSearchPage().

◆ writeDefaultStyleSheet()

void writeDefaultStyleSheet ( TextStream & t)
static

Definition at line 1342 of file htmlgen.cpp.

1343{
1344 t << "/* The standard CSS for doxygen " << getDoxygenVersion() << "*/\n\n";
1345 switch (Config_getEnum(HTML_COLORSTYLE))
1346 {
1347 case HTML_COLORSTYLE_t::LIGHT:
1348 case HTML_COLORSTYLE_t::DARK:
1349 /* variables will be resolved while writing to the CSS file */
1350 break;
1351 case HTML_COLORSTYLE_t::AUTO_LIGHT:
1352 case HTML_COLORSTYLE_t::TOGGLE:
1353 t << "html {\n";
1354 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1355 t << "}\n\n";
1356 break;
1357 case HTML_COLORSTYLE_t::AUTO_DARK:
1358 t << "html {\n";
1359 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1360 t << "}\n\n";
1361 break;
1362 }
1363 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_LIGHT)
1364 {
1365 t << "@media (prefers-color-scheme: dark) {\n";
1366 t << " html:not(.dark-mode) {\n";
1367 t << " color-scheme: dark;\n\n";
1368 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1369 t << "}}\n";
1370 }
1371 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_DARK)
1372 {
1373 t << "@media (prefers-color-scheme: light) {\n";
1374 t << " html:not(.light-mode) {\n";
1375 t << " color-scheme: light;\n\n";
1376 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1377 t << "}}\n";
1378 }
1379 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
1380 {
1381 t << "html.dark-mode {\n";
1382 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1383 t << "}\n\n";
1384 }
1385
1386 QCString cssStr = ResourceMgr::instance().getAsString("doxygen.css");
1387 bool hasFullSidebar = Config_getBool(FULL_SIDEBAR) && Config_getBool(GENERATE_TREEVIEW);
1388 if (hasFullSidebar)
1389 {
1390 cssStr+="\n"
1391 "#titlearea {\n"
1392 " border-bottom: none;\n"
1393 " background-color: var(--nav-background-color);\n"
1394 " border-right: 1px solid var(--nav-border-color);\n"
1395 "}\n";
1396 }
1397 t << replaceVariables(cssStr);
1398
1399 // For Webkit based the scrollbar styling cannot be overruled (bug in chromium?).
1400 // To allow the user to style the scrollbars differently we should only add it in case
1401 // the user did not specify any extra stylesheets.
1402 bool addScrollbarStyling = Config_getList(HTML_EXTRA_STYLESHEET).empty();
1403 if (addScrollbarStyling)
1404 {
1405 t << replaceVariables(ResourceMgr::instance().getAsString("scrollbar.css"));
1406 }
1407
1408}
static QCString replaceVariables(const QCString &input)
Definition htmlgen.cpp:667

References Config_getBool, Config_getEnum, Config_getList, ResourceMgr::getAsString(), ResourceMgr::instance(), replaceColorMarkers(), and replaceVariables().

Referenced by HtmlGenerator::writeStyleInfo(), LatexGenerator::writeStyleInfo(), HtmlGenerator::writeStyleSheetFile(), and LatexGenerator::writeStyleSheetFile().

◆ writeServerSearchBox()

void writeServerSearchBox ( TextStream & t,
const QCString & relPath,
bool highlightSearch )
static

Definition at line 98 of file htmlgen.cpp.

99{
100 bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
101 t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
102 t << " <div class=\"left\">\n";
103 t << " <form id=\"FSearchBox\" action=\"" << relPath;
104 if (externalSearch)
105 {
106 t << "search" << Doxygen::htmlFileExtension;
107 }
108 else
109 {
110 t << "search.php";
111 }
112 t << "\" method=\"get\">\n";
113 t << " <span id=\"MSearchSelectExt\" class=\"search-icon\"></span>\n";
114 if (!highlightSearch || !Config_getBool(HTML_DYNAMIC_MENUS))
115 {
116 t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\"\" placeholder=\""
117 << theTranslator->trSearch() << "\" size=\"20\" accesskey=\"S\" \n";
118 t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
119 t << " onblur=\"searchBox.OnSearchFieldFocus(false)\"/>\n";
120 t << " </form>\n";
121 t << " </div><div class=\"right\"></div>\n";
122 t << " </div>\n";
123 }
124}

References Config_getBool, Doxygen::htmlFileExtension, and theTranslator.

Referenced by getSearchBox(), and renderQuickLinksAsTabs().

Variable Documentation

◆ g_darkMap

StringUnorderedMap g_darkMap
static

Definition at line 630 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_footer

◆ g_footer_file

◆ g_header

◆ g_header_file

◆ g_indexLock

std::mutex g_indexLock
static

Definition at line 1428 of file htmlgen.cpp.

Referenced by HtmlGenerator::startFile().

◆ g_latex_macro

QCString g_latex_macro
static

Definition at line 69 of file htmlgen.cpp.

Referenced by HtmlGenerator::init(), and substituteHtmlKeywords().

◆ g_lightMap

StringUnorderedMap g_lightMap
static

Definition at line 629 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_mathjax_code

QCString g_mathjax_code
static

Definition at line 68 of file htmlgen.cpp.

Referenced by HtmlGenerator::init(), and substituteHtmlKeywords().

◆ hex

auto hex ="0123456789ABCDEF"
staticconstexpr

Definition at line 70 of file htmlgen.cpp.

◆ htmlMarkerInfo

const SelectionMarkerInfo htmlMarkerInfo = { '<', "<!--BEGIN ",10,"<!--END ",8,"-->",3 }
static

Definition at line 72 of file htmlgen.cpp.

72{ '<', "<!--BEGIN ",10,"<!--END ",8,"-->",3 };

Referenced by HtmlGenerator::init(), and substituteHtmlKeywords().