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 "fileinfo.h"
#include "dir.h"
#include "utf8.h"
#include "textstream.h"
#include "indexlist.h"
#include "datetime.h"
#include "portable.h"
#include "outputlist.h"
#include "stringutil.h"
Include dependency graph for htmlgen.cpp:

Go to the source code of this file.

Macros

#define DBG_HTML(x)

Functions

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

Variables

static QCString g_header
static QCString g_header_file
static QCString g_footer_file
static QCString g_footer
static QCString g_mathjax_code
static QCString g_latex_macro
static bool g_build_date = false
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()

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

Definition at line 2773 of file htmlgen.cpp.

2774{
2775 t << "</span>";
2776 if (!l.isEmpty()) t << "</a>";
2777 t << "</li>\n";
2778}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163

References QCString::isEmpty().

Referenced by renderQuickLinksAsTabs().

◆ endQuickIndexList()

void endQuickIndexList ( TextStream & t)
static

Definition at line 2746 of file htmlgen.cpp.

2747{
2748 if (!Config_getBool(DISABLE_INDEX))
2749 {
2750 t << " </ul>\n";
2751 t << " </div>\n";
2752 }
2753 else
2754 {
2755 t << "</ul>\n";
2756 }
2757}
#define Config_getBool(name)
Definition config.h:33

References Config_getBool.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ endSectionContent()

void endSectionContent ( TextStream & t)
static

Definition at line 2056 of file htmlgen.cpp.

2057{
2058 //t << "<!-- endSectionContent -->";
2059 t << "</div>\n";
2060}

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

◆ endSectionHeader()

void endSectionHeader ( TextStream & t)
static

◆ endSectionSummary()

void endSectionSummary ( TextStream & t)
static

Definition at line 2030 of file htmlgen.cpp.

2031{
2032 //t << "<!-- endSectionSummary -->";
2033 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
2034 if (dynamicSections)
2035 {
2036 t << "</div>\n";
2037 }
2038}

References Config_getBool.

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

◆ fillColorStyleMap()

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

Definition at line 661 of file htmlgen.cpp.

662{
663 int p=0,i=0;
664 while ((i=definitions.find('\n',p))!=-1)
665 {
666 QCString line = definitions.mid(p,i-p);
667 if (line.startsWith("--"))
668 {
669 int separator = line.find(':');
670 assert(separator!=-1);
671 std::string key = line.left(separator).str();
672 int semi = line.findRev(';');
673 assert(semi!=-1);
674 std::string value = line.mid(separator+1,semi-separator-1).stripWhiteSpace().str();
675 map.emplace(key,value);
676 //printf("var(%s)=%s\n",qPrint(key),qPrint(value));
677 }
678 p=i+1;
679 }
680}
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:507
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:260
const std::string & str() const
Definition qcstring.h:552
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:96
QCString left(size_t len) const
Definition qcstring.h:229

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

Referenced by fillColorStyleMaps().

◆ fillColorStyleMaps()

void fillColorStyleMaps ( )
static

Definition at line 682 of file htmlgen.cpp.

683{
685 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
686 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
687 {
688 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("lightmode_settings.css")),g_lightMap);
689 }
690 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
691 {
692 fillColorStyleMap(replaceColorMarkers(mgr.getAsString("darkmode_settings.css")),g_darkMap);
693 }
694}
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:661
static StringUnorderedMap g_lightMap
Definition htmlgen.cpp:658
static StringUnorderedMap g_darkMap
Definition htmlgen.cpp:659
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:5758

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

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

◆ getConvertLatexMacro()

QCString getConvertLatexMacro ( )
static

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

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

MathJax syntax:

cmd: "{replacement}"

LaTeX syntax:

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

MathJax syntax:

cmd: ["{replacement}",nr]

Definition at line 149 of file htmlgen.cpp.

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

References FileInfo::absFilePath(), Config_getString, QCString::data(), fileToString(), QCString::isEmpty(), QCString::length(), literal_at(), QCString::reserve(), QCString::str(), and warn.

Referenced by HtmlGenerator::init().

◆ getSearchBox()

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

Definition at line 300 of file htmlgen.cpp.

