This is an archive of the discontinued LLVM Phabricator instance.

WDocumentation: Implement the \anchor.
ClosedPublic

Authored by Mordante on Oct 20 2019, 9:18 AM.

Details

Summary

I'm not sure it should be added to the InlineComment group. It's not entirely a markup. Do you think it should be a in a separate group?

(I also have not yet posted code for \emoji which is also in the InlineComment group.)

Diff Detail

Event Timeline

Mordante created this revision.Oct 20 2019, 9:18 AM

Thank you for the contribution and sorry for the review delay!

clang/bindings/xml/comment-xml-schema.rng
583

Since the name of the anchor is not a part of the document text, it should be an attribute on the anchor tag (not a part of the text).

clang/lib/Index/CommentToXML.cpp
302

"name" is obsolete since HTML5. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

I guess we should emit an empty "<span id=...>" instead.

303

I don't think escaping is needed. IDs have a strict syntax: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id

304
clang/test/Index/Inputs/CommentXML/valid-function-02.xml
12 ↗(On Diff #225789)

I'd suggest to add a separate test file.

Mordante marked 5 inline comments as done.Nov 30 2019, 9:48 AM

Thanks for the review. I'll address your comments and upload a new version.

Mordante updated this revision to Diff 231592.Nov 30 2019, 10:29 AM

Addresses review comments.

A few more comments, but generally looks good!

clang/include/clang-c/Documentation.h
187

"since it is a only" => "since it only"

clang/lib/Index/CommentToXML.cpp
650

Sholudn't this code be producing "<anchor id=...>"?

clang/test/Index/Inputs/CommentXML/valid-inline-command-01.xml
2

Please add a line to clang/test/Index/comment-xml-schema.c that executes this test.

Mordante marked 6 inline comments as done.Dec 2 2019, 11:37 AM
Mordante added inline comments.
clang/lib/Index/CommentToXML.cpp
650

Good catch, will update it in the next patch.

clang/test/Index/Inputs/CommentXML/valid-inline-command-01.xml
2

I already added a line.

clang/test/Index/comment-xml-schema.c
38

Is this what you meant? Or did you mean something different?

gribozavr2 marked an inline comment as done.Dec 2 2019, 12:07 PM
gribozavr2 added inline comments.
clang/test/Index/comment-xml-schema.c
38

Yes, this line. Sorry, I missed it during review. Thanks for pointing out!

Mordante updated this revision to Diff 231766.Dec 2 2019, 12:46 PM
Mordante marked 2 inline comments as done.

Addresses review comments.

gribozavr2 accepted this revision.Dec 3 2019, 4:36 AM

With that last comment, LGTM. Do you have commit access?

clang/lib/AST/TextNodeDumper.cpp
493

Please add a test for this one to clang/test/Index/comment-to-html-xml-conversion.cpp (search for RenderEmphasized in that file).

This revision is now accepted and ready to land.Dec 3 2019, 4:36 AM
Mordante marked an inline comment as done.Dec 4 2019, 11:50 AM

Thanks for the review! I recently acquired commit access so I'll commit it after updating the unit test.

clang/lib/AST/TextNodeDumper.cpp
493

I already added a test to clang/test/Index/comment-to-html-xml-conversion.cpp. I forgot to add a test to clang/test/AST/ast-dump-comment.cpp, is this the file you meant?

Mordante marked an inline comment as done.Dec 15 2019, 7:53 AM
Mordante added inline comments.
clang/lib/AST/TextNodeDumper.cpp
493

@gribozavr2 In case you missed the question above, could you have a look at the question?

LGTM, feel free to push.

clang/lib/AST/TextNodeDumper.cpp
493

Sorry, I probably missed your edit to clang/test/Index/comment-to-html-xml-conversion.cpp when typing that comment. ast-dump-comment.cpp is not as extensive, so I'm not concerned about having to add the test there. If you want to -- feel free, but I think that is optional.

This revision was automatically updated to reflect the committed changes.