Skip to main content

The DocHtmlHeader Class Reference

Node Html heading. More...

Declaration

class DocHtmlHeader { ... }

Included Headers

#include <src/docnode.h>

Base class

classDocCompoundNode

Base class for nodes with children. More...

Public Constructors Index

DocHtmlHeader (DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs, int level)

Public Member Functions Index

intlevel () const
const HtmlAttribList &attribs () const
Tokenparse ()

Private Member Attributes Index

intm_level = 0
HtmlAttribListm_attribs

Description

Node Html heading.

Definition at line 872 of file docnode.h.

Public Constructors

DocHtmlHeader()

DocHtmlHeader::DocHtmlHeader (DocParser * parser, DocNodeVariant * parent, const HtmlAttribList & attribs, int level)
inline

Public Member Functions

attribs()

const HtmlAttribList & DocHtmlHeader::attribs ()
inline

Definition at line 878 of file docnode.h.

878 const HtmlAttribList &attribs() const { return m_attribs; }

Reference m_attribs.

Referenced by DocHtmlHeader and HtmlDocVisitor::operator().

level()

parse()

Token DocHtmlHeader::parse ()

Declaration at line 879 of file docnode.h, definition at line 1304 of file docnode.cpp.

1305{
1306 AUTO_TRACE();
1307 Token retval(TokenRetval::RetVal_OK);
1308 auto ns = AutoNodeStack(parser(),thisVariant());
1309
1310 Token tok = parser()->tokenizer.lex();
1311 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF))
1312 {
1313 if (!parser()->defaultHandleToken(thisVariant(),tok,children()))
1314 {
1315 switch (tok.value())
1316 {
1317 case TokenRetval::TK_HTMLTAG:
1318 {
1319 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
1320 if (tagId==HtmlTagType::HTML_H1 && parser()->context.token->endTag) // found </h1> tag
1321 {
1322 if (m_level!=1)
1323 {
1324 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h{:d}> ended with </h1>",
1325 m_level);
1326 }
1327 goto endheader;
1328 }
1329 else if (tagId==HtmlTagType::HTML_H2 && parser()->context.token->endTag) // found </h2> tag
1330 {
1331 if (m_level!=2)
1332 {
1333 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h{:d}> ended with </h2>",
1334 m_level);
1335 }
1336 goto endheader;
1337 }
1338 else if (tagId==HtmlTagType::HTML_H3 && parser()->context.token->endTag) // found </h3> tag
1339 {
1340 if (m_level!=3)
1341 {
1342 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h{:d}> ended with </h3>",
1343 m_level);
1344 }
1345 goto endheader;
1346 }
1347 else if (tagId==HtmlTagType::HTML_H4 && parser()->context.token->endTag) // found </h4> tag
1348 {
1349 if (m_level!=4)
1350 {
1351 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h{:d}> ended with </h4>",
1352 m_level);
1353 }
1354 goto endheader;
1355 }
1356 else if (tagId==HtmlTagType::HTML_H5 && parser()->context.token->endTag) // found </h5> tag
1357 {
1358 if (m_level!=5)
1359 {
1360 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h{:d}> ended with </h5>",
1361 m_level);
1362 }
1363 goto endheader;
1364 }
1365 else if (tagId==HtmlTagType::HTML_H6 && parser()->context.token->endTag) // found </h6> tag
1366 {
1367 if (m_level!=6)
1368 {
1369 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h{:d}> ended with </h6>",
1370 m_level);
1371 }
1372 goto endheader;
1373 }
1374 else if (tagId==HtmlTagType::HTML_A)
1375 {
1376 if (!parser()->context.token->endTag)
1377 {
1378 parser()->handleAHref(thisVariant(),children(),parser()->context.token->attribs);
1379 }
1380 }
1381 else if (tagId==HtmlTagType::HTML_BR)
1382 {
1384 }
1385 else
1386 {
1387 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <{}{}> found within <h{:d}> context",
1388 parser()->context.token->endTag?"/":"",parser()->context.token->name,m_level);
1389 }
1390 }
1391 break;
1392 default:
1393 char tmp[20];
1394 qsnprintf(tmp,20,"<h%d> tag",m_level);
1396 }
1397 }
1398 tok = parser()->tokenizer.lex();
1399 }
1400 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
1401 {
1402 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside"
1403 " <h{:d}> tag",m_level);
1404 }
1405endheader:
1407 return retval;
1408}

References DocNodeList::append, TokenInfo::attribs, AUTO_TRACE, DocCompoundNode::children, DocParser::context, DocParser::errorHandleDefaultToken, DocParser::handleAHref, DocParser::handlePendingStyleCommands, HTML_A, HTML_BR, HTML_H1, HTML_H2, HTML_H3, HTML_H4, HTML_H5, HTML_H6, Mappers::htmlTagMapper, Token::is_any_of, DocTokenizer::lex, m_level, DocNode::parser, qsnprintf, DocNode::thisVariant, DocParserContext::token, DocParser::tokenizer, Token::value and warn_doc_error.

Private Member Attributes

m_attribs

HtmlAttribList DocHtmlHeader::m_attribs

Definition at line 883 of file docnode.h.

Referenced by attribs and DocHtmlHeader.

m_level

int DocHtmlHeader::m_level = 0

Definition at line 882 of file docnode.h.

882 int m_level = 0;

Referenced by DocHtmlHeader, level and parse.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus by Doxygen 1.14.0.