qdoc: The \br macro is promoted to a qdoc command
authorMartin Smith <martin.smith@nokia.com>
Thu, 5 Jul 2012 08:44:34 +0000 (10:44 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 5 Jul 2012 09:01:02 +0000 (11:01 +0200)
The \br macro, which is used to insert a line break in the output
text, is now promoted to be a qdoc command. For html, it outputs a
<br/>. For DITA XML it does nothing.

Task Nr: QTBUG-26435

Change-Id: Ie0542c9053f68473ccaa2f50ace74baa30f78dd0
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
src/tools/qdoc/atom.cpp
src/tools/qdoc/atom.h
src/tools/qdoc/ditaxmlgenerator.cpp
src/tools/qdoc/doc.cpp
src/tools/qdoc/htmlgenerator.cpp

index 86f7fdf..03638d2 100644 (file)
@@ -174,6 +174,7 @@ static const struct {
     { "AnnotatedList", Atom::AnnotatedList },
     { "AutoLink", Atom::AutoLink },
     { "BaseName", Atom::BaseName },
+    { "br", Atom::BR},
     { "BriefLeft", Atom::BriefLeft },
     { "BriefRight", Atom::BriefRight },
     { "C", Atom::C },
index 7c3b5a0..0ab0c9c 100644 (file)
@@ -61,6 +61,7 @@ public:
         AnnotatedList,
         AutoLink,
         BaseName,
+        BR,
         BriefLeft,
         BriefRight,
         C,
index 406e16e..8e36ab2 100644 (file)
@@ -1277,6 +1277,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
         }
     }
         break;
+    case Atom::BR:
+        // DITA XML can't do <br>
+        break;
     case Atom::HR: //<p outputclass="horizontal-rule" />
         writeStartTag(DT_p);
         xmlWriter().writeAttribute("outputclass","horizontal-rule");
index 268c20d..b60563c 100644 (file)
@@ -82,6 +82,7 @@ enum {
     CMD_BADCODE,
     CMD_BASENAME,
     CMD_BOLD,
+    CMD_BR,
     CMD_BRIEF,
     CMD_C,
     CMD_CAPTION,
@@ -199,6 +200,7 @@ static struct {
     { "badcode", CMD_BADCODE, 0 },
     { "basename", CMD_BASENAME, 0 }, // ### don't document for now
     { "bold", CMD_BOLD, 0 },
+    { "br", CMD_BR, 0 },
     { "brief", CMD_BRIEF, 0 },
     { "c", CMD_C, 0 },
     { "caption", CMD_CAPTION, 0 },
@@ -644,6 +646,10 @@ void DocParser::parse(const QString& source,
                     leavePara();
                     insertBaseName(getArgument());
                     break;
+                case CMD_BR:
+                    leavePara();
+                    append(Atom::BR);
+                    break;
                 case CMD_BOLD:
                     location().warning(tr("'\\bold' is deprecated. Use '\\b'"));
                 case CMD_B:
index 870acf4..d5de02a 100644 (file)
@@ -760,6 +760,9 @@ int HtmlGenerator::generateAtom(const Atom *atom,
         }
     }
         break;
+    case Atom::BR:
+        out() << "<br />\n";
+        break;
     case Atom::HR:
         out() << "<hr />\n";
         break;