Skip to content

Commit

Permalink
feat: adoc template "See also" section
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Feb 29, 2024
1 parent 1be3e83 commit 9c20b9d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/mrdocs/Metadata/Javadoc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ struct Overview
std::vector<Param const*> params;
std::vector<TParam const*> tparams;
std::vector<Throws const*> exceptions;
std::vector<See const*> sees;
};

MRDOCS_DECL dom::String toString(Style style) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@
{{/if}}
{{! TODO: == See Also }}
{{#if symbol.doc.see}}
== See Also
{{#each symbol.doc.see}}
{{.}}
{{/each}}
{{/if}}
13 changes: 13 additions & 0 deletions src/lib/Gen/adoc/AdocCorpus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,18 @@ domCreate(
return dom::Object(std::move(entries));
}

static
dom::Value
domCreate(
const doc::See& I,
const AdocCorpus& corpus)
{
std::string s;
DocVisitor visitor(corpus, s);
visitor(static_cast<const doc::See&>(I));
return s;
}

//------------------------------------------------

class DomJavadoc : public dom::LazyObjectImpl
Expand Down Expand Up @@ -464,6 +476,7 @@ class DomJavadoc : public dom::LazyObjectImpl
maybeEmplaceArray(list, "params", ov.params);
maybeEmplaceArray(list, "tparams", ov.tparams);
maybeEmplaceArray(list, "exceptions", ov.exceptions);
maybeEmplaceArray(list, "see", ov.sees);

return dom::Object(std::move(list));
}
Expand Down
14 changes: 10 additions & 4 deletions src/lib/Gen/adoc/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ loadOptions(
}
else
{
// VFALCO TODO get process executable
// and form a path relative to that.
opt.template_dir = files::makeDirsy(files::appendPath(
corpus.config->addonsDir,
"generator",
"asciidoc"
));
}

if(! opt.template_dir.empty())
Expand All @@ -145,8 +148,11 @@ loadOptions(
}
else
{
// VFALCO TODO get process executable
// and form a path relative to that.
opt.template_dir = files::makeDirsy(files::appendPath(
corpus.config->addonsDir,
"generator",
"asciidoc"
));
}

return opt;
Expand Down
4 changes: 4 additions & 0 deletions src/lib/Metadata/Javadoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ makeOverview(
ov.exceptions.push_back(static_cast<
doc::Throws const*>(it->get()));
break;
case doc::Kind::see:
ov.sees.push_back(static_cast<
doc::See const*>(it->get()));
break;
default:
if(ov.brief == it->get())
break;
Expand Down

0 comments on commit 9c20b9d

Please sign in to comment.