301{
302 TextStream t;
303 if (serverSide)
304 {
305 writeServerSearchBox(t, relPath, highlightSearch);
306 }
307 else
308 {
309 writeClientSearchBox(t, relPath);
310 }
311 return t.str();
312}
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:216
static void writeServerSearchBox(TextStream &t, const QCString &relPath, bool highlightSearch)
Definition htmlgen.cpp:98
static void writeClientSearchBox(TextStream &t, const QCString &relPath)
Definition htmlgen.cpp:76

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

Referenced by substituteHtmlKeywords().

◆ hasDateReplacement()

bool hasDateReplacement ( const QCString & str)
static

Definition at line 1184 of file htmlgen.cpp.

1185{
1186 return (str.contains("$datetime",false) ||
1187 str.contains("$date",false) ||
1188 str.contains("$time",false) ||
1189 str.contains("$year",false)
1190 );
1191}
int contains(char c, bool cs=TRUE) const
Definition qcstring.cpp:148

References QCString::contains().

Referenced by HtmlGenerator::init().

◆ quickLinkVisible()

bool quickLinkVisible ( LayoutNavEntry::Kind kind)
static

Definition at line 2780 of file htmlgen.cpp.

2781{
2782 const auto &index = Index::instance();
2783 bool showNamespaces = Config_getBool(SHOW_NAMESPACES);
2784 bool showFiles = Config_getBool(SHOW_FILES);
2785 switch (kind)
2786 {
2787 case LayoutNavEntry::MainPage: return TRUE;
2788 case LayoutNavEntry::User: return TRUE;
2789 case LayoutNavEntry::UserGroup: return TRUE;
2790 case LayoutNavEntry::Pages: return index.numIndexedPages()>0;
2791 case LayoutNavEntry::Topics: return index.numDocumentedGroups()>0;
2792 case LayoutNavEntry::Modules: return index.numDocumentedModules()>0;
2793 case LayoutNavEntry::ModuleList: return index.numDocumentedModules()>0;
2794 case LayoutNavEntry::ModuleMembers: return index.numDocumentedModuleMembers(ModuleMemberHighlight::All)>0;
2795 case LayoutNavEntry::Namespaces: return showNamespaces && index.numDocumentedNamespaces()>0;
2796 case LayoutNavEntry::NamespaceList: return showNamespaces && index.numDocumentedNamespaces()>0;
2797 case LayoutNavEntry::NamespaceMembers: return showNamespaces && index.numDocumentedNamespaceMembers(NamespaceMemberHighlight::All)>0;
2798 case LayoutNavEntry::Concepts: return index.numDocumentedConcepts()>0;
2799 case LayoutNavEntry::Classes: return index.numAnnotatedClasses()>0;
2800 case LayoutNavEntry::ClassList: return index.numAnnotatedClasses()>0;
2801 case LayoutNavEntry::ClassIndex: return index.numAnnotatedClasses()>0;
2802 case LayoutNavEntry::ClassHierarchy: return index.numHierarchyClasses()>0;
2803 case LayoutNavEntry::ClassMembers: return index.numDocumentedClassMembers(ClassMemberHighlight::All)>0;
2804 case LayoutNavEntry::Files: return showFiles && index.numDocumentedFiles()>0;
2805 case LayoutNavEntry::FileList: return showFiles && index.numDocumentedFiles()>0;
2806 case LayoutNavEntry::FileGlobals: return showFiles && index.numDocumentedFileMembers(FileMemberHighlight::All)>0;
2807 case LayoutNavEntry::Examples: return !Doxygen::exampleLinkedMap->empty();
2808 case LayoutNavEntry::Interfaces: return index.numAnnotatedInterfaces()>0;
2809 case LayoutNavEntry::InterfaceList: return index.numAnnotatedInterfaces()>0;
2810 case LayoutNavEntry::InterfaceIndex: return index.numAnnotatedInterfaces()>0;
2811 case LayoutNavEntry::InterfaceHierarchy: return index.numHierarchyInterfaces()>0;
2812 case LayoutNavEntry::Structs: return index.numAnnotatedStructs()>0;
2813 case LayoutNavEntry::StructList: return index.numAnnotatedStructs()>0;
2814 case LayoutNavEntry::StructIndex: return index.numAnnotatedStructs()>0;
2815 case LayoutNavEntry::Exceptions: return index.numAnnotatedExceptions()>0;
2816 case LayoutNavEntry::ExceptionList: return index.numAnnotatedExceptions()>0;
2817 case LayoutNavEntry::ExceptionIndex: return index.numAnnotatedExceptions()>0;
2818 case LayoutNavEntry::ExceptionHierarchy: return index.numHierarchyExceptions()>0;
2819 case LayoutNavEntry::None: // should never happen, means not properly initialized
2820 assert(kind != LayoutNavEntry::None);
2821 return FALSE;
2822 }
2823 return FALSE;
2824}
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:98
static Index & instance()
Definition index.cpp:106
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

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

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

