Add simple auto-detection for HTML files without proper extension.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3145 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-10-23 18:44:05 +00:00
parent 96b28080a6
commit 57c764867c
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2008-10-23 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/filetypes.c:
Add simple auto-detection for HTML files without proper extension.
2008-10-22 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
* data/html_entities.tags:

View File

@ -738,8 +738,13 @@ static GeanyFiletype *find_shebang(const gchar *utf8_filename, const gchar *line
g_free(tmp);
}
/* detect HTML files */
if (strncmp(line, "<!DOCTYPE html", 14) == 0 || strncmp(line, "<html", 5) == 0)
{
ft = filetypes[GEANY_FILETYPES_HTML];
}
/* detect XML files */
if (utf8_filename && strncmp(line, "<?xml", 5) == 0)
else if (utf8_filename && strncmp(line, "<?xml", 5) == 0)
{
/* HTML and DocBook files might also start with <?xml, so detect them based on filename
* extension and use the detected filetype, else assume XML */