mono-docs: Use full name in list of derived classes

In the EFL API we have several objects with the same name in different namespaces.
Thus it is important to use fully-qualified names throughout the docs, to avoid
confusion.
However, the default DocFX templates prefer using only simple class names.
The default templates have already been modified to use full names everywhere
except in the list of derived classes in the hierarchy section, where a DocFX
bug was hit.
This commit is a workaround to that bug (see
https://github.com/dotnet/docfx/issues/3769#issuecomment-485616064 )
so full names (with links) are used in the whole hierarchy.
This commit is contained in:
Xavi Artigas 2019-04-23 10:51:56 +02:00
parent f8377ed549
commit 8e3fa3a97f
2 changed files with 15 additions and 1 deletions

View File

@ -12,7 +12,7 @@
{{/inheritance}}
<div class="level{{level}}"><span class="xref"><b>{{fullName.0.value}}</b></span></div>
{{#derivedClasses}}
<div class="level{{index}}">{{{specName.0.value}}}</div>
<div class="level{{index}}"><xref uid="{{uid}}" text="{{fullName.0.value}}"/></div>
{{/derivedClasses}}
</div>
</div>

View File

@ -22,5 +22,19 @@ for f in `ls api/*.yml`; do
sed -e 's/\(<xref href=\\"[^\\]*\)\\"/\1?displayProperty=fullName\\"/g' -i $f
done;
# Add missing references to derived classes, so they can be rendered with
# their full name.
# https://github.com/dotnet/docfx/issues/3769#issuecomment-485616064
for f in `grep -l derivedClasses api/*.yml`; do
sed "1,/^ derivedClasses:$/d" $f > /tmp/efl_docfx_gendoc
sed -i "/^ [^-]/,$ d" /tmp/efl_docfx_gendoc
sed -i "/^[^ ]/,$ d" /tmp/efl_docfx_gendoc
while read dash class
do
sed -i "s/^references:$/references:\n- uid: $class\n fullName: $class/g" $f
done <<< "$(cat /tmp/efl_docfx_gendoc)"
done;
rm -rf /tmp/efl_docfx_gendoc
# DocFX Step 2: Generate HTML files
mono bin/docfx.exe build docfx.json && echo "Docs ready in the _site folder!"