◆ renderQuickLinksAsTabs()

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

Definition at line 2855 of file htmlgen.cpp.

2858{
2859 if (hlEntry->parent()) // first draw the tabs for the parent of hlEntry
2860 {
2861 renderQuickLinksAsTabs(t,relPath,hlEntry->parent(),kind,highlightParent,highlightSearch);
2862 }
2863 if (hlEntry->parent() && !hlEntry->parent()->children().empty()) // draw tabs for row containing hlEntry
2864 {
2865 bool topLevel = hlEntry->parent()->parent()==nullptr;
2866 int count=0;
2867 for (const auto &entry : hlEntry->parent()->children())
2868 {
2869 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2870 }
2871 if (count>0) // at least one item is visible
2872 {
2873 startQuickIndexList(t,topLevel);
2874 for (const auto &entry : hlEntry->parent()->children())
2875 {
2876 if (entry->visible() && quickLinkVisible(entry->kind()))
2877 {
2878 QCString url = entry->url();
2879 startQuickIndexItem(t,url,
2880 entry.get()==hlEntry &&
2881 (!entry->children().empty() ||
2882 (entry->kind()==kind && !highlightParent)
2883 ),
2884 TRUE,relPath);
2885 t << fixSpaces(entry->title());
2886 endQuickIndexItem(t,url);
2887 }
2888 }
2889 if (hlEntry->parent()==LayoutDocManager::instance().rootNavEntry()) // first row is special as it contains the search box
2890 {
2891 bool searchEngine = Config_getBool(SEARCHENGINE);
2892 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2893 bool disableIndex = Config_getBool(DISABLE_INDEX);
2894 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2895 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2896 // case where DISABLE_INDEX=NO & GENERATE_TREEVIEW=YES & FULL_SIDEBAR=YES has search box in the side panel
2897 if (searchEngine)
2898 {
2899 t << " <li>\n";
2900 if (disableIndex || !generateTreeView || !fullSidebar)
2901 {
2902 if (!serverBasedSearch) // pure client side search
2903 {
2904 writeClientSearchBox(t,relPath);
2905 t << " </li>\n";
2906 }
2907 else // server based search
2908 {
2909 writeServerSearchBox(t,relPath,highlightSearch);
2910 if (!highlightSearch)
2911 {
2912 t << " </li>\n";
2913 }
2914 }
2915 }
2916 else
2917 {
2918 t << " </li>\n";
2919 }
2920 }
2921 if (!highlightSearch || Config_getBool(FULL_SIDEBAR))
2922 // on the search page the index will be ended by the page itself if the search box is part of the navigation bar
2923 {
2925 }
2926 }
2927 else // normal case for other rows than first one
2928 {
2930 }
2931 }
2932 }
2933}
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1437
static void endQuickIndexList(TextStream &t)
Definition htmlgen.cpp:2746
static void startQuickIndexList(TextStream &t, bool topLevel=TRUE)
Definition htmlgen.cpp:2726
static void startQuickIndexItem(TextStream &t, const QCString &l, bool hl, bool, const QCString &relPath)
Definition htmlgen.cpp:2759
static void renderQuickLinksAsTabs(TextStream &t, const QCString &relPath, LayoutNavEntry *hlEntry, LayoutNavEntry::Kind kind, bool highlightParent, bool highlightSearch)
Definition htmlgen.cpp:2855
static void endQuickIndexItem(TextStream &t, const QCString &l)
Definition htmlgen.cpp:2773
static bool quickLinkVisible(LayoutNavEntry::Kind kind)
Definition htmlgen.cpp:2780
const LayoutNavEntryList & children() const
Definition layout.h:219
LayoutNavEntry * parent() const
Definition layout.h:212
QCString fixSpaces(const QCString &s)
Definition util.h:469

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

