diff --git a/code/modules/admin/news.dm b/code/modules/admin/news.dm index b9e1b616b4..179391987c 100644 --- a/code/modules/admin/news.dm +++ b/code/modules/admin/news.dm @@ -21,11 +21,17 @@ var/savefile/F = new(NEWSFILE) if(F) var/title = F["title"] - var/body = F["body"] + var/body = html2paper_markup(F["body"]) var/new_title = sanitize(input(src,"Write a good title for the news update. Note: HTML is NOT supported.","Write News", title) as null|text, extra = 0) if(!new_title) return - var/new_body = sanitize(input(src,"Write the body of the news update here. Note: HTML is NOT supported.","Write News", body) as null|message, extra = 0) + var/new_body = sanitize(input(src,"Write the body of the news update here. Note: HTML is NOT supported, however paper markup is supported. \n\ + Hitting enter will automatically add a line break. \n\ + Valid markup includes: \[b\], \[i\], \[u\], \[large\], \[h1\], \[h2\], \[h3\]\ \[*\], \[hr\], \[small\], \[list\], \[table\], \[grid\], \ + \[row\], \[cell\], \[logo\], \[sglogo\].","Write News", body) as null|message, extra = 0) + + new_body = paper_markup2html(new_body) + if(findtext(new_body,"") + text = replacetext(text, "\[center\]", "
") + text = replacetext(text, "\[/center\]", "
") + text = replacetext(text, "\[br\]", "
") + text = replacetext(text, "\[b\]", "") + text = replacetext(text, "\[/b\]", "") + text = replacetext(text, "\[i\]", "") + text = replacetext(text, "\[/i\]", "") + text = replacetext(text, "\[u\]", "") + text = replacetext(text, "\[/u\]", "") + text = replacetext(text, "\[large\]", "") + text = replacetext(text, "\[/large\]", "") + text = replacetext(text, "\[h1\]", "

") + text = replacetext(text, "\[/h1\]", "

") + text = replacetext(text, "\[h2\]", "

") + text = replacetext(text, "\[/h2\]", "

") + text = replacetext(text, "\[h3\]", "

") + text = replacetext(text, "\[/h3\]", "

") + + text = replacetext(text, "\[*\]", "
  • ") + text = replacetext(text, "\[hr\]", "
    ") + text = replacetext(text, "\[small\]", "") + text = replacetext(text, "\[/small\]", "") + text = replacetext(text, "\[list\]", "") + text = replacetext(text, "\[table\]", "") + text = replacetext(text, "\[/table\]", "
    ") + text = replacetext(text, "\[grid\]", "") + text = replacetext(text, "\[/grid\]", "
    ") + text = replacetext(text, "\[row\]", "") + text = replacetext(text, "\[cell\]", "") + text = replacetext(text, "\[logo\]", "") // Not sure if these would get used but why not + text = replacetext(text, "\[sglogo\]", "") + return text + +// This is used when reading text that went through paper_markup2html(), to reverse it so that edits don't need to replace everything once more to avoid sanitization. +/proc/html2paper_markup(var/text) + text = replacetext(text, "
    ", "\[br\]") + text = replacetext(text, "
    ", "\[center\]") + text = replacetext(text, "
    ", "\[/center\]") + text = replacetext(text, "
    ", "\[br\]") + text = replacetext(text, "", "\[b\]") + text = replacetext(text, "", "\[/b\]") + text = replacetext(text, "", "\[i\]") + text = replacetext(text, "", "\[/i\]") + text = replacetext(text, "", "\[u\]") + text = replacetext(text, "", "\[/u\]") + text = replacetext(text, "", "\[large\]") + text = replacetext(text, "", "\[/large\]") + text = replacetext(text, "

    ", "\[h1\]") + text = replacetext(text, "

    ", "\[/h1\]") + text = replacetext(text, "

    ", "\[h2\]") + text = replacetext(text, "

    ", "\[/h2\]") + text = replacetext(text, "

    ", "\[h3\]") + text = replacetext(text, "

    ", "\[/h3\]") + + text = replacetext(text, "
  • ", "\[*\]") + text = replacetext(text, "
    ", "\[hr\]") + text = replacetext(text, "", "\[small\]") + text = replacetext(text, "", "\[/small\]") + text = replacetext(text, "", "\[/list\]") + text = replacetext(text, "", "\[table\]") + text = replacetext(text, "
    ", "\[/table\]") + text = replacetext(text, "", "\[grid\]") + text = replacetext(text, "
    ", "\[/grid\]") + text = replacetext(text, "", "\[row\]") + text = replacetext(text, "", "\[cell\]") + text = replacetext(text, "", "\[logo\]") // Not sure if these would get used but why not + text = replacetext(text, "", "\[sglogo\]") + return text #undef NEWSFILE \ No newline at end of file