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 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 &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)
 

Variables

static QCString g_header
 
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 61 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()

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

Definition at line 2700 of file htmlgen.cpp.

2701{
2702 t << "</span>";
2703 if (!l.isEmpty()) t << "</a>";
2704 t << "</li>\n";
2705}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150

References QCString::isEmpty().

Referenced by renderQuickLinksAsTabs().

◆ endQuickIndexList()

static void endQuickIndexList ( TextStream & t)
static

Definition at line 2673 of file htmlgen.cpp.

2674{
2675 if (!Config_getBool(DISABLE_INDEX))
2676 {
2677 t << " </ul>\n";
2678 t << " </div>\n";
2679 }
2680 else
2681 {
2682 t << "</ul>\n";
2683 }
2684}
#define Config_getBool(name)
Definition config.h:33

References Config_getBool.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ endSectionContent()

static void endSectionContent ( TextStream & t)
static

Definition at line 1992 of file htmlgen.cpp.

1993{
1994 //t << "<!-- endSectionContent -->";
1995 t << "</div>\n";
1996}

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

◆ endSectionHeader()

static void endSectionHeader ( TextStream & t)
static

◆ endSectionSummary()

static void endSectionSummary ( TextStream & t)
static

Definition at line 1966 of file htmlgen.cpp.

1967{
1968 //t << "<!-- endSectionSummary -->";
1969 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1970 if (dynamicSections)
1971 {
1972 t << "</div>\n";
1973 }
1974}

References Config_getBool.

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

◆ fillColorStyleMap()

static 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()

static 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:6119

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

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

◆ getConvertLatexMacro()

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

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

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

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

◆ getSearchBox()

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

Definition at line 305 of file htmlgen.cpp.

306{
307 TextStream t;
308 if (serverSide)
309 {
310 writeServerSearchBox(t, relPath, highlightSearch);
311 }
312 else
313 {
314 writeClientSearchBox(t, relPath);
315 }
316 return t.str();
317}
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:94
static void writeClientSearchBox(TextStream &t, const QCString &relPath)
Definition htmlgen.cpp:73

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

Referenced by substituteHtmlKeywords().

◆ quickLinkVisible()

static bool quickLinkVisible ( LayoutNavEntry::Kind kind)
static

Definition at line 2707 of file htmlgen.cpp.

