mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-30 14:10:24 +02:00
v108.9
* multi-monitor support * improved pause/frame advance support * added option to disable video dimming when idle
This commit is contained in:
@@ -52,7 +52,7 @@ template<typename T> auto string::_prepend(const stringify<T>& source) -> string
|
||||
|
||||
template<typename T, typename... P> auto string::append(const T& value, P&&... p) -> string& {
|
||||
_append(make_string(value));
|
||||
if constexpr(sizeof...(p)) append(forward<P>(p)...);
|
||||
if constexpr(sizeof...(p) > 0) append(forward<P>(p)...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,8 @@ private:
|
||||
string value;
|
||||
};
|
||||
vector<Variable> variables;
|
||||
bool inMedia = false;
|
||||
bool inMediaNode = false;
|
||||
|
||||
auto parseDocument(const string& filedata, const string& pathname, uint depth) -> bool;
|
||||
};
|
||||
@@ -57,7 +59,7 @@ inline auto CML::parseDocument(const string& filedata, const string& pathname, u
|
||||
|
||||
for(auto& block : filedata.split("\n\n")) {
|
||||
auto lines = block.stripRight().split("\n");
|
||||
auto name = lines.takeLeft();
|
||||
auto name = lines.takeFirst();
|
||||
|
||||
if(name.beginsWith("include ")) {
|
||||
name.trimLeft("include ", 1L);
|
||||
@@ -76,7 +78,16 @@ inline auto CML::parseDocument(const string& filedata, const string& pathname, u
|
||||
}
|
||||
|
||||
state.output.append(name, " {\n");
|
||||
inMedia = name.beginsWith("@media");
|
||||
|
||||
for(auto& line : lines) {
|
||||
if(inMedia && !line.find(": ")) {
|
||||
if(inMediaNode) state.output.append(" }\n");
|
||||
state.output.append(line, " {\n");
|
||||
inMediaNode = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
auto data = line.split(":", 1L).strip();
|
||||
auto name = data(0), value = data(1);
|
||||
while(auto offset = value.find("var(")) {
|
||||
@@ -93,9 +104,13 @@ inline auto CML::parseDocument(const string& filedata, const string& pathname, u
|
||||
}
|
||||
if(!found) break;
|
||||
}
|
||||
state.output.append(" ", name, ": ", value, ";\n");
|
||||
state.output.append(inMedia ? " " : " ", name, ": ", value, ";\n");
|
||||
if(name == "box-sizing") vendorAppend(name, value);
|
||||
}
|
||||
if(inMediaNode) {
|
||||
state.output.append(" }\n");
|
||||
inMediaNode = false;
|
||||
}
|
||||
state.output.append("}\n\n");
|
||||
}
|
||||
|
||||
|
@@ -90,12 +90,12 @@ inline auto DML::parseBlock(string& block, const string& pathname, uint depth) -
|
||||
auto content = lines.takeLeft().trimLeft("# ", 1L).split("::", 1L).strip();
|
||||
auto data = markup(content[0]);
|
||||
auto name = escape(content(1, data.hash()));
|
||||
state.output.append("<header id=\"", name, "\">", data);
|
||||
state.output.append("<h1 id=\"", name, "\">", data);
|
||||
for(auto& line : lines) {
|
||||
if(!line.beginsWith("# ")) continue;
|
||||
state.output.append("<span>", line.trimLeft("# ", 1L), "</span>");
|
||||
}
|
||||
state.output.append("</header>\n");
|
||||
state.output.append("</h1>\n");
|
||||
}
|
||||
|
||||
//header
|
||||
@@ -103,13 +103,13 @@ inline auto DML::parseBlock(string& block, const string& pathname, uint depth) -
|
||||
auto content = slice(lines.takeLeft(), depth + 1).split("::", 1L).strip();
|
||||
auto data = markup(content[0]);
|
||||
auto name = escape(content(1, data.hash()));
|
||||
if(depth <= 6) {
|
||||
state.output.append("<h", depth, " id=\"", name, "\">", data);
|
||||
if(depth <= 5) {
|
||||
state.output.append("<h", depth + 1, " id=\"", name, "\">", data);
|
||||
for(auto& line : lines) {
|
||||
if(count(line, '=') != depth) continue;
|
||||
state.output.append("<span>", slice(line, depth + 1), "</span>");
|
||||
}
|
||||
state.output.append("</h", depth, ">\n");
|
||||
state.output.append("</h", depth + 1, ">\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,12 +215,13 @@ inline auto DML::markup(const string& s) -> string {
|
||||
|
||||
natural link, linkBase;
|
||||
natural embed, embedBase;
|
||||
natural iframe, iframeBase;
|
||||
|
||||
for(uint n = 0; n < s.size();) {
|
||||
char a = s[n];
|
||||
char b = s[n + 1];
|
||||
|
||||
if(!link && !embed) {
|
||||
if(!link && !embed && !iframe) {
|
||||
if(a == '*' && b == '*') { t.append(strong.flip() ? "<strong>" : "</strong>"); n += 2; continue; }
|
||||
if(a == '/' && b == '/') { t.append(emphasis.flip() ? "<em>" : "</em>"); n += 2; continue; }
|
||||
if(a == '_' && b == '_') { t.append(insertion.flip() ? "<ins>" : "</ins>"); n += 2; continue; }
|
||||
@@ -229,6 +230,9 @@ inline auto DML::markup(const string& s) -> string {
|
||||
if(a =='\\' && b =='\\') { t.append("<br>"); n += 2; continue; }
|
||||
}
|
||||
|
||||
if(iframe == 0 && a == '<' && b == '<') { t.append("<iframe width='772' height='434' src=\""); iframe = 1; iframeBase = n += 2; continue; }
|
||||
if(iframe != 0 && a == '>' && b == '>') { t.append("\" frameborder='0' allowfullscreen></iframe>"); iframe = 0; n += 2; continue; }
|
||||
|
||||
if(!embed) {
|
||||
if(link == 0 && a == '[' && b == '[') { t.append("<a href=\""); link = 1; linkBase = n += 2; continue; }
|
||||
if(link == 1 && a == ':' && b == ':') { t.append("\">"); link = 2; n += 2; continue; }
|
||||
|
Reference in New Issue
Block a user