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 2681 of file htmlgen.cpp.

2682{
2683 t << "</span>";
2684 if (!l.isEmpty()) t << "</a>";
2685 t << "</li>\n";
2686}
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 2654 of file htmlgen.cpp.

2655{
2656 if (!Config_getBool(DISABLE_INDEX))
2657 {
2658 t << " </ul>\n";
2659 t << " </div>\n";
2660 }
2661 else
2662 {
2663 t << "</ul>\n";
2664 }
2665}
#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 1974 of file htmlgen.cpp.

1975{
1976 //t << "<!-- endSectionContent -->";
1977 t << "</div>\n";
1978}

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 1948 of file htmlgen.cpp.

1949{
1950 //t << "<!-- endSectionSummary -->";
1951 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1952 if (dynamicSections)
1953 {
1954 t << "</div>\n";
1955 }
1956}

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 637 of file htmlgen.cpp.

638{
639 int p=0,i=0;
640 while ((i=definitions.find('\n',p))!=-1)
641 {
642 QCString line = definitions.mid(p,i-p);
643 if (line.startsWith("--"))
644 {
645 int separator = line.find(':');
646 assert(separator!=-1);
647 std::string key = line.left(separator).str();
648 int semi = line.findRev(';');
649 assert(semi!=-1);
650 std::string value = line.mid(separator+1,semi-separator-1).stripWhiteSpace().str();
651 map.emplace(key,value);
652 //printf("var(%s)=%s\n",qPrint(key),qPrint(value));
653 }
654 p=i+1;
655 }
656}
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 658 of file htmlgen.cpp.

659{
661 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
662 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
663 {
664 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("lightmode_settings.css")),g_lightMap);
665 }
666 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
667 {
668 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("darkmode_settings.css")),g_darkMap);
669 }
670}
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:637
static StringUnorderedMap g_lightMap
Definition htmlgen.cpp:634
static StringUnorderedMap g_darkMap
Definition htmlgen.cpp:635
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:6278

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 2688 of file htmlgen.cpp.

2689{
2690 const auto &index = Index::instance();
2691 bool showNamespaces = Config_getBool(SHOW_NAMESPACES);
2692 bool showFiles = Config_getBool(SHOW_FILES);
2693 switch (kind)
2694 {
2695 case LayoutNavEntry::MainPage: return TRUE;
2696 case LayoutNavEntry::User: return TRUE;
2697 case LayoutNavEntry::UserGroup: return TRUE;
2698 case LayoutNavEntry::Pages: return index.numIndexedPages()>0;
2699 case LayoutNavEntry::Topics: return index.numDocumentedGroups()>0;
2700 case LayoutNavEntry::Modules: return index.numDocumentedModules()>0;
2701 case LayoutNavEntry::ModuleList: return index.numDocumentedModules()>0;
2702 case LayoutNavEntry::ModuleMembers: return index.numDocumentedModuleMembers(ModuleMemberHighlight::All)>0;
2703 case LayoutNavEntry::Namespaces: return showNamespaces && index.numDocumentedNamespaces()>0;
2704 case LayoutNavEntry::NamespaceList: return showNamespaces && index.numDocumentedNamespaces()>0;
2705 case LayoutNavEntry::NamespaceMembers: return showNamespaces && index.numDocumentedNamespaceMembers(NamespaceMemberHighlight::All)>0;
2706 case LayoutNavEntry::Concepts: return index.numDocumentedConcepts()>0;
2707 case LayoutNavEntry::Classes: return index.numAnnotatedClasses()>0;
2708 case LayoutNavEntry::ClassList: return index.numAnnotatedClasses()>0;
2709 case LayoutNavEntry::ClassIndex: return index.numAnnotatedClasses()>0;
2710 case LayoutNavEntry::ClassHierarchy: return index.numHierarchyClasses()>0;
2711 case LayoutNavEntry::ClassMembers: return index.numDocumentedClassMembers(ClassMemberHighlight::All)>0;
2712 case LayoutNavEntry::Files: return showFiles && index.numDocumentedFiles()>0;
2713 case LayoutNavEntry::FileList: return showFiles && index.numDocumentedFiles()>0;
2714 case LayoutNavEntry::FileGlobals: return showFiles && index.numDocumentedFileMembers(FileMemberHighlight::All)>0;
2715 case LayoutNavEntry::Examples: return !Doxygen::exampleLinkedMap->empty();
2716 case LayoutNavEntry::Interfaces: return index.numAnnotatedInterfaces()>0;
2717 case LayoutNavEntry::InterfaceList: return index.numAnnotatedInterfaces()>0;
2718 case LayoutNavEntry::InterfaceIndex: return index.numAnnotatedInterfaces()>0;
2719 case LayoutNavEntry::InterfaceHierarchy: return index.numHierarchyInterfaces()>0;
2720 case LayoutNavEntry::Structs: return index.numAnnotatedStructs()>0;
2721 case LayoutNavEntry::StructList: return index.numAnnotatedStructs()>0;
2722 case LayoutNavEntry::StructIndex: return index.numAnnotatedStructs()>0;
2723 case LayoutNavEntry::Exceptions: return index.numAnnotatedExceptions()>0;
2724 case LayoutNavEntry::ExceptionList: return index.numAnnotatedExceptions()>0;
2725 case LayoutNavEntry::ExceptionIndex: return index.numAnnotatedExceptions()>0;
2726 case LayoutNavEntry::ExceptionHierarchy: return index.numHierarchyExceptions()>0;
2727 case LayoutNavEntry::None: // should never happen, means not properly initialized
2728 assert(kind != LayoutNavEntry::None);
2729 return FALSE;
2730 }
2731 return FALSE;
2732}
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 2763 of file htmlgen.cpp.

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

