| Issue |
172545
|
| Summary |
[clang-doc] Reconstructing a source declaration in Mustache templates is complex
|
| Labels |
clang-doc
|
| Assignees |
|
| Reporter |
evelez7
|
This is what it looks like to recreate the source spelling of a declaration in Mustache templates for a function that might be a specialization:
```html
<pre><code class="language-cpp code-clang-doc">{{ReturnType.Name}} {{Name}}{{#Template}}{{#Specialization}}<{{#Parameters}}{{Param}}{{^End}}, {{/End}}{{/Parameters}}>{{/Specialization}}{{/Template}} ({{#Params}}{{^End}}{{Type}} {{Name}}, {{/End}}{{#End}}{{Type}} {{Name}}{{/End}}{{/Params}})</code></pre>
```
It's not the most readable and pretty long. If the format of the HTML document were changed (which is currently happening somewhat frequently), then this might also have to change. From my own tinkering, it's also difficult to break these up into easier-to-read chunks with newlines since the declarations are always in `<pre>` tags, meaning indentations are rendered literally.
An alternative to this would be to do the spelling reconstruction beforehand and just emit the entire spelling in the template. We could use something like [`extractapi::DeclarationFragmentsBuilder`](https://clang.llvm.org/doxygen/classclang_1_1extractapi_1_1DeclarationFragmentsBuilder.html) which already handles a lot of this kind of work.
This could also be a bit of a non-issue.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs