Skip to content

Commit

Permalink
Better align template based output with the built-in output
Browse files Browse the repository at this point in the history
  • Loading branch information
doxygen committed Jun 26, 2021
1 parent b282a6c commit e12e557
Show file tree
Hide file tree
Showing 20 changed files with 186 additions and 99 deletions.
167 changes: 107 additions & 60 deletions src/context.cpp

Large diffs are not rendered by default.

28 changes: 21 additions & 7 deletions src/context.h
Expand Up @@ -549,15 +549,28 @@ class ClassHierarchyContext : public RefCountedContext, public TemplateStructInt

//----------------------------------------------------

enum class ContextTreeType
{
Namespace, // NamespaceTreeContext
ClassInheritance, // ClassHierarchyContext
ClassNesting, // ClassTreeContext
Module, // ModuleTreeContext
File, // FileTreeContext
Page, // PageTreeContext
Concept, // ContextTreeContext
Example // ExampleTreeContext
};

class NestingNodeContext : public RefCountedContext, public TemplateStructIntf
{
public:
static NestingNodeContext *alloc(const NestingNodeContext *parent,const Definition *def,
static NestingNodeContext *alloc(const NestingNodeContext *parent,ContextTreeType type,
const Definition *def,
int index,int level,
bool useFullName, bool addClasses,bool addConcepts,
bool addClasses,bool addConcepts,
bool inherit,bool hideSuper,
ClassDefSet &visitedClasses)
{ return new NestingNodeContext(parent,def,index,level,useFullName,addClasses,addConcepts,
{ return new NestingNodeContext(parent,type,def,index,level,addClasses,addConcepts,
inherit,hideSuper,visitedClasses); }

QCString id() const;
Expand All @@ -570,8 +583,9 @@ class NestingNodeContext : public RefCountedContext, public TemplateStructIntf

private:
NestingNodeContext(const NestingNodeContext *parent,
ContextTreeType type,
const Definition *,int index,int level,
bool useFullName, bool addClasses,bool addConcepts,
bool addClasses,bool addConcepts,
bool inherit,bool hideSuper,
ClassDefSet &visitedClasses);
~NestingNodeContext();
Expand All @@ -585,8 +599,8 @@ class NestingContext : public RefCountedContext, public TemplateListIntf
{
public:

static NestingContext *alloc(const NestingNodeContext *parent,int level,bool useFullName)
{ return new NestingContext(parent,level,useFullName); }
static NestingContext *alloc(const NestingNodeContext *parent,ContextTreeType type,int level)
{ return new NestingContext(parent,type,level); }

// TemplateListIntf
virtual uint count() const;
Expand Down Expand Up @@ -614,7 +628,7 @@ class NestingContext : public RefCountedContext, public TemplateListIntf
void addMembers(const MemberList *ml,ClassDefSet &visitedClasses);

private:
NestingContext(const NestingNodeContext *parent,int level,bool useFullName);
NestingContext(const NestingNodeContext *parent,ContextTreeType type,int level);
~NestingContext();
class Private;
Private *p;
Expand Down
6 changes: 3 additions & 3 deletions src/index.cpp
Expand Up @@ -318,12 +318,12 @@ static void writeMemberToIndex(const Definition *def,const MemberDef *md,bool ad
if (emd->getOuterScope()==def || emd->getOuterScope()==Doxygen::globalScope)
{
Doxygen::indexList->addContentsItem(FALSE,
emd->name(),emd->getReference(),emd->getOutputFileBase(),emd->anchor(),FALSE,addToIndex);
emd->name(),emd->getReference(),emd->getOutputFileBase(),emd->anchor(),FALSE,addToIndex && emd->getGroupDef()==nullptr);
}
else // inherited member
{
Doxygen::indexList->addContentsItem(FALSE,
emd->name(),def->getReference(),def->getOutputFileBase(),emd->anchor(),FALSE,addToIndex);
emd->name(),def->getReference(),def->getOutputFileBase(),emd->anchor(),FALSE,addToIndex && emd->getGroupDef()==nullptr);
}
}
}
Expand Down Expand Up @@ -1586,7 +1586,7 @@ static void writeClassTree(const ListType &cl,FTVHelp *ftv,bool addToIndex,bool
}
}

static int countVisibleMembers(const NamespaceDef *nd)
int countVisibleMembers(const NamespaceDef *nd)
{
int count=0;
for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace))
Expand Down
3 changes: 3 additions & 0 deletions src/index.h
Expand Up @@ -24,6 +24,7 @@