2708{
2709 const auto &index = Index::instance();
2710 bool showNamespaces = Config_getBool(SHOW_NAMESPACES);
2711 bool showFiles = Config_getBool(SHOW_FILES);
2712 switch (kind)
2713 {
2714 case LayoutNavEntry::MainPage: return TRUE;
2715 case LayoutNavEntry::User: return TRUE;
2716 case LayoutNavEntry::UserGroup: return TRUE;
2717 case LayoutNavEntry::Pages: return index.numIndexedPages()>0;
2718 case LayoutNavEntry::Topics: return index.numDocumentedGroups()>0;
2719 case LayoutNavEntry::Modules: return index.numDocumentedModules()>0;
2720 case LayoutNavEntry::ModuleList: return index.numDocumentedModules()>0;
2721 case LayoutNavEntry::ModuleMembers: return index.numDocumentedModuleMembers(ModuleMemberHighlight::All)>0;
2722 case LayoutNavEntry::Namespaces: return showNamespaces && index.numDocumentedNamespaces()>0;
2723 case LayoutNavEntry::NamespaceList: return showNamespaces && index.numDocumentedNamespaces()>0;
2724 case LayoutNavEntry::NamespaceMembers: return showNamespaces && index.numDocumentedNamespaceMembers(NamespaceMemberHighlight::All)>0;
2725 case LayoutNavEntry::Concepts: return index.numDocumentedConcepts()>0;
2726 case LayoutNavEntry::Classes: return index.numAnnotatedClasses()>0;
2727 case LayoutNavEntry::ClassList: return index.numAnnotatedClasses()>0;
2728 case LayoutNavEntry::ClassIndex: return index.numAnnotatedClasses()>0;
2729 case LayoutNavEntry::ClassHierarchy: return index.numHierarchyClasses()>0;
2730 case LayoutNavEntry::ClassMembers: return index.numDocumentedClassMembers(ClassMemberHighlight::All)>0;
2731 case LayoutNavEntry::Files: return showFiles && index.numDocumentedFiles()>0;
2732 case LayoutNavEntry::FileList: return showFiles && index.numDocumentedFiles()>0;
2733 case LayoutNavEntry::FileGlobals: return showFiles && index.numDocumentedFileMembers(FileMemberHighlight::All)>0;
2734 case LayoutNavEntry::Examples: return !Doxygen::exampleLinkedMap->empty();
2735 case LayoutNavEntry::Interfaces: return index.numAnnotatedInterfaces()>0;
2736 case LayoutNavEntry::InterfaceList: return index.numAnnotatedInterfaces()>0;
2737 case LayoutNavEntry::InterfaceIndex: return index.numAnnotatedInterfaces()>0;
2738 case LayoutNavEntry::InterfaceHierarchy: return index.numHierarchyInterfaces()>0;
2739 case LayoutNavEntry::Structs: return index.numAnnotatedStructs()>0;
2740 case LayoutNavEntry::StructList: return index.numAnnotatedStructs()>0;
2741 case LayoutNavEntry::StructIndex: return index.numAnnotatedStructs()>0;
2742 case LayoutNavEntry::Exceptions: return index.numAnnotatedExceptions()>0;
2743 case LayoutNavEntry::ExceptionList: return index.numAnnotatedExceptions()>0;
2744 case LayoutNavEntry::ExceptionIndex: return index.numAnnotatedExceptions()>0;
2745 case LayoutNavEntry::ExceptionHierarchy: return index.numHierarchyExceptions()>0;
2746 case LayoutNavEntry::None: // should never happen, means not properly initialized
2747 assert(kind != LayoutNavEntry::None);
2748 return FALSE;
2749 }
2750 return FALSE;
2751}
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()

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

Definition at line 2782 of file htmlgen.cpp.