Referenced by renderQuickLinksAsTabs(), and writeDefaultQuickLinks().

◆ renderQuickLinksAsTree()

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

Definition at line 2826 of file htmlgen.cpp.

2828{
2829 int count=0;
2830 for (const auto &entry : root->children())
2831 {
2832 if (entry->visible() && quickLinkVisible(entry->kind())) count++;
2833 }
2834 if (count>0) // at least one item is visible
2835 {
2837 for (const auto &entry : root->children())
2838 {
2839 if (entry->visible() && quickLinkVisible(entry->kind()))
2840 {
2841 QCString url = entry->url();
2842 t << "<li><a href=\"" << relPath << url << "\"><span>";
2843 t << fixSpaces(entry->title());
2844 t << "</span></a>\n";
2845 // recursive into child list
2846 renderQuickLinksAsTree(t,relPath,entry.get());
2847 t << "</li>";
2848 }
2849 }
2851 }
2852}
static void renderQuickLinksAsTree(TextStream &t, const QCString &relPath, LayoutNavEntry *root)
Definition htmlgen.cpp:2826

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

Referenced by renderQuickLinksAsTree(), and writeDefaultQuickLinks().

◆ replaceVariables()

QCString replaceVariables ( const QCString & input)
static

Definition at line 696 of file htmlgen.cpp.

697{
698 auto doReplacements = [&input](const StringUnorderedMap &mapping) -> QCString
699 {
700 QCString result;
701 result.reserve(input.length());
702 int p=0,i=0;
703 while ((i=input.find("var(",p))!=-1)
704 {
705 result+=input.mid(p,i-p);
706 int j=input.find(")",i+4);
707 assert(j!=-1);
708 auto it = mapping.find(input.mid(i+4,j-i-4).str()); // find variable
709 if (it==mapping.end())
710 { // should be found
711 err("failed to find value variable {}. It is not longer defined in doxygen.css\n",input.mid(i+4,j-i-4));
712 }
713 else
714 {
715 //printf("replace '%s' by '%s'\n",qPrint(input.mid(i+4,j-i-4)),qPrint(it->second));
716 result+=it->second; // add it value
717 }
718 p=j+1;
719 }
720 result+=input.mid(p,input.length()-p);
721 return result;
722 };
723
724 auto colorStyle = Config_getEnum(HTML_COLORSTYLE);
725 if (colorStyle==HTML_COLORSTYLE_t::LIGHT)
726 {
727 return doReplacements(g_lightMap);
728 }
729 else if (colorStyle==HTML_COLORSTYLE_t::DARK)
730 {
731 return doReplacements(g_darkMap);
732 }
733 else
734 {
735 return input;
736 }
737}
std::unordered_map< std::string, std::string > StringUnorderedMap
Definition containers.h:28
#define err(fmt,...)
Definition message.h:127

References Config_getEnum, err, QCString::find(), g_darkMap, g_lightMap, QCString::length(), QCString::mid(), QCString::reserve(), and QCString::str().

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

◆ startQuickIndexItem()

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

Definition at line 2759 of file htmlgen.cpp.

2762{
2763 t << " <li";
2764 if (hl)
2765 {
2766 t << " class=\"current\"";
2767 }
2768 t << ">";
2769 if (!l.isEmpty()) t << "<a href=\"" << correctURL(l,relPath) << "\">";
2770 t << "<span>";
2771}
QCString correctURL(const QCString &url, const QCString &relPath)
Corrects URL url according to the relative path relPath.
Definition util.cpp:5877

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

Referenced by renderQuickLinksAsTabs().

◆ startQuickIndexList()

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

Definition at line 2726 of file htmlgen.cpp.

2727{
2728 if (!Config_getBool(DISABLE_INDEX))
2729 {
2730 if (topLevel)
2731 {
2732 t << " <div id=\"navrow1\" class=\"tabs\">\n";
2733 }
2734 else
2735 {
2736 t << " <div id=\"navrow2\" class=\"tabs2\">\n";
2737 }
2738 t << " <ul class=\"tablist\">\n";
2739 }
2740 else
2741 {
2742 t << "<ul>";
2743 }
2744}

