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

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

Definition at line 2701 of file htmlgen.cpp.

2702{
2703 t << "</span>";
2704 if (!l.isEmpty()) t << "</a>";
2705 t << "</li>\n";
2706}
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 2674 of file htmlgen.cpp.

2675{
2676 if (!Config_getBool(DISABLE_INDEX))
2677 {
2678 t << " </ul>\n";
2679 t << " </div>\n";
2680 }
2681 else
2682 {
2683 t << "</ul>\n";
2684 }
2685}
#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 1993 of file htmlgen.cpp.

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

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

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

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

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

655{
657 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
658 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
659 {
660 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("lightmode_settings.css")),g_lightMap);
661 }
662 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
663 {
664 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("darkmode_settings.css")),g_darkMap);
665 }
666}
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:633
static StringUnorderedMap g_lightMap
Definition htmlgen.cpp:630
static StringUnorderedMap g_darkMap
Definition htmlgen.cpp:631
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:6275

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

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

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

Definition at line 306 of file htmlgen.cpp.

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

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

Referenced by substituteHtmlKeywords().

◆ quickLinkVisible()

static bool quickLinkVisible ( LayoutNavEntry::Kind kind)
static

Definition at line 2708 of file htmlgen.cpp.

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

2786{
2787 if (hlEntry->parent()) // first draw the tabs for the parent of hlEntry
2788 {
2789 renderQuickLinksAsTabs(t,relPath,hlEntry->parent(),kind,highlightParent,highlightSearch);
2790 }
2791 if (hlEntry->parent() && !hlEntry->parent()->children().empty()) // draw tabs for row containing hlEntry
2792 {
2793 bool topLevel = hlEntry->parent()->parent()==nullptr;
2794 int count=0;
2795 for (const auto &entry : hlEntry->parent()->children())
2796 {
2797 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2798 }
2799 if (count>0) // at least one item is visible
2800 {
2801 startQuickIndexList(t,topLevel);
2802 for (const auto &entry : hlEntry->parent()->children())
2803 {
2804 if (entry->visible() && quickLinkVisible(entry->kind()))
2805 {
2806 QCString url = entry->url();
2807 startQuickIndexItem(t,url,
2808 entry.get()==hlEntry &&
2809 (!entry->children().empty() ||
2810 (entry->kind()==kind && !highlightParent)
2811 ),
2812 TRUE,relPath);
2813 t << fixSpaces(entry->title());
2814 endQuickIndexItem(t,url);
2815 }
2816 }
2817 if (hlEntry->parent()==LayoutDocManager::instance().rootNavEntry()) // first row is special as it contains the search box
2818 {
2819 bool searchEngine = Config_getBool(SEARCHENGINE);
2820 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2821 bool disableIndex = Config_getBool(DISABLE_INDEX);
2822 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2823 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2824 // case where DISABLE_INDEX=NO & GENERATE_TREEVIEW=YES & FULL_SIDEBAR=YES has search box in the side panel
2825 if (searchEngine)
2826 {
2827 t << " <li>\n";
2828 if (disableIndex || !generateTreeView || !fullSidebar)
2829 {
2830 if (!serverBasedSearch) // pure client side search
2831 {
2832 writeClientSearchBox(t,relPath);
2833 t << " </li>\n";
2834 }
2835 else // server based search
2836 {
2837 writeServerSearchBox(t,relPath,highlightSearch);
2838 if (!highlightSearch)
2839 {
2840 t << " </li>\n";
2841 }
2842 }
2843 }
2844 else
2845 {
2846 t << " </li>\n";
2847 }
2848 }
2849 if (!highlightSearch || Config_getBool(FULL_SIDEBAR))
2850 // on the search page the index will be ended by the page itself if the search box is part of the navigation bar
2851 {
2853 }
2854 }
2855 else // normal case for other rows than first one
2856 {
2858 }
2859 }
2860 }
2861}
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1435
static void endQuickIndexList(TextStream &t)
Definition htmlgen.cpp:2674
static void startQuickIndexList(TextStream &t, bool topLevel=TRUE)
Definition htmlgen.cpp:2654
static void startQuickIndexItem(TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
Definition htmlgen.cpp:2687
static void renderQuickLinksAsTabs(TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
Definition htmlgen.cpp:2783
static void endQuickIndexItem(TextStream &t, const QCString &l)
Definition htmlgen.cpp:2701
static bool quickLinkVisible(LayoutNavEntry::Kind kind)
Definition htmlgen.cpp:2708
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()

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

Definition at line 2754 of file htmlgen.cpp.

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

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

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

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

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

Referenced by renderQuickLinksAsTabs().

◆ startQuickIndexList()

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

Definition at line 2654 of file htmlgen.cpp.

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

References Config_getBool, and TRUE.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ startSectionContent()

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

Definition at line 1977 of file htmlgen.cpp.

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

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

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

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

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

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

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

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

Definition at line 74 of file htmlgen.cpp.

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

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

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

static void writeDefaultStyleSheet ( TextStream & t)
static

Definition at line 1389 of file htmlgen.cpp.

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

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

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

References Config_getBool, Doxygen::htmlFileExtension, and theTranslator.

Referenced by getSearchBox(), and renderQuickLinksAsTabs().

Variable Documentation

◆ g_darkMap

StringUnorderedMap g_darkMap
static

Definition at line 631 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_footer

◆ g_header

◆ g_indexLock

std::mutex g_indexLock
static

Definition at line 1464 of file htmlgen.cpp.

Referenced by HtmlGenerator::startFile().

◆ g_latex_macro

QCString g_latex_macro
static

Definition at line 67 of file htmlgen.cpp.

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

◆ g_lightMap

StringUnorderedMap g_lightMap
static

Definition at line 630 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_mathjax_code

QCString g_mathjax_code
static

Definition at line 66 of file htmlgen.cpp.

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

◆ hex

auto hex ="0123456789ABCDEF"
staticconstexpr

Definition at line 68 of file htmlgen.cpp.

◆ htmlMarkerInfo

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

Definition at line 70 of file htmlgen.cpp.

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

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