Skip to content

Commit

Permalink
Add automatic UTF-8 insertion (#86)
Browse files Browse the repository at this point in the history
* Add automatic UTF-8 insertion

* Pew

* Pew pew

* Include mod
  • Loading branch information
SuhEugene authored May 26, 2024
1 parent 653be6a commit be0ba9b
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
#include "code\__defines\dcs\flags.dm"
#include "code\__defines\dcs\helpers.dm"
#include "code\__defines\dcs\signals.dm"
#include "code\__defines\~mods\_master_defines.dm"
#include "code\_global_vars\configuration.dm"
#include "code\_global_vars\logging.dm"
#include "code\_global_vars\misc.dm"
Expand Down
5 changes: 5 additions & 0 deletions code/__defines/~mods/_master_defines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

// UTF_8 - Start
#undef show_browser
#define show_browser(target, content, title) to_target(target, browse(add_utf_8_to_html(content), title))
// UTF_8 - End
1 change: 1 addition & 0 deletions mod_celadon/mod_celadon.dme
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "laptop_rotate/_laptop_rotate.dme"
#include "opisanie_scp/_opisanie_scp.dme"
#include "sci_job_names/_sci_job_names.dme"
#include "utf_8/_utf_8.dme"

// --- OBJECTS --- //
#include "objects/_objects.dme"
Expand Down
33 changes: 33 additions & 0 deletions mod_celadon/utf_8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@


#### Список PRов:

- https://github.com/CeladonSS13/Foundation-19/pulls/86

## UTF-8

ID мода: UTF_8

### Описание мода

Добавляет в любую строку, отправляемую клиенту как браузерное окно необходимый для отображения кириллицы мета-тег.

### Изменения *кор кода*

- Отсутствуют

### Оверрайды

- Отсутствуют

### Дефайны

- `code/__defines/~mods/_master_defines.dm`: `show_browser`

### Используемые файлы, не содержащиеся в модпаке

- Отсутствуют

### Авторы:

SuhEugene
4 changes: 4 additions & 0 deletions mod_celadon/utf_8/_utf_8.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/datum/modpack/utf_8
name = "UTF-8"
desc = "Чинит отображение кириллицы вообще везде, где только может"
author = "SuhEugene"
7 changes: 7 additions & 0 deletions mod_celadon/utf_8/_utf_8.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef MODPACK_CELADON_UTF_8
#define MODPACK_CELADON_UTF_8

#include "_utf_8.dm"
#include "code/utf_8.dm"

#endif
7 changes: 7 additions & 0 deletions mod_celadon/utf_8/code/utf_8.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/proc/add_utf_8_to_html(browser_content)
if (isnull(browser_content) || isfile(browser_content))
return browser_content
else if(findtext(browser_content, "<html>"))
return replacetext(browser_content, "<html>", "<html><meta charset='UTF-8'>")
else
return "<html><meta charset='UTF-8'><body>[browser_content]</body></html>"

0 comments on commit be0ba9b

Please sign in to comment.