2736{
2737 int count=0;
2738 for (const auto &entry : root->children())
2739 {
2740 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2741 }
2742 if (count>0) // at least one item is visible
2743 {
2745 for (const auto &entry : root->children())
2746 {
2747 if (entry->visible() && quickLinkVisible(entry->kind()))
2748 {
2749 QCString url = entry->url();
2750 t << "<li><a href=\"" << relPath << url << "\"><span>";
2751 t << fixSpaces(entry->title());
2752 t << "</span></a>\n";
2753 // recursive into child list
2754 renderQuickLinksAsTree(t,relPath,entry.get());
2755 t << "</li>";
2756 }
2757 }
2759 }
2760}
static void renderQuickLinksAsTree(TextStream &t, const QCString &relPath, LayoutNavEntry *root)
Definition htmlgen.cpp:2734

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

Referenced by renderQuickLinksAsTree(), and writeDefaultQuickLinks().

◆ replaceVariables()

QCString replaceVariables ( const QCString & input)
static

Definition at line 672 of file htmlgen.cpp.

673{
674 auto doReplacements = [&input](const StringUnorderedMap &mapping) -> QCString
675 {
676 GrowBuf output;
677 int p=0,i=0;
678 while ((i=input.find("var(",p))!=-1)
679 {
680 output.addStr(input.data()+p,i-p);
681 int j=input.find(")",i+4);
682 assert(j!=-1);
683 auto it = mapping.find(input.mid(i+4,j-i-4).str()); // find variable
684 if (it==mapping.end())
685 { // should be found
686 err("failed to find value variable {}. It is not longer defined in doxygen.css\n",input.mid(i+4,j-i-4));
687 }
688 else
689 {
690 //printf("replace '%s' by '%s'\n",qPrint(input.mid(i+4,j-i-4)),qPrint(it->second));
691 output.addStr(it->second); // add it value
692 }
693 p=j+1;
694 }
695 output.addStr(input.data()+p,input.length()-p);
696 output.addChar(0);
697 return output.get();
698 };
699
700 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
701 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
702 {
703 return doReplacements(g_lightMap);
704 }
705 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
706 {
707 return doReplacements(g_darkMap);
708 }
709 else
710 {
711 return input;
712 }
713}
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 2667 of file htmlgen.cpp.

2670{
2671 t << " <li";
2672 if (hl)
2673 {
2674 t << " class=\"current\"";
2675 }
2676 t << ">";
2677 if (!l.isEmpty()) t << "<a href=\"" << correctURL(l,relPath) << "\">";
2678 t << "<span>";
2679}
QCString correctURL(const QCString &url, const QCString &relPath)
Corrects URL url according to the relative path relPath.
Definition util.cpp:6397

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

Referenced by renderQuickLinksAsTabs().

◆ startQuickIndexList()

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