2785{
2786 if (hlEntry->parent()) // first draw the tabs for the parent of hlEntry
2787 {
2788 renderQuickLinksAsTabs(t,relPath,hlEntry->parent(),kind,highlightParent,highlightSearch);
2789 }
2790 if (hlEntry->parent() && !hlEntry->parent()->children().empty()) // draw tabs for row containing hlEntry
2791 {
2792 bool topLevel = hlEntry->parent()->parent()==nullptr;
2793 int count=0;
2794 for (const auto &entry : hlEntry->parent()->children())
2795 {
2796 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2797 }
2798 if (count>0) // at least one item is visible
2799 {
2800 startQuickIndexList(t,topLevel);
2801 for (const auto &entry : hlEntry->parent()->children())
2802 {
2803 if (entry->visible() && quickLinkVisible(entry->kind()))
2804 {
2805 QCString url = entry->url();
2806 startQuickIndexItem(t,url,
2807 entry.get()==hlEntry &&
2808 (!entry->children().empty() ||
2809 (entry->kind()==kind && !highlightParent)
2810 ),
2811 TRUE,relPath);
2812 t << fixSpaces(entry->title());
2813 endQuickIndexItem(t,url);
2814 }
2815 }
2816 if (hlEntry->parent()==LayoutDocManager::instance().rootNavEntry()) // first row is special as it contains the search box
2817 {
2818 bool searchEngine = Config_getBool(SEARCHENGINE);
2819 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2820 if (searchEngine)
2821 {
2822 t << " <li>\n";
2823 if (!serverBasedSearch) // pure client side search
2824 {
2825 writeClientSearchBox(t,relPath);
2826 t << " </li>\n";
2827 }
2828 else // server based search
2829 {
2830 writeServerSearchBox(t,relPath,highlightSearch);
2831 if (!highlightSearch)
2832 {
2833 t << " </li>\n";
2834 }
2835 }
2836 }
2837 if (!highlightSearch) // on the search page the index will be ended by the
2838 // page itself
2839 {
2841 }
2842 }
2843 else // normal case for other rows than first one
2844 {
2846 }
2847 }
2848 }
2849}
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1423
static void endQuickIndexList(TextStream &t)
Definition htmlgen.cpp:2673
static void startQuickIndexList(TextStream &t, bool topLevel=TRUE)
Definition htmlgen.cpp:2653
static void startQuickIndexItem(TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
Definition htmlgen.cpp:2686
static void renderQuickLinksAsTabs(TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
Definition htmlgen.cpp:2782
static void endQuickIndexItem(TextStream &t, const QCString &l)
Definition htmlgen.cpp:2700
static bool quickLinkVisible(LayoutNavEntry::Kind kind)
Definition htmlgen.cpp:2707
const LayoutNavEntryList & children() const
Definition layout.h:209
LayoutNavEntry * parent() const
Definition layout.h:196
QCString fixSpaces(const QCString &s)
Definition util.h:464

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()

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

Definition at line 2753 of file htmlgen.cpp.

2755{
2756 int count=0;
2757 for (const auto &entry : root->children())
2758 {
2759 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2760 }
2761 if (count>0) // at least one item is visible
2762 {
2764 for (const auto &entry : root->children())
2765 {
2766 if (entry->visible() && quickLinkVisible(entry->kind()))
2767 {
2768 QCString url = entry->url();
2769 t << "<li><a href=\"" << relPath << url << "\"><span>";
2770 t << fixSpaces(entry->title());
2771 t << "</span></a>\n";
2772 // recursive into child list
2773 renderQuickLinksAsTree(t,relPath,entry.get());
2774 t << "</li>";
2775 }
2776 }
2778 }
2779}
static void renderQuickLinksAsTree(TextStream &t, const QCString &relPath, LayoutNavEntry *root)
Definition htmlgen.cpp:2753

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

Referenced by renderQuickLinksAsTree(), and writeDefaultQuickLinks().

◆ replaceVariables()

static 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 assert(it!=mapping.end()); // should be found
680 output.addStr(it->second); // add it value
681 //printf("replace '%s' by '%s'\n",qPrint(input.mid(i+4,j-i-4)),qPrint(it->second));
682 p=j+1;
683 }
684 output.addStr(input.data()+p,input.length()-p);
685 output.addChar(0);
686 return output.get();
687 };
688
689 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
690 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
691 {
692 return doReplacements(g_lightMap);
693 }
694 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
695 {
696 return doReplacements(g_darkMap);
697 }
698 else
699 {
700 return input;
701 }
702}
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

References GrowBuf::addChar(), GrowBuf::addStr(), Config_getEnum, QCString::data(), 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()

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

Definition at line 2686 of file htmlgen.cpp.

2689{
2690 t << " <li";
2691 if (hl)
2692 {
2693 t << " class=\"current\"";
2694 }
2695 t << ">";
2696 if (!l.isEmpty()) t << "<a href=\"" << correctURL(l,relPath) << "\">";
2697 t << "<span>";
2698}
QCString correctURL(const QCString &url, const QCString &relPath)
Corrects URL url according to the relative path relPath.
Definition util.cpp:6258

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

Referenced by renderQuickLinksAsTabs().

◆ startQuickIndexList()

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

Definition at line 2653 of file htmlgen.cpp.

2654{
2655 if (!Config_getBool(DISABLE_INDEX))
2656 {
2657 if (topLevel)
2658 {
2659 t << " <div id=\"navrow1\" class=\"tabs\">\n";
2660 }
2661 else
2662 {
2663 t << " <div id=\"navrow2\" class=\"tabs2\">\n";
2664 }
2665 t << " <ul class=\"tablist\">\n";
2666 }
2667 else
2668 {
2669 t << "<ul>";
2670 }
2671}

