Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/mrdocs/Metadata/DocComment/Inline/HighlightInline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct HighlightInline final
: InlineCommonBase<InlineKind::Highlight>
, InlineContainer
{
/** Inherit text container constructors.
*/
using InlineContainer::InlineContainer;
};

MRDOCS_DESCRIBE_STRUCT(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ struct StrikethroughInline final
: InlineCommonBase<InlineKind::Strikethrough>
, InlineContainer
{
/** Inherit text container constructors.
*/
using InlineContainer::InlineContainer;
};

MRDOCS_DESCRIBE_STRUCT(
Expand Down
3 changes: 3 additions & 0 deletions include/mrdocs/Metadata/DocComment/Inline/SubscriptInline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct SubscriptInline final
: InlineCommonBase<InlineKind::Subscript>
, InlineContainer
{
/** Inherit text container constructors.
*/
using InlineContainer::InlineContainer;
};

MRDOCS_DESCRIBE_STRUCT(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct SuperscriptInline final
: InlineCommonBase<InlineKind::Superscript>
, InlineContainer
{
/** Inherit text container constructors.
*/
using InlineContainer::InlineContainer;
};

MRDOCS_DESCRIBE_STRUCT(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[.line-through]#{{> @partial-block }}#
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#{{> @partial-block }}#
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~{{> @partial-block }}~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^{{> @partial-block }}^
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#> markup/i }}{{> doc/inline-container }}{{/ markup/i }}
{{#> markup/em }}{{> doc/inline-container }}{{/ markup/em }}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#> markup/i }}{{> doc/inline-container }}{{/ markup/i }}
{{#> markup/mark }}{{> doc/inline-container }}{{/ markup/mark }}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#> markup/i }}{{> doc/inline-container }}{{/ markup/i }}
{{#> markup/del }}{{> doc/inline-container }}{{/ markup/del }}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#> markup/i }}{{> doc/inline-container }}{{/ markup/i }}
{{#> markup/sub }}{{> doc/inline-container }}{{/ markup/sub }}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#> markup/i }}{{> doc/inline-container }}{{/ markup/i }}
{{#> markup/sup }}{{> doc/inline-container }}{{/ markup/sup }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
{{~#if (eq kind "code")~}}{{> doc/inline/code}}{{~/if~}}
{{~#if (eq kind "link")~}}{{> doc/inline/link}}{{~/if~}}
{{~#if (eq kind "reference")~}}{{> doc/inline/reference}}{{~/if~}}
{{~#if (eq kind "copy-details")~}}{{> doc/inline/copy-details}}{{~/if~}}
{{~#if (eq kind "copy-details")~}}{{> doc/inline/copy-details}}{{~/if~}}
{{~#if (eq kind "highlight")~}}{{> doc/inline/highlight}}{{~/if~}}
{{~#if (eq kind "strikethrough")~}}{{> doc/inline/strikethrough}}{{~/if~}}
{{~#if (eq kind "subscript")~}}{{> doc/inline/subscript}}{{~/if~}}
{{~#if (eq kind "superscript")~}}{{> doc/inline/superscript}}{{~/if~}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<del>{{> @partial-block }}</del>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mark>{{> @partial-block }}</mark>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<sub>{{> @partial-block }}</sub>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<sup>{{> @partial-block }}</sup>
30 changes: 30 additions & 0 deletions src/lib/AST/ExtractDocComment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,36 @@ class DocCommentVisitor
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "strong")
{
emplaceInline<doc::StrongInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "mark")
{
emplaceInline<doc::HighlightInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "sub")
{
emplaceInline<doc::SubscriptInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "sup")
{
emplaceInline<doc::SuperscriptInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else if (comps.tag == "del" || comps.tag == "s")
{
emplaceInline<doc::StrikethroughInline>(
C->hasTrailingNewline(),
ensureUTF8(std::move(comps.text)));
}
else
{
report::warn(
Expand Down
4 changes: 2 additions & 2 deletions test-files/golden-tests/javadoc/html-table/inline.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ <h3>
<th>Reference</th>
</tr>
<tr>
<td>fixed</td>
<td><em>fixed</em></td>
<td>23.50</td>
<td><a href="https://en.cppreference.com/w/cpp/io/manip/fixed">cppreference</a></td>
</tr>
<tr>
<td>scientific</td>
<td><em>scientific</em></td>
<td>2.35e+01</td>
<td><a href="https://en.cppreference.com/w/cpp/io/manip/scientific">cppreference</a></td>
</tr>
Expand Down
38 changes: 38 additions & 0 deletions test-files/golden-tests/javadoc/inline/inline-markers.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
= Reference
:mrdocs:

[#index]
== Global namespace

=== Functions

[cols="1,4"]
|===
| Name| Description
| link:#f[`f`]
| Exercise the inline markup kinds (HTML and Markdown forms)&colon; subscript, superscript, highlight, strikethrough&period;
|===

[#f]
== f

Exercise the inline markup kinds (HTML and Markdown forms)&colon; subscript, superscript, highlight, strikethrough&period;

=== Synopsis

Declared in `&lt;inline&hyphen;markers&period;cpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
f();
----

=== Description

HTML form (works in tight notation)&colon; H~2~O is water&semi; x^2^ is x squared&period; *Bold*, #highlighted#, [.line-through]#struck&hyphen;through#, and [.line-through]#also struck# text&period;

Markdown form (requires whitespace flanks)&colon; Subscript&colon; ~i~ indicates an index&period; Superscript&colon; raise to the ^n^ power&period; Strong&colon; *bold*&period; Highlight&colon; #highlighted#&period; Strikethrough&colon; [.line-through]#struck&hyphen;through#&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
15 changes: 15 additions & 0 deletions test-files/golden-tests/javadoc/inline/inline-markers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** Exercise the inline markup kinds (HTML and Markdown forms):
subscript, superscript, highlight, strikethrough.

HTML form (works in tight notation):
H<sub>2</sub>O is water; x<sup>2</sup> is x squared.
<strong>Bold</strong>, <mark>highlighted</mark>,
<del>struck-through</del>, and <s>also struck</s> text.

Markdown form (requires whitespace flanks):
Subscript: ~i~ indicates an index. Superscript: raise to the
^n^ power.
Strong: **bold**. Highlight: ==highlighted==.
Strikethrough: ~~struck-through~~.
*/
void f();
58 changes: 58 additions & 0 deletions test-files/golden-tests/javadoc/inline/inline-markers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<html lang="en">
<head>
<title>Reference</title>
<meta charset="utf-8">
</head>
<body>
<div>
<h1>Reference</h1>
<div>
<div>
<h2 id="index">
Global Namespace</h2>
</div>
<h2>
Functions</h2>
<table style="table-layout: fixed; width: 100%;">
<thead>
<tr>
<th>Name</th><th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#f"><code>f</code></a> </td><td>Exercise the inline markup kinds (HTML and Markdown forms): subscript, superscript, highlight, strikethrough.</td></tr>
</tbody>
</table>

</div>
<div>
<div>
<h2 id="f">
f</h2>
<div>
<p>Exercise the inline markup kinds (HTML and Markdown forms): subscript, superscript, highlight, strikethrough.</p>
</div>
</div>
<div>
<h3>
Synopsis</h3>
<div>
Declared in <code>&lt;inline-markers.cpp&gt;</code></div>
<pre><code class="source-code cpp">void
f();</code></pre>
</div>
<div>
<h3>
Description</h3>
<p>HTML form (works in tight notation): H<sub>2</sub>O is water; x<sup>2</sup> is x squared. <strong>Bold</strong>, <mark>highlighted</mark>, <del>struck-through</del>, and <del>also struck</del> text.</p>
<p>Markdown form (requires whitespace flanks): Subscript: <sub>i</sub> indicates an index. Superscript: raise to the <sup>n</sup> power. Strong: <strong>bold</strong>. Highlight: <mark>highlighted</mark>. Strikethrough: <del>struck-through</del>.</p>
</div>
</div>

</div>
<footer class="mrdocs-footer">
<span>Created with <a href="https://www.mrdocs.com">MrDocs</a></span>
</footer>
</body>
</html>
Loading
Loading