Definition at line 2634 of file htmlgen.cpp.

2635{
2636 if (!Config_getBool(DISABLE_INDEX))
2637 {
2638 if (topLevel)
2639 {
2640 t << " <div id=\"navrow1\" class=\"tabs\">\n";
2641 }
2642 else
2643 {
2644 t << " <div id=\"navrow2\" class=\"tabs2\">\n";
2645 }
2646 t << " <ul class=\"tablist\">\n";
2647 }
2648 else
2649 {
2650 t << "<ul>";
2651 }
2652}

References Config_getBool, and TRUE.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ startSectionContent()

void startSectionContent ( TextStream & t,
int sectionCount )
static

Definition at line 1958 of file htmlgen.cpp.

1959{
1960 //t << "<!-- startSectionContent -->";
1961 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1962 if (dynamicSections)
1963 {
1964 t << "<div id=\"dynsection-" << sectionCount << "-content\" "
1965 "class=\"dyncontent\" "
1966 "style=\"display:none;\">\n";
1967 }
1968 else
1969 {
1970 t << "<div class=\"dyncontent\">\n";
1971 }
1972}

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 1911 of file htmlgen.cpp.

1913{
1914 //t << "<!-- startSectionHeader -->";
1915 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1916 if (dynamicSections)
1917 {
1918 t << "<div id=\"dynsection-" << sectionCount << "\" "
1919 "onclick=\"return dynsection.toggleVisibility(this)\" "
1920 "class=\"dynheader closed\" "
1921 "style=\"cursor:pointer;\">"
1922 "<span class=\"dynarrow\"><span class=\"arrowhead closed\"></span></span>";
1923 }
1924 else
1925 {
1926 t << "<div class=\"dynheader\">\n";
1927 }
1928}

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 1936 of file htmlgen.cpp.

