mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-22 22:54:33 +01:00
e34504c5e3
## About The Pull Request ### Trimming So as per #89165, paper below 5000 characters was getting cut off despite being below the cap. This seems to have been happening because of the following code: https://github.com/tgstation/tgstation/blob/d8774f4c4176f09463457f04905570923b27b3de/code/modules/library/book_info.dm#L44-L50 Paper uses the raw text for its count and handles pen color/font/boldness/such tgui-side, but books first expand that html dm-side AND then encode it, significantly increasing the amount of characters before trimming occurs. This, obviously, leads to characters getting cut off! Buuuuuuuut not trimming it at all isn't perfect. We know paper *should* trim it, but we also know that's not gonna be all paper. There's gonna be paper where it's inexplicably past the 5000 characters cap. So, instead we use a second more lenient book limit, right now defined as 2x the paper limit, which should stop the worst cases without breaking for the best cases. ### Newlines Second bit! Paper stores each writing attempt as a separate thing, but turning them into books collapses these: https://github.com/tgstation/tgstation/blob/d8774f4c4176f09463457f04905570923b27b3de/code/modules/library/book_info.dm#L46-L48 This, however, doesn't account for the part where paper tgui inserts newlines between these inputs: https://github.com/tgstation/tgstation/blob/d8774f4c4176f09463457f04905570923b27b3de/tgui/packages/tgui/interfaces/PaperSheet/Preview.tsx#L317-L318 Which book tgui doesn't! Cause it's just one big glob of text, not separate entries. Which in turn means paper written with multiple entries just... has all of these put on the same line, which sucks. So we make the paper entries collapsing actually add newlines the same way, fixing our issue. ### Nitpicks ...We also change the `to_raw_html(...)` proc to re-use the same `<font>` tag. Regrettably, we can't use the exact same setup as paperwork uses on its tgui side because it uses `style` which would get sanitized out, but there's no reason for us to double the amount of characters behind the scenes by using multiple layered `<font>` tags for no reason. ***Ideally*** I feel books and paper should just use the same tgui systems, but I sure as hell wouldn't know how to do that without breaking everything including old books, with how fickle paperwork code already is. ## Why It's Good For The Game Fixes #89165. fix jank 👍 It *really* sucks when you make a book below the 5000 character cap, but it somehow hits the character cap and gets trimmed anyway. I feel the books using static ui data should avoid this being horrible. ## Changelog 🆑 fix: Books no longer get trimmed below the paper length limit. fix: Books made using paperwork created with multiple inputs no longer put all that text on the same line. /🆑