Paper markdown (#30873)
* why it doesn't work * list thing * oops * fixes list. maybe * Less regex * wip * Done I think. I think * return your functions * Replace $10 by $a
This commit is contained in:
@@ -170,12 +170,19 @@
|
||||
t = replacetext(t, "\[td\]", "<td>")
|
||||
t = replacetext(t, "\[cell\]", "<td>")
|
||||
t = replacetext(t, "\[tab\]", " ")
|
||||
|
||||
t = parsemarkdown_basic(t)
|
||||
|
||||
return t
|
||||
|
||||
/datum/computer_file/program/filemanager/proc/prepare_printjob(t) // Additional stuff to parse if we want to print it and make a happy Head of Personnel. Forms FTW.
|
||||
t = replacetext(t, "\[field\]", "<span class=\"paper_field\"></span>")
|
||||
t = replacetext(t, "\[sign\]", "<span class=\"paper_field\"></span>")
|
||||
|
||||
t = parse_tags(t)
|
||||
|
||||
t = replacetext(t, regex("(?:%s(?:ign)|%f(?:ield))(?=\\s|$)", "ig"), "<span class=\"paper_field\"></span>")
|
||||
|
||||
return t
|
||||
|
||||
/datum/computer_file/program/filemanager/ui_data(mob/user)
|
||||
|
||||
@@ -187,47 +187,15 @@
|
||||
if(length(t) < 1) //No input means nothing needs to be parsed
|
||||
return
|
||||
|
||||
// t = copytext(sanitize(t),1,MAX_MESSAGE_LEN)
|
||||
|
||||
t = replacetext(t, "\[center\]", "<center>")
|
||||
t = replacetext(t, "\[/center\]", "</center>")
|
||||
t = replacetext(t, "\[br\]", "<BR>")
|
||||
t = replacetext(t, "\n", "<BR>")
|
||||
t = replacetext(t, "\[b\]", "<B>")
|
||||
t = replacetext(t, "\[/b\]", "</B>")
|
||||
t = replacetext(t, "\[i\]", "<I>")
|
||||
t = replacetext(t, "\[/i\]", "</I>")
|
||||
t = replacetext(t, "\[u\]", "<U>")
|
||||
t = replacetext(t, "\[/u\]", "</U>")
|
||||
t = replacetext(t, "\[large\]", "<font size=\"4\">")
|
||||
t = replacetext(t, "\[/large\]", "</font>")
|
||||
t = replacetext(t, "\[sign\]", "<font face=\"[SIGNFONT]\"><i>[user.real_name]</i></font>")
|
||||
t = replacetext(t, "\[field\]", "<span class=\"paper_field\"></span>")
|
||||
t = replacetext(t, "\[tab\]", " ")
|
||||
t = parsemarkdown(t, user, iscrayon)
|
||||
|
||||
if(!iscrayon)
|
||||
t = replacetext(t, "\[*\]", "<li>")
|
||||
t = replacetext(t, "\[hr\]", "<HR>")
|
||||
t = replacetext(t, "\[small\]", "<font size = \"1\">")
|
||||
t = replacetext(t, "\[/small\]", "</font>")
|
||||
t = replacetext(t, "\[list\]", "<ul>")
|
||||
t = replacetext(t, "\[/list\]", "</ul>")
|
||||
|
||||
t = "<font face=\"[P.font]\" color=[P.colour]>[t]</font>"
|
||||
else // If it is a crayon, and he still tries to use these, make them empty!
|
||||
else
|
||||
var/obj/item/toy/crayon/C = P
|
||||
t = replacetext(t, "\[*\]", "")
|
||||
t = replacetext(t, "\[hr\]", "")
|
||||
t = replacetext(t, "\[small\]", "")
|
||||
t = replacetext(t, "\[/small\]", "")
|
||||
t = replacetext(t, "\[list\]", "")
|
||||
t = replacetext(t, "\[/list\]", "")
|
||||
|
||||
t = "<font face=\"[CRAYON_FONT]\" color=[C.paint_color]><b>[t]</b></font>"
|
||||
|
||||
// t = replacetext(t, "#", "") // Junk converted to nothing!
|
||||
|
||||
//Count the fields
|
||||
// Count the fields
|
||||
var/laststart = 1
|
||||
while(1)
|
||||
var/i = findtext(t, "<span class=\"paper_field\">", laststart)
|
||||
@@ -253,22 +221,23 @@
|
||||
/obj/item/paper/proc/openhelp(mob/user)
|
||||
user << browse({"<HTML><HEAD><TITLE>Paper Help</TITLE></HEAD>
|
||||
<BODY>
|
||||
You can use backslash (\\) to escape special characters.<br>
|
||||
<br>
|
||||
<b><center>Crayon&Pen commands</center></b><br>
|
||||
<br>
|
||||
\[br\] : Creates a linebreak.<br>
|
||||
\[center\] - \[/center\] : Centers the text.<br>
|
||||
\[b\] - \[/b\] : Makes the text <b>bold</b>.<br>
|
||||
\[i\] - \[/i\] : Makes the text <i>italic</i>.<br>
|
||||
\[u\] - \[/u\] : Makes the text <u>underlined</u>.<br>
|
||||
\[large\] - \[/large\] : Increases the <font size = \"4\">size</font> of the text.<br>
|
||||
\[sign\] : Inserts a signature of your name in a foolproof way.<br>
|
||||
\[field\] : Inserts an invisible field which lets you start type from there. Useful for forms.<br>
|
||||
# text : Defines a header.<br>
|
||||
|text| : Centers the text.<br>
|
||||
**text** : Makes the text <b>bold</b>.<br>
|
||||
*text* : Makes the text <i>italic</i>.<br>
|
||||
^text^ : Increases the <font size = \"4\">size</font> of the text.<br>
|
||||
%s : Inserts a signature of your name in a foolproof way.<br>
|
||||
%f : Inserts an invisible field which lets you start type from there. Useful for forms.<br>
|
||||
<br>
|
||||
<b><center>Pen exclusive commands</center></b><br>
|
||||
\[small\] - \[/small\] : Decreases the <font size = \"1\">size</font> of the text.<br>
|
||||
\[list\] - \[/list\] : A list.<br>
|
||||
\[*\] : A dot used for lists.<br>
|
||||
\[hr\] : Adds a horizontal rule.
|
||||
((text)) : Decreases the <font size = \"1\">size</font> of the text.<br>
|
||||
* item : An unordered list item.<br>
|
||||
* item: An unordered list child item.<br>
|
||||
--- : Adds a horizontal rule.
|
||||
</BODY></HTML>"}, "window=paper_help")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user