References Config_getBool, and TRUE.

Referenced by renderQuickLinksAsTabs(), and renderQuickLinksAsTree().

◆ startSectionContent()

void startSectionContent ( TextStream & t,
int sectionCount )
static

Definition at line 2040 of file htmlgen.cpp.

2041{
2042 //t << "<!-- startSectionContent -->";
2043 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
2044 if (dynamicSections)
2045 {
2046 t << "<div id=\"dynsection-" << sectionCount << "-content\" "
2047 "class=\"dyncontent\" "
2048 "style=\"display:none;\">\n";
2049 }
2050 else
2051 {
2052 t << "<div class=\"dyncontent\">\n";
2053 }
2054}

References Config_getBool.

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

◆ startSectionHeader()

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

Definition at line 1993 of file htmlgen.cpp.

1995{
1996 //t << "<!-- startSectionHeader -->";
1997 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
1998 if (dynamicSections)
1999 {
2000 t << "<div id=\"dynsection-" << sectionCount << "\" "
2001 "onclick=\"return dynsection.toggleVisibility(this)\" "
2002 "class=\"dynheader closed\" "
2003 "style=\"cursor:pointer;\">"
2004 "<span class=\"dynarrow\"><span class=\"arrowhead closed\"></span></span>";
2005 }
2006 else
2007 {
2008 t << "<div class=\"dynheader\">\n";
2009 }
2010}

References Config_getBool.

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

◆ startSectionSummary()

void startSectionSummary ( TextStream & t,
int sectionCount )
static

Definition at line 2018 of file htmlgen.cpp.

2019{
2020 //t << "<!-- startSectionSummary -->";
2021 bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS);
2022 if (dynamicSections)
2023 {
2024 t << "<div id=\"dynsection-" << sectionCount << "-summary\" "
2025 "class=\"dynsummary\" "
2026 "style=\"display:block;\">\n";
2027 }
2028}

References Config_getBool.

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

◆ substituteHtmlKeywords()

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

Definition at line 314 of file htmlgen.cpp.

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

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

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

◆ writeClientSearchBox()

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

Definition at line 76 of file htmlgen.cpp.

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

References theTranslator.

Referenced by getSearchBox(), and renderQuickLinksAsTabs().

◆ writeDefaultQuickLinks()

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

Definition at line 2935 of file htmlgen.cpp.

