Grantlee  5.1.0
textdocument/lib/mediawikimarkupbuilder.h
00001 /*
00002   This file is part of the Grantlee template system.
00003 
00004   Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either version
00009   2.1 of the Licence, or (at your option) any later version.
00010 
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Lesser General Public License for more details.
00015 
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 #ifndef GRANTLEE_MEDIAWIKIMARKUPBUILDER_H
00022 #define GRANTLEE_MEDIAWIKIMARKUPBUILDER_H
00023 
00024 #include "abstractmarkupbuilder.h"
00025 
00026 namespace Grantlee
00027 {
00028 
00032 class MediaWikiMarkupBuilder : public AbstractMarkupBuilder
00033 {
00034 public:
00038   MediaWikiMarkupBuilder();
00039   ~MediaWikiMarkupBuilder() override;
00040 
00041   void beginStrong() override;
00042   void endStrong() override;
00043   void beginEmph() override;
00044   void endEmph() override;
00045   void beginUnderline() override;
00046   void endUnderline() override;
00047   void beginStrikeout() override;
00048   void endStrikeout() override;
00049 
00050   void endParagraph() override;
00051   void addNewline() override;
00052 
00053   void beginAnchor(const QString &href = QString(),
00054                    const QString &name = QString()) override;
00055   void endAnchor() override;
00056 
00057   void beginHeader(int level) override;
00058   void endHeader(int level) override;
00059 
00060   void beginList(QTextListFormat::Style type) override;
00061 
00062   void endList() override;
00063 
00064   void beginListItem() override;
00065   void endListItem() override;
00066 
00067   void appendLiteralText(const QString &text) override;
00068 
00072   const QString escape(const QString &s);
00073 
00074   QString getResult() override;
00075 
00076 private:
00077   QList<QTextListFormat::Style> currentListItemStyles;
00078 
00079   QString m_text;
00080 };
00081 }
00082 
00083 #endif