2
0
mirror of https://github.com/boostorg/docca.git synced 2026-01-19 04:12:08 +00:00

fix treatment of entities nested inside nested entities

This commit is contained in:
Dmitry Arkhipov
2024-08-17 17:36:11 +10:00
parent 5084e6c207
commit 5f349f0c7b
2 changed files with 69 additions and 24 deletions

View File

@@ -719,34 +719,30 @@ static
{% macro link(entity, prefer_overload=False) -%}
{%- if entity is Enumerator -%}
{{ link(entity.enum) }}
{%- else -%}
{%- elif entity is Namespace -%}
{%- if 'link_prefix' in Config %}{{ Config.link_prefix }}{% endif -%}
{%- set ns = namespace(suffix='', path=entity.path) -%}
{%- if entity.scope and entity.scope is not Namespace -%}
{%- set ns.suffix = '.' + sanitize_path_segment(ns.path[-1].name) -%}
{%- set ns.path = ns.path[:-1] -%}
{%- endif -%}
{%- if (entity is Function or entity is OverloadSet) and entity.is_friend %}
{%- set ns.suffix = ns.suffix + '_fr' -%}
{%- endif -%}
{%- if (entity is Function or entity is OverloadSet)
and entity.is_free
and entity.scope is Type %}
{%- set ns.suffix = ns.suffix + '_fe' -%}
{%- endif -%}
{%- if entity is Function %}
{%- if not prefer_overload and not entity.is_sole_overload %}
{%- set ns.suffix = ns.suffix + '.overload{0}'.format(entity.overload_index + 1) -%}
{%- endif -%}
{%- endif -%}
{%- set sep = joiner('__') -%}
{%- for segment in ns.path -%}
{%- for segment in entity.path -%}
{{ sep() }}{{ sanitize_path_segment(segment.name) }}
{%- endfor -%}
{{ ns.suffix }}
{%- else -%}
{%- if entity.scope -%}
{{ link(entity.scope, prefer_overload=prefer_overload) }}
{%- if entity.scope is Namespace %}__{% else %}.{% endif -%}
{%- endif -%}
{{ sanitize_path_segment(entity.name) }}
{%- if (entity is Function or entity is OverloadSet) -%}
{%- if entity.is_friend -%}
_fr
{%- elif entity.is_free and entity.scope is Type -%}
_fe
{%- endif -%}
{%- endif -%}
{%- if entity is Function %}
{%- if not prefer_overload and not entity.is_sole_overload -%}
.overload{{ entity.overload_index + 1 }}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endmacro %}

View File

@@ -165,12 +165,30 @@ def entities():
]
}
cl4 = docca.Class(
make_elem({
'tag': 'compound',
'id': 'cl4',
'items': [
{ 'tag': 'compoundname', 'items': ['nested2'] },
{
'tag': 'detaileddescription',
'items': [
'See ',
{ 'tag': 'ref', 'refid': 'cl4', 'items': ['nested2'] },
'.',
],
},
]
}),
index)
cl2 = docca.Class(
make_elem({
'tag': 'compound',
'id': 'cl2',
'items': [
{ 'tag': 'compoundname', 'items': ['nested'] },
{ 'tag': 'innerclass', 'refid': cl4.id },
{
'tag': 'templateparamlist',
'items': [
@@ -1096,11 +1114,42 @@ def test_write_entity(cfg, entities, render):
class T = std::String>
class nested;
```
[heading Types]
[table [[Name][Description]]
[
[[*[link ns1__ns2__klass.nested.nested2 nested2]]
]
[
]
]
]
[section:nested2 ns2::klass::nested::nested2]
[indexterm2 nested2..nested]
[heading Synopsis]
```
class nested2;
```
[heading Description]
See [link ns1__ns2__klass.nested.nested2 `nested2`].
[endsect]
[endsect]