aerofly-missions
Version:
The Aerofly Missionsgerät converts simulator flight plan files for Aerofly FS 4, Microsoft Flight Simulator, X-Plane, GeoFS, and Garmin / Infinite Flight flight plan files. It also imports SimBrief flight plans.
48 lines (47 loc) • 1.31 kB
JavaScript
export const Quote = {
xml(text) {
return text.replace(/[<>"&']/g, (m) => {
switch (m) {
case "<":
return "<";
case ">":
return ">";
case "&":
return "&";
case '"':
return """;
case "'":
return "'";
default:
return m;
}
});
},
unXml(text) {
const cdataMatch = text.match(/^<!\[CDATA\[(.+?)\]\]>$/);
return cdataMatch
? cdataMatch[1]
: text.replace(/&([a-z]+);/g, (m, inner) => {
switch (inner) {
case "lt":
return "<";
case "gt":
return ">";
case "amp":
return "&";
case "quot":
return '"';
case "apos":
return "'";
default:
return m;
}
});
},
html(text) {
return Quote.xml(text);
},
tmc(text) {
return text.replace(/\]/g, "");
},
};