References Config_getBool, and TRUE.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ startSectionContent()

static void startSectionContent ( TextStream & t,
int sectionCount )
static

Definition at line 1976 of file htmlgen.cpp.

1977{
1978 //t << "<!-- startSectionContent -->";
1979 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1980 if (dynamicSections)
1981 {
1982 t << "<div id=\"dynsection-" << sectionCount << "-content\" "
1983 "class=\"dyncontent\" "
1984 "style=\"display:none;\">\n";
1985 }
1986 else
1987 {
1988 t << "<div class=\"dyncontent\">\n";
1989 }
1990}

References Config_getBool.

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

◆ startSectionHeader()

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

Definition at line 1928 of file htmlgen.cpp.

1930{
1931 //t << "<!-- startSectionHeader -->";
1932 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1933 if (dynamicSections)
1934 {
1935 t << "<div id=\"dynsection-" << sectionCount << "\" "
1936 "onclick=\"return dynsection.toggleVisibility(this)\" "
1937 "class=\"dynheader closed\" "
1938 "style=\"cursor:pointer;\">\n";
1939 t << " <img id=\"dynsection-" << sectionCount << "-trigger\" src=\""
1940 << relPath << "closed.png\" alt=\"+\"/> ";
1941 }
1942 else
1943 {
1944 t << "<div class=\"dynheader\">\n";
1945 }
1946}

References Config_getBool.

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

◆ startSectionSummary()

static void startSectionSummary ( TextStream & t,
int sectionCount )
static

Definition at line 1954 of file htmlgen.cpp.

1955{
1956 //t << "<!-- startSectionSummary -->";
1957 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1958 if (dynamicSections)
1959 {
1960 t << "<div id=\"dynsection-" << sectionCount << "-summary\" "
1961 "class=\"dynsummary\" "
1962 "style=\"display:block;\">\n";
1963 }
1964}

References Config_getBool.

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

◆ substituteHtmlKeywords()

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

Definition at line 319 of file htmlgen.cpp.

