1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-11-27 00:43:47 +00:00

Set default.lang if user's lang is not found.

This commit is contained in:
King_DuckZ 2017-05-08 09:17:45 +01:00
parent 07135f215c
commit 9e1e18dcf0

View file

@ -55,9 +55,10 @@ namespace tawashi {
else {
srchilite::LangMap lang_map(m_langmap_dir, "lang.map");
lang_map.open();
m_lang_file.clear();
if (not query_str.empty())
m_lang_file = lang_map.getFileName(query_str);
else
if (m_lang_file.empty())
m_lang_file = "default.lang";
}
}
@ -75,7 +76,6 @@ namespace tawashi {
highlighter.setDataDir(settings().as<std::string>("langmap_dir"));
highlighter.setGenerateEntireDoc(false);
highlighter.setGenerateLineNumbers(true);
const auto lang = m_lang_file;
std::string processed_pastie;
if (m_syntax_highlight) {
@ -89,7 +89,7 @@ namespace tawashi {
if (not m_plain_text and m_syntax_highlight) {
std::istringstream iss(std::move(processed_pastie));
std::ostringstream oss;
highlighter.highlight(iss, oss, lang);
highlighter.highlight(iss, oss, m_lang_file);
processed_pastie = oss.str();
}