2940{
2941 bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2942 bool searchEngine = Config_getBool(SEARCHENGINE);
2943 bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
2944 bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2945 bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2946 bool disableIndex = Config_getBool(DISABLE_INDEX);
2947 bool dynamicMenus = Config_getBool(HTML_DYNAMIC_MENUS);
2949 LayoutNavEntry::Kind kind = LayoutNavEntry::None;
2950 LayoutNavEntry::Kind altKind = LayoutNavEntry::None; // fall back for the old layout file
2951 bool highlightParent=false;
2952 switch (hli) // map HLI enums to LayoutNavEntry::Kind enums
2953 {
2954 case HighlightedItem::Main: kind = LayoutNavEntry::MainPage; break;
2955 case HighlightedItem::Topics: kind = LayoutNavEntry::Topics; break;
2956 case HighlightedItem::Modules: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules; break;
2957 case HighlightedItem::Namespaces: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; break;
2958 case HighlightedItem::ClassHierarchy: kind = LayoutNavEntry::ClassHierarchy; break;
2959 case HighlightedItem::InterfaceHierarchy: kind = LayoutNavEntry::InterfaceHierarchy; break;
2960 case HighlightedItem::ExceptionHierarchy: kind = LayoutNavEntry::ExceptionHierarchy; break;
2961 case HighlightedItem::Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break;
2962 case HighlightedItem::Concepts: kind = LayoutNavEntry::Concepts; break;
2963 case HighlightedItem::Interfaces: kind = LayoutNavEntry::InterfaceIndex; altKind = LayoutNavEntry::Interfaces; break;
2964 case HighlightedItem::Structs: kind = LayoutNavEntry::StructIndex; altKind = LayoutNavEntry::Structs; break;
2965 case HighlightedItem::Exceptions: kind = LayoutNavEntry::ExceptionIndex; altKind = LayoutNavEntry::Exceptions; break;
2966 case HighlightedItem::AnnotatedClasses: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break;
2967 case HighlightedItem::AnnotatedInterfaces: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces; break;
2968 case HighlightedItem::AnnotatedStructs: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs; break;
2969 case HighlightedItem::AnnotatedExceptions: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions; break;
2970 case HighlightedItem::Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break;
2971 case HighlightedItem::NamespaceMembers: kind = LayoutNavEntry::NamespaceMembers; break;
2972 case HighlightedItem::ModuleMembers: kind = LayoutNavEntry::ModuleMembers; break;
2973 case HighlightedItem::Functions: kind = LayoutNavEntry::ClassMembers; break;
2974 case HighlightedItem::Globals: kind = LayoutNavEntry::FileGlobals; break;
2975 case HighlightedItem::Pages: kind = LayoutNavEntry::Pages; break;
2976 case HighlightedItem::Examples: kind = LayoutNavEntry::Examples; break;
2977 case HighlightedItem::UserGroup: kind = LayoutNavEntry::UserGroup; break;
2978 case HighlightedItem::ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes;
2979 highlightParent = true; break;
2980 case HighlightedItem::ConceptVisible: kind = LayoutNavEntry::Concepts;
2981 highlightParent = true; break;
2982 case HighlightedItem::ModuleVisible: kind = LayoutNavEntry::ModuleList; altKind = LayoutNavEntry::Modules;
2983 highlightParent = true; break;
2984 case HighlightedItem::InterfaceVisible: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces;
2985 highlightParent = true; break;
2986 case HighlightedItem::StructVisible: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs;
2987 highlightParent = true; break;
2988 case HighlightedItem::ExceptionVisible: kind = LayoutNavEntry::ExceptionList; altKind = LayoutNavEntry::Exceptions;
2989 highlightParent = true; break;
2990 case HighlightedItem::NamespaceVisible: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces;
2991 highlightParent = true; break;
2992 case HighlightedItem::FileVisible: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files;
2993 highlightParent = true; break;
2994 case HighlightedItem::None: break;
2995 case HighlightedItem::Search: break;
2996 }
2997
2998 if (!disableIndex && dynamicMenus)
2999 {
3000 QCString searchPage;
3001 if (externalSearch)
3002 {
3003 searchPage = "search" + Doxygen::htmlFileExtension;
3004 }
3005 else
3006 {
3007 searchPage = "search.php";
3008 }
3009 t << "<script type=\"text/javascript\" src=\"" << relPath << "menudata.js\"></script>\n";
3010 t << "<script type=\"text/javascript\" src=\"" << relPath << "menu.js\"></script>\n";
3011 t << "<script type=\"text/javascript\">\n";
3012 t << "$(function() {\n";
3013 t << " initMenu('" << relPath << "',"
3014 << (searchEngine && !(generateTreeView && fullSidebar)?"true":"false") << ","
3015 << (serverBasedSearch?"true":"false") << ",'"
3016 << searchPage << "','"
3017 << theTranslator->trSearch() << "',"
3018 << (generateTreeView?"true":"false")
3019 << ");\n";
3020 if (searchEngine)
3021 {
3022 if (!serverBasedSearch)
3023 {
3024 if (!disableIndex && dynamicMenus && !fullSidebar)
3025 {
3026 t << " $(function() { init_search(); });\n";
3027 }
3028 }
3029 else
3030 {
3031 t << " $(function() {\n"
3032 << " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n";
3033 t << " });\n";
3034 }
3035 }
3036 t << "});\n";
3037 t << "</script>\n";
3038 t << "<div id=\"main-nav\"></div>\n";
3039 }
3040 else if (!disableIndex) // && !Config_getBool(HTML_DYNAMIC_MENUS)
3041 {
3042 // find highlighted index item
3043 LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : QCString());
3044 if (!hlEntry && altKind!=LayoutNavEntry::None) { hlEntry=root->find(altKind); kind=altKind; }
3045 if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index...
3046 {
3047 highlightParent=TRUE;
3048 hlEntry = root->children().front().get();
3049 if (hlEntry==nullptr)
3050 {
3051 return; // argl, empty index!
3052 }
3053 }
3054 if (kind==LayoutNavEntry::UserGroup)
3055 {
3056 LayoutNavEntry *e = hlEntry->children().front().get();
3057 if (e)
3058 {
3059 hlEntry = e;
3060 }
3061 }
3062 t << "<div id=\"main-nav\">\n";
3063 renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HighlightedItem::Search);
3064 if (!extraTabs)
3065 {
3066 t << "</div><!-- main-nav -->\n";
3067 }
3068 }
3069 else if (!generateTreeView)
3070 {
3071 renderQuickLinksAsTree(t,relPath,root);
3072 }
3073 if (generateTreeView && !disableIndex && fullSidebar && !extraTabs)
3074 {
3075 t << "<div id=\"container\"><div id=\"doc-content\">\n";
3076 }
3077}
static QCString htmlFileExtension
Definition doxygen.h:121
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition layout.cpp:1448
@ AnnotatedExceptions
Definition index.h:76
@ InterfaceVisible
Definition index.h:89
@ InterfaceHierarchy
Definition index.h:66
@ AnnotatedInterfaces
Definition index.h:74
@ NamespaceMembers
Definition index.h:78
@ AnnotatedClasses
Definition index.h:73
@ AnnotatedStructs
Definition index.h:75
@ ExceptionVisible
Definition index.h:91
@ NamespaceVisible
Definition index.h:92
@ ExceptionHierarchy
Definition index.h:67
Base class for the layout of a navigation item at the top of the HTML pages.
Definition layout.h:156
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
Definition layout.cpp:133
Kind
Definition layout.h:193

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

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

