From 9bd41062978abaca0536f0f4259337ede7530c78 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 2 Apr 2012 12:17:06 +0200 Subject: [PATCH] qdoc: Add the \hr command Now you can out put a horizontal line anywhere in your text. Change-Id: I9b8bbbd6aa312e8386fb1a3b165876d76057f784 Reviewed-by: Casper van Donderen --- src/tools/qdoc/atom.cpp | 1 + src/tools/qdoc/atom.h | 1 + src/tools/qdoc/ditaxmlgenerator.cpp | 5 +++++ src/tools/qdoc/doc.cpp | 6 ++++++ src/tools/qdoc/htmlgenerator.cpp | 3 +++ 5 files changed, 16 insertions(+) diff --git a/src/tools/qdoc/atom.cpp b/src/tools/qdoc/atom.cpp index fec383f..8743efa 100644 --- a/src/tools/qdoc/atom.cpp +++ b/src/tools/qdoc/atom.cpp @@ -197,6 +197,7 @@ static const struct { { "FormattingRight", Atom::FormattingRight }, { "GeneratedList", Atom::GeneratedList }, { "GuidLink", Atom::GuidLink}, + { "hr", Atom::HR}, { "Image", Atom::Image }, { "ImageText", Atom::ImageText }, { "ImportantLeft", Atom::ImportantLeft }, diff --git a/src/tools/qdoc/atom.h b/src/tools/qdoc/atom.h index d9f3474..7c3b5a0 100644 --- a/src/tools/qdoc/atom.h +++ b/src/tools/qdoc/atom.h @@ -84,6 +84,7 @@ public: FormattingRight, GeneratedList, GuidLink, + HR, Image, ImageText, ImportantLeft, diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index 1458b64..010de29 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -1194,6 +1194,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } } break; + case Atom::HR: //

+ writeStartTag(DT_p); + xmlWriter().writeAttribute("outputclass","horizontal-rule"); + writeEndTag(); //

+ break; case Atom::Image: case Atom::InlineImage: { diff --git a/src/tools/qdoc/doc.cpp b/src/tools/qdoc/doc.cpp index 6bc3086..3c1bab1 100644 --- a/src/tools/qdoc/doc.cpp +++ b/src/tools/qdoc/doc.cpp @@ -118,6 +118,7 @@ enum { CMD_GENERATELIST, CMD_GRANULARITY, CMD_HEADER, + CMD_HR, CMD_I, CMD_IF, CMD_IMAGE, @@ -235,6 +236,7 @@ static struct { { "generatelist", CMD_GENERATELIST, 0 }, { "granularity", CMD_GRANULARITY, 0 }, // ### don't document for now { "header", CMD_HEADER, 0 }, + { "hr", CMD_HR, 0 }, { "i", CMD_I, 0 }, { "if", CMD_IF, 0 }, { "image", CMD_IMAGE, 0 }, @@ -904,6 +906,10 @@ void DocParser::parse(const QString& source, case CMD_E: startFormat(ATOM_FORMATTING_ITALIC, cmd); break; + case CMD_HR: + leavePara(); + append(Atom::HR); + break; case CMD_IF: preprocessorSkipping.push(!Tokenizer::isTrue(getRestOfLine())); if (preprocessorSkipping.top()) diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 7203bdb..9434ced 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -762,6 +762,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, } } break; + case Atom::HR: + out() << "
\n"; + break; case Atom::Image: case Atom::InlineImage: { -- 2.7.4