class Definition;
class DefinitionMutable;
class NamespaceDef;
class MemberDef;
class OutputList;

Expand Down Expand Up @@ -269,4 +270,6 @@ void addNamespaceMemberNameToIndex(const MemberDef *md);
void sortMemberIndexLists();
QCString fixSpaces(const QCString &s);

int countVisibleMembers(const NamespaceDef *nd);

#endif
20 changes: 15 additions & 5 deletions src/memberdef.cpp
Expand Up @@ -1782,10 +1782,10 @@ void MemberDefImpl::writeLink(OutputList &ol,
const NamespaceDef *nspace = getNamespaceDef();
if (!hideScopeNames)
{
//if (m_impl->enumScope && m_impl->livesInsideEnum)
//{
// n.prepend(m_impl->enumScope->displayName()+sep);
//}
if (m_impl->enumScope && m_impl->livesInsideEnum && getGroupDef()!=0)
{
n.prepend(m_impl->enumScope->displayName()+sep);
}
if (classDef && gd && !isRelated())
{
n.prepend(classDef->displayName()+sep);
Expand Down Expand Up @@ -1984,6 +1984,17 @@ bool MemberDefImpl::isBriefSectionVisible() const
QCString MemberDefImpl::getDeclType() const
{
QCString ltype(m_impl->type);
if (isEnumerate() && isStrong())
{
if (isEnumStruct())
{
ltype+=" struct";
}
else
{
ltype+=" class";
}
}
if (isTypedef() && getLanguage() != SrcLangExt_Slice)
{
ltype.prepend("typedef ");
Expand Down Expand Up @@ -2083,7 +2094,6 @@ void MemberDefImpl::writeDeclaration(OutputList &ol,

// start a new member declaration
bool isAnonType = annoClassDef || m_impl->annMemb || m_impl->annEnumType;
///printf("startMemberItem for %s\n",qPrint(name()));
ol.startMemberItem(anchor(),
isAnonType ? 1 : !m_impl->tArgList.empty() ? 3 : 0,
inheritId
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlannotated.tpl
Expand Up @@ -6,7 +6,7 @@
</div>
{% indexentry nav name=tr.classList file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %}
{% opensubindex nav %}
{% with tree=classTree %}
{% with tree=classTree treeType='ClassNesting' %}
{% include 'htmldirtree.tpl' %}
{% endwith %}
{% closesubindex nav %}
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlbase.tpl
Expand Up @@ -163,7 +163,7 @@ MathJax.Hub.Config({
{% endblock %}

{% block tabs %}
{% if config.HTML_DYNAMIC_MENUS %}
{% if not config.DISABLE_INDEX and config.HTML_DYNAMIC_MENUS %}
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlconcepts.tpl
Expand Up @@ -6,7 +6,7 @@
</div>
{% indexentry nav name=tr.concepts file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %}
{% opensubindex nav %}
{% with tree=conceptTree %}
{% with tree=conceptTree treeType='Concept' %}
{% include 'htmldirtree.tpl' %}
{% endwith %}
{% closesubindex nav %}
Expand Down
13 changes: 11 additions & 2 deletions templates/html/htmldirtree.tpl
Expand Up @@ -11,8 +11,9 @@
{# the table with entries #}
<table class="directory">
{% recursetree tree.tree %}
{% set addIdx=node.partOfGroup==False or treeType=='Module' %}
{% if node.isLinkable %}
{% indexentry nav name=node.name file=node.fileName anchor=node.anchor isReference=node.isReference externalReference=node.externalReference separateIndex=node.is_leaf_node==False addToIndex=node.partOfGroup==False %}
{% indexentry nav name=node.name file=node.fileName anchor=node.anchor isReference=node.isReference externalReference=node.externalReference separateIndex=node.is_leaf_node==False addToIndex=addIdx %}
{% else %}
{% indexentry nav name=node.name file='' anchor=node.anchor isReference=False separateIndex=False addToIndex=False %}
{% endif %}
Expand Down Expand Up @@ -56,7 +57,15 @@
{% if node.members %}
{% opensubindex nav %}
{% for member in node.members %}
{% indexentry nav name=member.name file=member.fileName anchor=member.anchor isReference=member.isReference externalReference=member.externalReference separateIndex=False addToIndex=member.partOfGroup==False %}
{% set addIdx=member.partOfGroup==False or treeType=='Module' %}
{% indexentry nav name=member.name file=member.fileName anchor=member.anchor isReference=member.isReference externalReference=member.externalReference separateIndex=False addToIndex=addIdx %}
{% if member.members %}
{% opensubindex nav %}
{% for enumVal in member.members %}
{% indexentry nav name=enumVal.name file=enumVal.fileName anchor=enumVal.anchor isReference=enumVal.isReference externalReference=enumVal.externalReference separateIndex=False addToIndex=addIdx %}
{% endfor %}
{% closesubindex nav %}
{% endif %}
{% endfor %}
{% closesubindex nav %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlexamples.tpl
Expand Up @@ -6,7 +6,7 @@
</div>
{% indexentry nav name=tr.examples file=page.fileName anchor='' isReference=False separateIndex=False addToIndex=True %}
{% opensubindex nav %}
{% with tree=exampleTree %}
{% with tree=exampleTree treeType='Example' %}
{% include 'htmldirtree.tpl' %}
{% endwith %}
{% closesubindex nav %}
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlfiles.tpl
Expand Up @@ -6,7 +6,7 @@
</div>
{% indexentry nav name=tr.fileList file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %}
{% opensubindex nav %}
{% with tree=fileTree %}
{% with tree=fileTree treeType='File' %}
{% include 'htmldirtree.tpl' %}
{% endwith %}
{% closesubindex nav %}
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlhierarchy.tpl
Expand Up @@ -9,7 +9,7 @@
</div>
{% indexentry nav name=tr.classHierarchy file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %}
{% opensubindex nav %}
{% with tree=classHierarchy %}
{% with tree=classHierarchy treeType='ClassInheritance' %}
{% include 'htmldirtree.tpl' %}
{% endwith %}
{% closesubindex nav %}
Expand Down
8 changes: 4 additions & 4 deletions templates/html/htmljsmenudata.tpl
Expand Up @@ -30,14 +30,14 @@ var menudata={children:[
{% if moduleTree.tree %}
,{text:"{{ tr.modules }}",url:"modules{{ config.HTML_FILE_EXTENSION }}"}
{% endif %}
{% if conceptList %}
{% if conceptTree.tree %}
,{text:"{{ tr.concepts }}",url:"concepts{{ config.HTML_FILE_EXTENSION }}"}
{% endif %}
{% if namespaceList %}
,{text:"{{ tr.namespaces }}",url:'namespaces{{ config.HTML_FILE_EXTENSION }}",children:[
{text:"{{ tr.namespaceList }}",url:'namespaces{{ config.HTML_FILE_EXTENSION }}"}
,{text:"{{ tr.namespaces }}",url:"namespaces{{ config.HTML_FILE_EXTENSION }}",children:[
{text:"{{ tr.namespaceList }}",url:"namespaces{{ config.HTML_FILE_EXTENSION }}"}
{% if namespaceMembersIndex.all %}
,{text:"{{ tr.namespaceMembers }}",url:'namespacemembers{{ config.HTML_FILE_EXTENSION }}",children:[
,{text:"{{ tr.namespaceMembers }}",url:"namespacemembers{{ config.HTML_FILE_EXTENSION }}",children:[
{% with page=namespaceMembersIndex %}
{% include 'htmljsmenumembersdata.tpl' %}
{% endwith %}
Expand Down
2 changes: 2 additions & 0 deletions templates/html/htmllayout.tpl
Expand Up @@ -35,7 +35,9 @@
{% resource 'navtree.js' %}
{% resource 'resize.js' %}
{% endif %}
{% if not config.DISABLE_INDEX and config.HTML_DYNAMIC_MENUS %}
{% resource 'menu.js' %}
{% endif %}
{% resource 'doc.luma' %}
{% resource 'folderopen.luma' %}
{% resource 'folderclosed.luma' %}
Expand Down
4 changes: 2 additions & 2 deletions templates/html/htmlmemdecl.tpl
Expand Up @@ -14,7 +14,7 @@
{% endif %}
{# write optional indent #}
{% repeat anonymousNestingLevel %}&#160;&#160;&#160;{% endrepeat %}
enum&#160;</td><td class="memTemplItemRight" valign="bottom">
enum{% if member.isStrong %}{%if member.isEnumStruct %}&#160;struct{%else%}&#160;class{% endif %}{% endif %}&#160;</td><td class="memTemplItemRight" valign="bottom">
{# write name #}
{% if not member.isAnonymous %}
{% with obj=member text=member.nameWithContextFor:compound.compoundKind %}
Expand All @@ -29,7 +29,7 @@
<br/>&#160;&#160;
{% endif %}
{% spaceless %}
{% with obj=enumVal text=enumVal.name %}
{% with obj=enumVal text=enumVal.nameWithContextFor:compound.compoundKind %}
{% include 'htmlobjlink.tpl' %}
{% if enumVal.hasOneLineInitializer %}
{{ member.initializer }}
Expand Down
4 changes: 3 additions & 1 deletion templates/html/htmlmemdef.tpl
Expand Up @@ -4,7 +4,9 @@
<h2 class="groupheader">{{ memberListInfo.title }}</h2>
{% for member in memberListInfo.members %}
{% if member.detailsVisibleFor:compound.compoundKind %}
<a class="anchor" id="{{ member.anchor }}"></a>
<h2 class="memtitle"><span class="permalink"><a href="#{{ member.anchor }}">&#9670;&nbsp;</a></span>{{ member.name }}{% if member.isFunction and not member.isObjCMethod %}(){% endif %}
{% if memberListInfo.members|length>1 %}<span class="overload">[{{ forloop.counter }}/{{ memberListInfo.members|length }}]</a>{% endif %}
</h2>
<div class="memitem">
<div class="memproto">
{# write template declarations #}
Expand Down
12 changes: 6 additions & 6 deletions templates/html/htmlmodule.tpl
Expand Up @@ -48,9 +48,9 @@
{% with memberListInfo=compound.enums %}
{% include 'htmlmemsummary.tpl' %}
{% endwith %}
{% with memberListInfo=compound.enumvalues %}
{% include 'htmlmemsummary.tpl' %}
{% endwith %}
{#{% with memberListInfo=compound.enumvalues %}#}
{# {% include 'htmlmemsummary.tpl' %}#}
{#{% endwith %}#}
{% with memberListInfo=compound.functions %}
{% include 'htmlmemsummary.tpl' %}
{% endwith %}
Expand Down Expand Up @@ -143,9 +143,9 @@
{% include 'htmlmemdecls.tpl' %}
{% endwith %}
{# enum values #}
{% with memberListInfo=compound.enumvalues %}
{% include 'htmlmemdecls.tpl' %}
{% endwith %}
{# {% with memberListInfo=compound.enumvalues %}#}
{# {% include 'htmlmemdecls.tpl' %}#}
{# {% endwith %}#}
{# functions #}
{% with memberListInfo=compound.functions %}
{% include 'htmlmemdecls.tpl' %}
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlmodules.tpl
Expand Up @@ -6,7 +6,7 @@
</div>
{% indexentry nav name=tr.modules file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %}
{% opensubindex nav %}
{% with tree=moduleTree %}
{% with tree=moduleTree treeType='Module' %}
{% include 'htmldirtree.tpl' %}
{% endwith %}
{% closesubindex nav %}
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlnamespaces.tpl
Expand Up @@ -6,7 +6,7 @@
</div>
{% indexentry nav name=tr.namespaceList file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %}
{% opensubindex nav %}
{% with tree=namespaceTree %}
{% with tree=namespaceTree treeType='Namespace' %}
{% include 'htmldirtree.tpl' %}
{% endwith %}
{% closesubindex nav %}
Expand Down
2 changes: 1 addition & 1 deletion templates/html/htmlpages.tpl
Expand Up @@ -6,7 +6,7 @@
</div>
{% indexentry nav name=tr.pages file=page.fileName anchor='' isReference=False separateIndex=False addToIndex=True %}
{% opensubindex nav %}
{% with tree=pageTree %}
{% with tree=pageTree treeType='Page' %}
{% include 'htmldirtree.tpl' %}
{% endwith %}
{% closesubindex nav %}
Expand Down

0 comments on commit e12e557

Please sign in to comment.