◆ writeDefaultStyleSheet()

void writeDefaultStyleSheet ( TextStream & t)
static

Definition at line 1398 of file htmlgen.cpp.

1399{
1400 t << "/* The standard CSS for doxygen " << getDoxygenVersion() << "*/\n\n";
1401 switch (Config_getEnum(HTML_COLORSTYLE))
1402 {
1403 case HTML_COLORSTYLE_t::LIGHT:
1404 case HTML_COLORSTYLE_t::DARK:
1405 /* variables will be resolved while writing to the CSS file */
1406 break;
1407 case HTML_COLORSTYLE_t::AUTO_LIGHT:
1408 case HTML_COLORSTYLE_t::TOGGLE:
1409 t << "html {\n";
1410 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1411 t << "}\n\n";
1412 break;
1413 case HTML_COLORSTYLE_t::AUTO_DARK:
1414 t << "html {\n";
1415 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1416 t << "}\n\n";
1417 break;
1418 }
1419 if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_LIGHT)
1420 {
1421 t << "@media (prefers-color-scheme: dark) {\n";
1422 t << " html:not(.dark-mode) {\n";
1423 t << " color-scheme: dark;\n\n";
1424 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1425 t << "}}\n";
1426 }
1427 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::AUTO_DARK)
1428 {
1429 t << "@media (prefers-color-scheme: light) {\n";
1430 t << " html:not(.light-mode) {\n";
1431 t << " color-scheme: light;\n\n";
1432 t << replaceColorMarkers(ResourceMgr::instance().getAsString("lightmode_settings.css"));
1433 t << "}}\n";
1434 }
1435 else if (Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE)
1436 {
1437 t << "html.dark-mode {\n";
1438 t << replaceColorMarkers(ResourceMgr::instance().getAsString("darkmode_settings.css"));
1439 t << "}\n\n";
1440 }
1441
1442 QCString cssStr = ResourceMgr::instance().getAsString("doxygen.css");
1443 bool hasFullSidebar = Config_getBool(FULL_SIDEBAR) && Config_getBool(GENERATE_TREEVIEW);
1444 if (hasFullSidebar)
1445 {
1446 cssStr+="\n"
1447 "#titlearea {\n"
1448 " border-bottom: none;\n"
1449 " background-color: var(--nav-background-color);\n"
1450 " border-right: 1px solid var(--nav-border-color);\n"
1451 "}\n";
1452 }
1453 t << replaceVariables(cssStr);
1454
1455 bool addTimestamp = Config_getEnum(TIMESTAMP)!=TIMESTAMP_t::NO;
1456 if (g_build_date || addTimestamp)
1457 {
1458 t << "\nhtml {\n";
1459
1460 if (addTimestamp)
1461 {
1462 QCString timeStampStr;
1463 switch (Config_getEnum(TIMESTAMP))
1464 {
1465 case TIMESTAMP_t::YES:
1466 case TIMESTAMP_t::DATETIME:
1467 timeStampStr = dateToString(DateTimeType::DateTime);
1468 break;
1469 case TIMESTAMP_t::DATE:
1470 timeStampStr = dateToString(DateTimeType::Date);
1471 break;
1472 default:
1473 break;
1474 }
1475 t << "--timestamp: '" << timeStampStr << "';\n";
1476 }
1477 if (g_build_date)
1478 {
1479 t << "--datetime: '" << dateToString(DateTimeType::DateTime) << "';\n";
1480 t << "--date: '" << dateToString(DateTimeType::Date) << "';\n";
1481 t << "--time: '" << dateToString(DateTimeType::Time) << "';\n";
1482 t << "--year: '" << yearToString() << "';\n";
1483 }
1484 t << "}\n";
1485
1486 if (addTimestamp)
1487 {
1488 t << "span.timestamp { content: ' '; }\n";
1489 t << "span.timestamp:before { content: var(--timestamp); }\n\n";
1490 }
1491 if (g_build_date)
1492 {
1493 t << "span.datetime { content: ' '; }\n";
1494 t << "span.datetime:before { content: var(--datetime); }\n\n";
1495 t << "span.date { content: ' '; }\n";
1496 t << "span.date:before { content: var(--date); }\n\n";
1497 t << "span.time { content: ' '; }\n";
1498 t << "span.time:before { content: var(--time); }\n\n";
1499 t << "span.year { content: ' '; }\n";
1500 t << "span.year:before { content: var(--year); }\n\n";
1501 }
1502 }
1503
1504 // For Webkit based the scrollbar styling cannot be overruled (bug in chromium?).
1505 // To allow the user to style the scrollbars differently we should only add it in case
1506 // the user did not specify any extra stylesheets.
1507 bool addScrollbarStyling = Config_getList(HTML_EXTRA_STYLESHEET).empty();
1508 if (addScrollbarStyling)
1509 {
1510 t << replaceVariables(ResourceMgr::instance().getAsString("scrollbar.css"));
1511 }
1512
1513}
QCString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
Definition datetime.cpp:62
QCString yearToString()
Returns the current year as a string.
Definition datetime.cpp:75
static bool g_build_date
Definition htmlgen.cpp:69
static QCString replaceVariables(const QCString &input)
Definition htmlgen.cpp:696

