summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libutil.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2013-02-07 17:14:24 +0100
committerRaphael Langella <raphael.langella@gmail.com>2013-02-07 17:20:21 +0100
commite9ee9c3ea73a049d562968e6b6d795c5e5de1a3c (patch)
treebe393ce2e603a97b9def2f79a4b81735c4a66e1e /crawl-ref/source/libutil.cc
parentf3fda796abc503c756051304ac98f6300d682f6b (diff)
downloadcrawl-ref-e9ee9c3ea73a049d562968e6b6d795c5e5de1a3c.tar.gz
crawl-ref-e9ee9c3ea73a049d562968e6b6d795c5e5de1a3c.zip
Add support for a :nowrap tag at the beginning of descriptions.
Instruct the game that the entry doesn't need to be unwrapped, and the (upcoming) new transifex interface to not wrap it. For some entries, like in tutorial, wrapping actually impair readability and can make it hard or impossible to achieve proper formatting. More tags could be added to give meta information on entries which could help translations. I'm thinking of stuff like :gender or :plural. They could take a value too. They'd need to be parsed earlier though (db loading?) and stored somewhere.
Diffstat (limited to 'crawl-ref/source/libutil.cc')
-rw-r--r--crawl-ref/source/libutil.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index f28d77a52d..03f52075dd 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -1085,6 +1085,19 @@ string unwrap_desc(string desc)
trim_string_right(desc);
+ // Lines beginning with a colon are tags with a full entry scope
+ // Only nowrap is supported for now
+ while (desc[0] == ':')
+ {
+ int pos = desc.find("\n");
+ string tag = desc.substr(1, pos - 1);
+ desc.erase(0, pos + 1);
+ if (tag == "nowrap")
+ return desc;
+ else if (desc == "")
+ return "";
+ }
+
// An empty line separates paragraphs.
desc = replace_all(desc, "\n\n", "\\n\\n");
// Indented lines are pre-formatted.