Setting up the groundwork for handling paper under a DLL call to properly

format it utilizing the https://github.com/hoedown/hoedown library.
This commit is contained in:
ririchiyo
2015-03-24 17:00:51 -04:00
parent 0a70c03adc
commit 7f1b09a7c6
4 changed files with 71 additions and 11 deletions

View File

@@ -143,6 +143,7 @@
var/ghost_interaction = 0
var/comms_password = ""
var/paperwork_library = 0 //use the library DLL.
var/use_irc_bot = 0
var/irc_bot_host = "localhost"
@@ -475,6 +476,9 @@
if("comms_password")
config.comms_password = value
if("paperwork_library")
config.paperwork_library = 1
if("irc_bot_host")
config.irc_bot_host = value

View File

@@ -158,7 +158,8 @@ var/list/admin_verbs_debug = list(
/client/proc/qdel_toggle, // /vg/
/client/proc/cmd_admin_dump_instances, // /vg/
/client/proc/cmd_admin_dump_machine_type_list, // /vg/
/client/proc/disable_bloodvirii, // /vg/
/client/proc/disable_bloodvirii, // /vg
/client/proc/handle_paperwork, //this is completely experimental
/client/proc/reload_style_sheet,
/client/proc/reset_style_sheet,
/client/proc/test_movable_UI,

View File

@@ -14,7 +14,7 @@
// This WAS a macro, but BYOND a shit.
/proc/REG_BBTAG(x)
return "\\\[[x]\\\]"
// [x]blah[/x]
/proc/REG_BETWEEN_BBTAG(x)
return "[REG_BBTAG(x)]([REG_NOTBB])[REG_BBTAG("/[x]")]"
@@ -67,17 +67,69 @@
// Fallthrough just fucking kills the tag
addReplacement(REG_BBTAG("\[^\\\]\]"), "")
return
//var/stdshellout_dllFile = 'byond_markdown.dll'
var/paperwork = 0
var/paperwork_library
/client/proc/handle_paperwork()
set category = "Debug"
set name = "Modify Paperwork Mode"
if(!check_rights(R_DEBUG)) return
if(!paperwork)
paperwork_setup()
else
paperwork_stop()
paperwork = 0
/proc/paperwork_setup()
if(config.paperwork_library)
if(world.system_type == MS_WINDOWS)
paperwork_library = "markdown_byond.dll"
else
paperwork_library = "markdown_byond.so"
world.log << "Setting up paperwork..."
if(!fexists(paperwork_library))
world.log << "Paperwork was not properly setup, please notify a coder/host about this issue."
return
world.log << call(paperwork_library, "init_renderer")()
paperwork = 1
return 1
else
return 0
return 0
/proc/paperwork_stop()
if(!fexists(paperwork_library))
world.log << "Paperwork file may be missing or something terrible has happened, don't panic and notify a coder/host about this issue."
return
if(paperwork)
call(paperwork_library, "free_memory")()
return
else
return
/datum/writing_style/proc/parse_markdown(command_args)
// if(!fexists("byond_markdown.dll")){fcopy(stdshellout_dllFile,"[stdshellout_dllFile]")}
return call(paperwork_library,"render_html")(command_args)
/datum/writing_style/proc/Format(var/t, var/obj/item/weapon/pen/P, var/mob/user, var/obj/item/weapon/paper/paper)
if(expressions.len)
for(var/key in expressions)
var/datum/speech_filter_action/SFA = expressions[key]
if(SFA && !SFA.broken)
t = SFA.Run(t,user,paper)
t = replacetext(t, "\[sign\]", "<font face=\"Times New Roman\"><i>[user.real_name]</i></font>")
t = replacetext(t, "\[field\]", "<span class=\"paper_field\"></span>")
return "<span style=\"[style];color:[P.colour]\">[t]</span>"
if(paperwork)
t = parse_markdown(t)
else
if(expressions.len)
for(var/key in expressions)
var/datum/speech_filter_action/SFA = expressions[key]
if(SFA && !SFA.broken)
t = SFA.Run(t,user,paper)
t = replacetext(t, "\[sign\]", "<font face=\"Times New Roman\"><i>[user.real_name]</i></font>")
t = replacetext(t, "\[field\]", "<span class=\"paper_field\"></span>")
return "<span style=\"[style];color:[P.color]\">[t]</span>"
/datum/writing_style/pen/New()
addReplacement(REG_BBTAG("*"), "<li>")
addReplacement(REG_BBTAG("hr"), "<HR>")

View File

@@ -232,6 +232,9 @@ RESPAWN_AS_MOMMI
##Remove the # to let ghosts spin chairs
#GHOST_INTERACTION
## Uncomment to use the paperwork library
#PAPERWORK_LIBRARY
## Uncomment to enable sending data to the IRC bot.
#USE_IRC_BOT