[PATCH] D69223: WDocumentation: Implement the \anchor.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 22 04:16:24 PST 2019


gribozavr2 added a comment.

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



================
Comment at: clang/bindings/xml/comment-xml-schema.rng:583
+      <element name="anchor">
+        <!-- Non-empty text content. -->
+        <data type="string">
----------------
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).


================
Comment at: clang/lib/Index/CommentToXML.cpp:302
+    assert(C->getNumArgs() == 1);
+    Result << "<a name=\"";
+    appendToResultWithHTMLEscaping(Arg0);
----------------
"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.


================
Comment at: clang/lib/Index/CommentToXML.cpp:303
+    Result << "<a name=\"";
+    appendToResultWithHTMLEscaping(Arg0);
+    Result << "\"/>";
----------------
I don't think escaping is needed. IDs have a strict syntax: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id


================
Comment at: clang/lib/Index/CommentToXML.cpp:304
+    appendToResultWithHTMLEscaping(Arg0);
+    Result << "\"/>";
+    return;
----------------
https://stackoverflow.com/questions/3558119/are-non-void-self-closing-tags-valid-in-html5


================
Comment at: clang/test/Index/Inputs/CommentXML/valid-function-02.xml:12
     <rawHTML isMalformed="1"><ggg></rawHTML>.
+    <anchor>hhh</anchor>
   </Para>
----------------
I'd suggest to add a separate test file.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69223/new/

https://reviews.llvm.org/D69223





More information about the cfe-commits mailing list