References Config_getBool, Config_getEnum, Config_getList, Date, DateTime, dateToString(), g_build_date, ResourceMgr::getAsString(), ResourceMgr::instance(), replaceColorMarkers(), replaceVariables(), Time, and yearToString().

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

◆ writeServerSearchBox()

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

Definition at line 98 of file htmlgen.cpp.

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

References Config_getBool, Doxygen::htmlFileExtension, and theTranslator.

Referenced by getSearchBox(), and renderQuickLinksAsTabs().

Variable Documentation

◆ g_build_date

bool g_build_date = false
static

Definition at line 69 of file htmlgen.cpp.

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

◆ g_darkMap

StringUnorderedMap g_darkMap
static

Definition at line 659 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_footer

◆ g_footer_file

◆ g_header

◆ g_header_file

◆ g_indexLock

std::mutex g_indexLock
static

Definition at line 1533 of file htmlgen.cpp.

Referenced by HtmlGenerator::startFile().

◆ g_latex_macro

QCString g_latex_macro
static

Definition at line 68 of file htmlgen.cpp.

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

◆ g_lightMap

StringUnorderedMap g_lightMap
static

Definition at line 658 of file htmlgen.cpp.

Referenced by fillColorStyleMaps(), and replaceVariables().

◆ g_mathjax_code

QCString g_mathjax_code
static

Definition at line 67 of file htmlgen.cpp.

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

◆ hex

auto hex ="0123456789ABCDEF"
staticconstexpr

Definition at line 70 of file htmlgen.cpp.

◆ htmlMarkerInfo

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

Definition at line 72 of file htmlgen.cpp.

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

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