1937{
1938 //t << "<!-- startSectionSummary -->";
1939 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1940 if (dynamicSections)
1941 {
1942 t << "<div id=\"dynsection-" << sectionCount << "-summary\" "
1943 "class=\"dynsummary\" "
1944 "style=\"display:block;\">\n";
1945 }
1946}

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 treeViewCssJs += "<script type=\"text/javascript\" src=\"$relpath^resize.js\"></script>\n";
420
421 if (searchEngine)
422 {
423 searchCssJs = "<link href=\"$relpath^search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
424 if (!serverBasedSearch)
425 {
426 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/searchdata.js\"></script>\n";
427 }
428 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n";
429
430 if (!serverBasedSearch)
431 {
432 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS) || Config_getBool(FULL_SIDEBAR))
433 {
434 searchCssJs += "<script type=\"text/javascript\">\n"
435 "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n"
436 " $(function() { init_search(); });\n"
437 "/* @license-end */\n"
438 "</script>";
439 }
440 }
441 else
442 {
443 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
444 {
445 searchCssJs += "<script type=\"text/javascript\">\n"
446 "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n"
447 " $(function() {\n"
448 " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
449 " });\n"
450 " /* @license-end */\n"
451 "</script>\n";
452 }
453
454 // OPENSEARCH_PROVIDER {
455 searchCssJs += "<link rel=\"search\" href=\"" + relPath +
456 "search_opensearch.php?v=opensearch.xml\" "
457 "type=\"application/opensearchdescription+xml\" title=\"" +
458 (hasProjectName ? projectName : QCString("Doxygen")) +
459 "\"/>";
460 // OPENSEARCH_PROVIDER }
461 }
462 searchBox = getSearchBox(serverBasedSearch, relPath, FALSE);
463 }
464
465 if (mathJax)
466 {
467 auto mathJaxVersion = Config_getEnum(MATHJAX_VERSION);
468 QCString path = Config_getString(MATHJAX_RELPATH);
469 if (path.isEmpty() || path.startsWith("..")) // relative path
470 {
471 path.prepend(relPath);
472 }
473
474 switch (mathJaxVersion)
475 {
476 case MATHJAX_VERSION_t::MathJax_3:
477 {
478 mathJaxJs += // "<script src=\"https://polyfill.io/v3/polyfill.min.js?features=es6\"></script>\n" // needed for IE11 only, see #10354
479 "<script type=\"text/javascript\">\n"
480 "window.MathJax = {\n"
481 " options: {\n"
482 " ignoreHtmlClass: 'tex2jax_ignore',\n"
483 " processHtmlClass: 'tex2jax_process'\n"
484 " }";
485 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
486 if (!mathJaxExtensions.empty() || !g_latex_macro.isEmpty())
487 {
488 mathJaxJs+= ",\n";
489 if (!mathJaxExtensions.empty())
490 {
491 bool first = true;
492 mathJaxJs+= " loader: {\n"
493 " load: [";
494 for (const auto &s : mathJaxExtensions)
495 {
496 if (!first) mathJaxJs+= ",";
497 mathJaxJs+= "'[tex]/"+QCString(s.c_str())+"'";
498 first = false;
499 }
500 mathJaxJs+= "]\n"
501 " },\n";
502 }
503 mathJaxJs+= " tex: {\n"
504 " macros: {";
505 if (!g_latex_macro.isEmpty())
506 {
507 mathJaxJs += g_latex_macro+" ";
508 }
509 mathJaxJs+="},\n"
510 " packages: ['base','configmacros'";
511 if (!g_latex_macro.isEmpty())
512 {
513 mathJaxJs+= ",'newcommand'";
514 }
515 for (const auto &s : mathJaxExtensions)
516 {
517 mathJaxJs+= ",'"+QCString(s.c_str())+"'";
518 }
519 mathJaxJs += "]\n"
520 " }\n";
521 }
522 else
523 {
524 mathJaxJs += "\n";
525 }
526 mathJaxJs += "};\n";
527 // MATHJAX_CODEFILE
528 if (!g_mathjax_code.isEmpty())
529 {
530 mathJaxJs += g_mathjax_code;
531 mathJaxJs += "\n";
532 }
533 mathJaxJs += "</script>\n";
534 mathJaxJs += "<script type=\"text/javascript\" id=\"MathJax-script\" async=\"async\" src=\"" +
535 path + "es5/tex-" + mathJaxFormat.lower() + ".js\">";
536 mathJaxJs+="</script>\n";
537 }
538 break;
539 case MATHJAX_VERSION_t::MathJax_2:
540 {
541 mathJaxJs = "<script type=\"text/x-mathjax-config\">\n"
542 "MathJax.Hub.Config({\n"
543 " extensions: [\"tex2jax.js\"";
544 const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS);
545 for (const auto &s : mathJaxExtensions)
546 {
547 mathJaxJs+= ", \""+QCString(s.c_str())+".js\"";
548 }
549 if (mathJaxFormat.isEmpty())
550 {
551 mathJaxFormat = "HTML-CSS";
552 }
553 mathJaxJs += "],\n"
554 " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n";
555 if (!g_latex_macro.isEmpty())
556 {
557 mathJaxJs += " TeX: { Macros: {\n";
558 mathJaxJs += g_latex_macro;
559 mathJaxJs += "\n"
560 " } }\n";
561 }
562 mathJaxJs += "});\n";
563 if (!g_mathjax_code.isEmpty())
564 {
565 mathJaxJs += g_mathjax_code;
566 mathJaxJs += "\n";
567 }
568 mathJaxJs += "</script>\n";
569 mathJaxJs += "<script type=\"text/javascript\" async=\"async\" src=\"" + path + "MathJax.js\"></script>\n";
570 }
571 break;
572 }
573 }
574
575 QCString darkModeJs;
576 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
577 {
578 darkModeJs="<script type=\"text/javascript\" src=\"$relpath^darkmode_toggle.js\"></script>\n";
579 }
580
581 if (hasCookie) // extend the $treeview tag to avoid breaking old files used with HTML_HEADER
582 {
583 treeViewCssJs+="<script type=\"text/javascript\" src=\"$relpath^cookie.js\"></script>\n";
584 }
585
586 // first substitute generic keywords
587 QCString result = substituteKeywords(file,str,title,
588 convertToHtml(Config_getString(PROJECT_NAME)),
589 convertToHtml(Config_getString(PROJECT_NUMBER)),
590 convertToHtml(Config_getString(PROJECT_BRIEF)));
591
592 // then do the HTML specific keywords
593 result = substituteKeywords(file,result,
594 {
595 // keyword value getter
596 { "$navpath", [&]() { return navPath; } },
597 { "$stylesheet", [&]() { return cssFile; } },
598 { "$treeview", [&]() { return treeViewCssJs; } },
599 { "$searchbox", [&]() { return searchBox; } },
600 { "$search", [&]() { return searchCssJs; } },
601 { "$mathjax", [&]() { return mathJaxJs; } },
602 { "$darkmode", [&]() { return darkModeJs; } },
603 { "$generatedby", [&]() { return generatedBy; } },
604 { "$extrastylesheet",[&]() { return extraCssText; } },
605 { "$relpath$", [&]() { return relPath; } } //<-- obsolete: for backwards compatibility only
606 });
607
608 result = substitute(result,"$relpath^",relPath); //<-- must be done after the previous substitutions
609
610 // remove conditional blocks
611 result = selectBlocks(result,
612 {
613 // keyword, is enabled
614 { "FULL_SIDEBAR", hasFullSideBar },
615 { "DISABLE_INDEX", disableIndex },
616 { "GENERATE_TREEVIEW", treeView },
617 { "SEARCHENGINE", searchEngine },
618 { "TITLEAREA", titleArea },
619 { "PROJECT_NAME", hasProjectName },
620 { "PROJECT_NUMBER", hasProjectNumber },
621 { "PROJECT_BRIEF", hasProjectBrief },
622 { "PROJECT_LOGO", hasProjectLogo },
623 { "PROJECT_ICON", hasProjectIcon },
624 { "COPY_CLIPBOARD", hasCopyClipboard },
626
627 result = removeEmptyLines(result);
628
629 return result;
630}
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:4472
QCString stripPath(const QCString &s)
Definition util.cpp:5457
QCString removeEmptyLines(const QCString &s)
Definition util.cpp:7056
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:6879
QCString substituteKeywords(const QCString &file, const QCString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:3564

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 2843 of file htmlgen.cpp.

2848{
2849 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2850 bool searchEngine = Config_getBool(SEARCHENGINE);
2851 bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
2852 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2853 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2854 bool disableIndex = Config_getBool(DISABLE_INDEX);
2855 bool dynamicMenus = Config_getBool(HTML_DYNAMIC_MENUS);
2857 LayoutNavEntry::Kind kind = LayoutNavEntry::None;
2858 LayoutNavEntry::Kind altKind = LayoutNavEntry::None; // fall back for the old layout file
2859 bool highlightParent=false;
2860 switch (hli) // map HLI enums to LayoutNavEntry::Kind enums
2861 {
2862 case HighlightedItem::Main: kind = LayoutNavEntry::MainPage; break;
2863 case HighlightedItem::Topics: kind = LayoutNavEntry::Topics; break;
2864 case HighlightedItem::Modules: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules; break;
2865 case HighlightedItem::Namespaces: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; break;
2866 case HighlightedItem::ClassHierarchy: kind = LayoutNavEntry::ClassHierarchy; break;
2867 case HighlightedItem::InterfaceHierarchy: kind = LayoutNavEntry::InterfaceHierarchy; break;
2868 case HighlightedItem::ExceptionHierarchy: kind = LayoutNavEntry::ExceptionHierarchy; break;
2869 case HighlightedItem::Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break;
2870 case HighlightedItem::Concepts: kind = LayoutNavEntry::Concepts; break;
2871 case HighlightedItem::Interfaces: kind = LayoutNavEntry::InterfaceIndex; altKind = LayoutNavEntry::Interfaces; break;
2872 case HighlightedItem::Structs: kind = LayoutNavEntry::StructIndex; altKind = LayoutNavEntry::Structs; break;
2873 case HighlightedItem::Exceptions: kind = LayoutNavEntry::ExceptionIndex; altKind = LayoutNavEntry::Exceptions; break;
2874 case HighlightedItem::AnnotatedClasses: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break;
2875 case HighlightedItem::AnnotatedInterfaces: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces; break;
2876 case HighlightedItem::AnnotatedStructs: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs; break;
2877 case HighlightedItem::AnnotatedExceptions: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions; break;
2878 case HighlightedItem::Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break;
2879 case HighlightedItem::NamespaceMembers: kind = LayoutNavEntry::NamespaceMembers; break;
2880 case HighlightedItem::ModuleMembers: kind = LayoutNavEntry::ModuleMembers; break;
2881 case HighlightedItem::Functions: kind = LayoutNavEntry::ClassMembers; break;
2882 case HighlightedItem::Globals: kind = LayoutNavEntry::FileGlobals; break;
2883 case HighlightedItem::Pages: kind = LayoutNavEntry::Pages; break;
2884 case HighlightedItem::Examples: kind = LayoutNavEntry::Examples; break;
2885 case HighlightedItem::UserGroup: kind = LayoutNavEntry::UserGroup; break;
2886 case HighlightedItem::ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes;
2887 highlightParent = true; break;
2888 case HighlightedItem::ConceptVisible: kind = LayoutNavEntry::Concepts;
2889 highlightParent = true; break;
2890 case HighlightedItem::ModuleVisible: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules;
2891 highlightParent = true; break;
2892 case HighlightedItem::InterfaceVisible: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces;
2893 highlightParent = true; break;
2894 case HighlightedItem::StructVisible: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs;
2895 highlightParent = true; break;
2896 case HighlightedItem::ExceptionVisible: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions;
2897 highlightParent = true; break;
2898 case HighlightedItem::NamespaceVisible: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces;
2899 highlightParent = true; break;
2900 case HighlightedItem::FileVisible: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files;
2901 highlightParent = true; break;
2902 case HighlightedItem::None: break;
2903 case HighlightedItem::Search: break;
2904 }
2905
2906 if (!disableIndex && dynamicMenus)
2907 {
2908 QCString searchPage;
2909 if (externalSearch)
2910 {
2911 searchPage = "search" + Doxygen::htmlFileExtension;
2912 }
2913 else
2914 {
2915 searchPage = "search.php";
2916 }
2917 t << "<script type=\"text/javascript\" src=\"" << relPath << "menudata.js\"></script>\n";
2918 t << "<script type=\"text/javascript\" src=\"" << relPath << "menu.js\"></script>\n";
2919 t << "<script type=\"text/javascript\">\n";
2920 t << "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n";
2921 t << "$(function() {\n";
2922 t << " initMenu('" << relPath << "',"
2923 << (searchEngine && !(generateTreeView && fullSidebar)?"true":"false") << ","
2924 << (serverBasedSearch?"true":"false") << ",'"
2925 << searchPage << "','"
2926 << theTranslator->trSearch() << "',"
2927 << (generateTreeView?"true":"false")
2928 << ");\n";
2929 if (searchEngine)
2930 {
2931 if (!serverBasedSearch)
2932 {
2933 if (!disableIndex && dynamicMenus && !fullSidebar)
2934 {
2935 t << " $(function() { init_search(); });\n";
2936 }
2937 }
2938 else
2939 {
2940 t << " $(function() {\n"
2941 << " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n";
2942 t << " });\n";
2943 }
2944 }
2945 t << "});\n";
2946 t << "/* @license-end */\n";
2947 t << "</script>\n";
2948 t << "<div id=\"main-nav\"></div>\n";
2949 }
2950 else if (!disableIndex) // && !Config_getBool(HTML_DYNAMIC_MENUS)
2951 {
2952 // find highlighted index item
2953 LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : QCString());
2954 if (!hlEntry && altKind!=LayoutNavEntry::None) { hlEntry=root->find(altKind); kind=altKind; }
2955 if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index...
2956 {
2957 highlightParent=TRUE;
2958 hlEntry = root->children().front().get();
2959 if (hlEntry==nullptr)
2960 {
2961 return; // argl, empty index!
2962 }
2963 }
2964 if (kind==LayoutNavEntry::UserGroup)
2965 {
2966 LayoutNavEntry *e = hlEntry->children().front().get();
2967 if (e)
2968 {
2969 hlEntry = e;
2970 }
2971 }
2972 t << "<div id=\"main-nav\">\n";
2973 renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HighlightedItem::Search);
2974 if (!extraTabs)
2975 {
2976 t << "</div><!-- main-nav -->\n";
2977 }
2978 }
2979 else if (!generateTreeView)
2980 {
2981 renderQuickLinksAsTree(t,relPath,root);
2982 }
2983 if (generateTreeView && !disableIndex && fullSidebar && !extraTabs)
2984 {
2985 t << "<div id=\"doc-content\">\n";
2986 }
2987}
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 1360 of file htmlgen.cpp.

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

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 635 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 1446 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 634 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().