323{
324 // Build CSS/JavaScript tags depending on treeview, search engine settings
325 QCString cssFile;
326 QCString generatedBy;
327 QCString treeViewCssJs;
328 QCString searchCssJs;
329 QCString searchBox;
330 QCString mathJaxJs;
331 QCString extraCssText;
332
333 QCString projectName = Config_getString(PROJECT_NAME);
334 bool treeView = Config_getBool(GENERATE_TREEVIEW);
335 bool searchEngine = Config_getBool(SEARCHENGINE);
336 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
337 bool mathJax = Config_getBool(USE_MATHJAX);
338 QCString mathJaxFormat = Config_getEnumAsString(MATHJAX_FORMAT);
339 bool disableIndex = Config_getBool(DISABLE_INDEX);
340 bool hasProjectName = !projectName.isEmpty();
341 bool hasProjectNumber = !Config_getString(PROJECT_NUMBER).isEmpty();
342 bool hasProjectBrief = !Config_getString(PROJECT_BRIEF).isEmpty();
343 bool hasProjectLogo = !Config_getString(PROJECT_LOGO).isEmpty();
344 bool hasProjectIcon = !Config_getString(PROJECT_ICON).isEmpty();
345 bool hasFullSideBar = Config_getBool(FULL_SIDEBAR) && disableIndex && treeView;
346 bool hasCopyClipboard = Config_getBool(HTML_COPY_CLIPBOARD);
347 bool hasCookie = treeView || searchEngine || Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE;
348 static bool titleArea = (hasProjectName || hasProjectBrief || hasProjectLogo || (disableIndex && searchEngine));
349
350 cssFile = Config_getString(HTML_STYLESHEET);
351 if (cssFile.isEmpty())
352 {
353 cssFile = "doxygen.css";
354 }
355 else
356 {
357 if (!cssFile.startsWith("http:") && !cssFile.startsWith("https:"))
358 {
359 FileInfo cssfi(cssFile.str());
360 if (cssfi.exists())
361 {
362 cssFile = cssfi.fileName();
363 }
364 else
365 {
366 cssFile = "doxygen.css";
367 }
368 }
369 }
370
371 extraCssText = "";
372 const StringVector &extraCssFile = Config_getList(HTML_EXTRA_STYLESHEET);
373 for (const auto &fileName : extraCssFile)
374 {
375 if (!fileName.empty())
376 {
377 QCString htmlStyleSheet = fileName.c_str();
378 if (htmlStyleSheet.startsWith("http:") || htmlStyleSheet.startsWith("https:"))
379 {
380 extraCssText += "<link href=\""+htmlStyleSheet+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
381 }
382 else
383 {
384 FileInfo fi(fileName);
385 if (fi.exists())
386 {
387 extraCssText += "<link href=\"$relpath^"+stripPath(fileName.c_str())+"\" rel=\"stylesheet\" type=\"text/css\"/>\n";
388 }
389 }
390 }
391 }
392
393 switch (Config_getEnum(TIMESTAMP))
394 {
395 case TIMESTAMP_t::YES:
396 case TIMESTAMP_t::DATETIME:
397 generatedBy = theTranslator->trGeneratedAt(dateToString(DateTimeType::DateTime),
398 convertToHtml(Config_getString(PROJECT_NAME)));
399 break;
400 case TIMESTAMP_t::DATE:
401 generatedBy = theTranslator->trGeneratedAt(dateToString(DateTimeType::Date),
402 convertToHtml(Config_getString(PROJECT_NAME)));
403 break;
404 case TIMESTAMP_t::NO:
405 generatedBy = theTranslator->trGeneratedBy();
406 break;
407 }
408 treeViewCssJs = "<link href=\"$relpath^navtree.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
409 if (treeView)
410 {
411 treeViewCssJs += "<script type=\"text/javascript\" src=\"$relpath^navtreedata.js\"></script>\n"
412 "<script type=\"text/javascript\" src=\"$relpath^navtree.js\"></script>\n";
413 }
414 treeViewCssJs += "<script type=\"text/javascript\" src=\"$relpath^resize.js\"></script>\n";
415
416 if (searchEngine)
417 {
418 searchCssJs = "<link href=\"$relpath^search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>\n";
419 if (!serverBasedSearch)
420 {
421 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/searchdata.js\"></script>\n";
422 }
423 searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n";
424
425 if (!serverBasedSearch)
426 {
427 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
428 {
429 searchCssJs += "<script type=\"text/javascript\">\n"
430 "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n"
431 " $(function() { init_search(); });\n"
432 "/* @license-end */\n"
433 "</script>";
434 }
435 }
436 else
437 {
438 if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
439 {
440 searchCssJs += "<script type=\"text/javascript\">\n"
441 "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n"
442 " $(function() {\n"
443 " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
444 " });\n"
445 " /* @license-end */\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(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(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:65
static const SelectionMarkerInfo htmlMarkerInfo
Definition htmlgen.cpp:69
static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch)
Definition htmlgen.cpp:305
static QCString g_latex_macro
Definition htmlgen.cpp:66
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:4317
QCString stripPath(const QCString &s)
Definition util.cpp:5292
QCString removeEmptyLines(const QCString &s)
Definition util.cpp:6914
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:6737
QCString substituteKeywords(const QCString &s, const KeywordSubstitutionList &keywords)
Definition util.cpp:3418

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()

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

Definition at line 73 of file htmlgen.cpp.

74{
75 t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
76 t << " <span class=\"left\">\n";
77 t << " <span id=\"MSearchSelect\" ";
78 t << " onmouseover=\"return searchBox.OnSearchSelectShow()\" ";
79 t << " onmouseout=\"return searchBox.OnSearchSelectHide()\">&#160;</span>\n";
80 t << " <input type=\"text\" id=\"MSearchField\" value=\"\" placeholder=\""
81 << theTranslator->trSearch() << "\" accesskey=\"S\"\n";
82 t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
83 t << " onblur=\"searchBox.OnSearchFieldFocus(false)\" \n";
84 t << " onkeyup=\"searchBox.OnSearchFieldChange(event)\"/>\n";
85 t << " </span><span class=\"right\">\n";
86 t << " <a id=\"MSearchClose\" href=\"javascript:searchBox.CloseResultsWindow()\">"
87 << "<img id=\"MSearchCloseImg\" border=\"0\" src=\"" << relPath << "search/close.svg\" alt=\"\"/></a>\n";
88 t << " </span>\n";
89 t << " </div>\n";
90}

References theTranslator.

Referenced by getSearchBox(), and renderQuickLinksAsTabs().

◆ writeDefaultQuickLinks()

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

Definition at line 2851 of file htmlgen.cpp.

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

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()

static void writeDefaultStyleSheet ( TextStream & t)
static

Definition at line 1388 of file htmlgen.cpp.

1389{
1390 t << "/* The standard CSS for doxygen " << getDoxygenVersion() << "*/\n\n";
1391 switch (Config_getEnum(HTML_COLORSTYLE))
1392 {
1393 case HTML_COLORSTYLE_t::LIGHT:
1394 case HTML_COLORSTYLE_t::DARK:
1395 /* variables will be resolved while writing to the CSS file */
1396 break;
1397 case HTML_COLORSTYLE_t::AUTO_LIGHT:
1398 case HTML_COLORSTYLE_t::TOGGLE:
1399 t << "html {\n";
1400 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1401 t << "}\n\n";
1402 break;
1403 case HTML_COLORSTYLE_t::AUTO_DARK:
1404 t << "html {\n";
1405 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1406 t << "}\n\n";
1407 break;
1408 }
1409 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_LIGHT)
1410 {
1411 t << "@media (prefers-color-scheme: dark) {\n";
1412 t << " html:not(.dark-mode) {\n";
1413 t << " color-scheme: dark;\n\n";
1414 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1415 t << "}}\n";
1416 }
1417 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_DARK)
1418 {
1419 t << "@media (prefers-color-scheme: light) {\n";
1420 t << " html:not(.light-mode) {\n";
1421 t << " color-scheme: light;\n\n";
1422 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1423 t << "}}\n";
1424 }
1425 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
1426 {
1427 t << "html.dark-mode {\n";
1428 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1429 t << "}\n\n";
1430 }
1431
1432 t << replaceVariables(ResourceMgr::instance().getAsString("doxygen.css"));
1433
1434 // For Webkit based the scrollbar styling cannot be overruled (bug in chromium?).
1435 // To allow the user to style the scrollbars differently we should only add it in case
1436 // the user did not specify any extra stylesheets.
1437 bool addScrollbarStyling = Config_getList(HTML_EXTRA_STYLESHEET).empty();
1438 if (addScrollbarStyling)
1439 {
1440 t << replaceVariables(ResourceMgr::instance().getAsString("scrollbar.css"));
1441 }
1442
1443}
static QCString replaceVariables(const QCString &input)
Definition htmlgen.cpp:667

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

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

◆ writeServerSearchBox()

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

Definition at line 94 of file htmlgen.cpp.

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

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_header

◆ g_indexLock

std::mutex g_indexLock
static

Definition at line 1463 of file htmlgen.cpp.

Referenced by HtmlGenerator::startFile().

◆ g_latex_macro

QCString g_latex_macro
static

Definition at line 66 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 65 of file htmlgen.cpp.

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

◆ hex

auto hex ="0123456789ABCDEF"
staticconstexpr

Definition at line 67 of file htmlgen.cpp.

◆ htmlMarkerInfo

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

Definition at line 69 of file htmlgen.cpp.

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

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