From 43c777f3869922d4f74d406d75f3ca3d05cb9617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 16 May 2015 19:33:53 +0200 Subject: NOISSUE add some functionality to the derpy markdown changelog thing --- application/dialogs/UpdateDialog.cpp | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'application/dialogs') diff --git a/application/dialogs/UpdateDialog.cpp b/application/dialogs/UpdateDialog.cpp index 31f2de29..37e44b1e 100644 --- a/application/dialogs/UpdateDialog.cpp +++ b/application/dialogs/UpdateDialog.cpp @@ -57,6 +57,9 @@ QString reprocessMarkdown(QString markdown) { // [GitHub issues](https://github.com/MultiMC/MultiMC5/issues) line.replace(QRegExp("\\[([^\\]]+)\\]\\(([^\\)]+)\\)"), "\\1"); + line.replace(QRegExp("GH-([0-9]+)"), "GH-\\1"); + line.replace(QRegExp("\\*\\*([^*]+)\\*\\*"), "\\1"); + line.replace(QRegExp("\\*([^*]+)\\*"), "\\1"); return line; }; for(auto line: lines) @@ -68,6 +71,14 @@ QString reprocessMarkdown(QString markdown) else switch (state) { case BASE: + if(line.startsWith("####")) + { + html << "

" << procLine(line.mid(4)) << "

\n"; + } + if(line.startsWith("###")) + { + html << "

" << procLine(line.mid(3)) << "

\n"; + } if(line.startsWith("##")) { html << "

" << procLine(line.mid(2)) << "

\n"; @@ -85,6 +96,18 @@ QString reprocessMarkdown(QString markdown) else qCritical() << "Invalid input on line " << i << ": " << line; break; case LIST1: + if(line.startsWith("####")) + { + state = BASE; + html << "\n"; + html << "

" << procLine(line.mid(4)) << "

\n"; + } + else if(line.startsWith("###")) + { + state = BASE; + html << "\n"; + html << "

" << procLine(line.mid(3)) << "

\n"; + } if(line.startsWith("##")) { state = BASE; @@ -110,6 +133,20 @@ QString reprocessMarkdown(QString markdown) else qCritical() << "Invalid input on line " << i << ": " << line; break; case LIST2: + if(line.startsWith("####")) + { + state = BASE; + html << "\n"; + html << "\n"; + html << "

" << procLine(line.mid(4)) << "

\n"; + } + else if(line.startsWith("###")) + { + state = BASE; + html << "\n"; + html << "\n"; + html << "

" << procLine(line.mid(3)) << "

\n"; + } if(line.startsWith("##")) { state = BASE; -- cgit v1.2.3