Skip to content

Commit 893530f

Browse files
committed
Add support for <nowiki>
1 parent 9d48b54 commit 893530f

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

App_Code/API/ContentService.cs

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public string ConvertContent(Content obj)
1717
{
1818
if (String.IsNullOrEmpty(obj.htmlContent)) return "";
1919

20+
// preserve <nowiki>
21+
obj.htmlContent = obj.htmlContent.Replace("<nowiki>", "_nowiki_");
22+
obj.htmlContent = obj.htmlContent.Replace("</nowiki>", "_/nowiki_");
23+
2024
string fileName = String.Format("{0}.txt", Guid.NewGuid().ToString());
2125
string fileDirectory = HttpContext.Current.Server.MapPath("~/temp");
2226
string filePath = String.Concat(fileDirectory, "\\", fileName);
@@ -45,6 +49,9 @@ public string ConvertContent(Content obj)
4549

4650
output = output.Replace("{|", "{| class=\"wikitable\"");
4751
output = new Regex("(width=.{0,12}[|] )").Replace(output, " ");
52+
// revive <nowiki>
53+
output = output.Replace("_nowiki_", "<nowiki>");
54+
output = output.Replace("_/nowiki_", "</nowiki>");
4855

4956
File.Delete(filePath);
5057

Default.aspx

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@
4242
"use strict";
4343
4444
CKEDITOR.replace("editor", {
45-
format_tags: "p;h2;h3;h4",
4645
removeButtons: "",
4746
customValues: { convert_url: "/api/content.svc/ConvertContent" },
47+
format_nowiki: { name: "No wiki", element: "nowiki" }, // <nowiki>
48+
format_tags: "p;h2;h3;h4;nowiki",
4849
extraPlugins: "wygiwiki",
4950
skin: "moono",
5051
toolbar: [

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ This project is not a replacement for powerful extensions like [VisualEditor](ht
2121
* Unsupported
2222
* {{templates}}
2323
* gallery
24-
* nowiki
2524
* etc.
2625
* Tables
2726
* *Must* have equal rows and columns

0 commit comments

Comments
 (0)