From 19e3b59c862faa7572d62e06260fefad91d546b6 Mon Sep 17 00:00:00 2001 From: Tastyfish Date: Wed, 9 Mar 2016 01:25:31 -0500 Subject: [PATCH] Fixes some paper scanner stuff --- code/modules/pda/utilities.dm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/modules/pda/utilities.dm b/code/modules/pda/utilities.dm index 8ebbc78fcfe..6d4feacb457 100644 --- a/code/modules/pda/utilities.dm +++ b/code/modules/pda/utilities.dm @@ -157,11 +157,12 @@ /datum/data/pda/utility/scanmode/notes/scan_atom(atom/A as mob|obj|turf|area, mob/user as mob) if(notes && istype(A, /obj/item/weapon/paper)) var/obj/item/weapon/paper/P = A + var/list/brlist = list("p", "/p", "br", "hr", "h1", "h2", "h3", "h4", "/h1", "/h2", "/h3", "/h4") // JMO 20140705: Makes scanned document show up properly in the notes. Not pretty for formatted documents, // as this will clobber the HTML, but at least it lets you scan a document. You can restore the original // notes by editing the note again. (Was going to allow you to edit, but scanned documents are too long.) - var/raw_scan = P.info + var/raw_scan = sanitize_simple(P.info, list("\t" = "", "ÿ" = "")) var/formatted_scan = "" // Scrub out the tags (replacing a few formatting ones along the way) // Find the beginning and end of the first tag. @@ -177,7 +178,7 @@ // If we have a space after the tag (and presumably attributes) just crop that off. if(tagend) tag = copytext(tag, 1, tagend) - if(tag == "p" || tag == "/p" || tag == "br") // Check if it's I vertical space tag. + if(tag in brlist) // Check if it's I vertical space tag. formatted_scan = formatted_scan + "
" // If so, add some padding in. raw_scan = copytext(raw_scan, tag_stop + 1) // continue on with the stuff after the tag // Look for the next tag in what's left @@ -187,9 +188,9 @@ formatted_scan = formatted_scan + raw_scan // If there is something in there already, pad it out. if(length(notes.note) > 0) - notes.note = notes.note + "

" + notes.note += "

" // Store the scanned document to the notes - notes.note = "Scanned Document. Edit to restore previous notes/delete scan.
----------
" + formatted_scan + "
" + notes.note += "Scanned Document. Edit to restore previous notes/delete scan.
----------
" + formatted_scan + "
" // notehtml ISN'T set to allow user to get their old notes back. A better implementation would add a "scanned documents" // feature to the PDA, which would better convey the availability of the feature, but this will work for now. // Inform the user