Write magic paragraph label to main paragraph tag.

This commit is contained in:
Richard Heck 2016-07-08 16:38:37 -04:00
parent 97b9e81cee
commit db954caf8b
2 changed files with 8 additions and 17 deletions

View File

@ -135,16 +135,13 @@ docstring EndTag::writeEndTag() const
}
docstring ParTag::writeTag() const
ParTag::ParTag(std::string const & tag, std::string attr,
std::string const & parid)
: StartTag(tag)
{
docstring output = StartTag::writeTag();
if (parid_.empty())
return output;
string const pattr = "id='" + parid_ + "'";
output += html::CompTag("a", pattr).writeTag();
return output;
if (!parid.empty())
attr += " id='" + parid + "'";
attr_ = attr;
}

View File

@ -117,16 +117,10 @@ struct CompTag
struct ParTag : public StartTag
{
///
explicit ParTag(std::string const & tag, std::string const & attr,
std::string const & parid)
: StartTag(tag, attr), parid_(parid)
{}
explicit ParTag(std::string const & tag, std::string attr,
std::string const & parid);
///
~ParTag() {}
///
docstring writeTag() const;
/// the "magic par label" for this paragraph
std::string parid_;
};