Set of utilities for working with files and text content.
File extensions - hard-coded for now, but may want to make these preferences
var _staticHtmlFileExts = ["htm", "html", "xhtml"],
_serverHtmlFileExts = ["php", "php3", "php4", "php5", "phtm", "phtml", "cfm", "cfml", "asp", "aspx", "jsp", "jspx", "shtm", "shtml"];
Returns true if we think the given extension is for an HTML file.
function isHtmlFileExt(ext) {
return (isStaticHtmlFileExt(ext) ||
(ProjectManager.getBaseUrl() && isServerHtmlFileExt(ext)));
}
// Define public API
exports.isHtmlFileExt = isHtmlFileExt;
exports.isStaticHtmlFileExt = isStaticHtmlFileExt;
exports.isServerHtmlFileExt = isServerHtmlFileExt;
});
Determine if file extension is a server html file extension.
function isServerHtmlFileExt(filePath) {
if (!filePath) {
return false;
}
return (_serverHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
}
Determine if file extension is a static html file extension.
function isStaticHtmlFileExt(filePath) {
if (!filePath) {
return false;
}
return (_staticHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
}