On Thu, 2017-06-15 at 10:05 +0200, Daniel Dekany wrote: > Thursday, June 15, 2017, 8:33:22 AM, Denis Bredelet wrote: > > > > BTW, we also have this thing (agreed upon earlier), that for the sake > > > of easier tooling like IDE plugins, we will remove syntax auto > > > detection, and instead rely on extension. (I'm yet to see any tool > > > that can deal with FM2 syntax detection, unless it has used FreeMarker > > > itself to parse the template... so we can conclude that it didn't work > > > out very well in practice.) So we will need one more variation on all > > > of all these for square bracket syntax. Maybe fm3s, fm3sx, fm3sh (ugh, > > > my eyes…). > > > > You can put is as prefix sfm3, sfm3x, sfm3h (or sf3, sf3x, sf3h - Street > > Fighter here we come!). > > Then the output format ("", "x", "h", etc.) is clearly separated from > the syntactical variation ("", "s", so far). That's an advantage. But > because everything has to be a compromise, there's the drawback that > it's somewhat harder to identify for users that the file belongs to > FreeMarker. > > Also note that because of the planned dialects feature, we will need > some rule regarding which file extensions we reserved for standard > language variations. One idea is that anything that starts with "fm" > is reserved for "official" FreeMarker files. (We could also reserver > "sfm", but it's not a future proof approach, as we possibly will have > more kind of files in the future.) Though we might as well reserve all > extensions that contain "fm" anywhere.
I've always preferred the multiple extension approach to things like this, following a process and remove sort of pattern. For example instead of using something like .ftlx or .ftlh use .xml.ftl or .html.ftl that when processed result in a .xml or .html file or snippet. This is more clear (and in some cases editor/IDE friendly) because the standard extensions are used and chained as needed. On .ftl vs .fm3: One nice thing about .ftl is it has a sort of brand recognition associated with FreeMarker (Template Language). It looks like .fm3 was for a Lotus 1-2-3 spreadsheet extension, now obsolete but a lot of software and existing mime type mappings may still use it. A common pattern for syntax and other variations within a file is to use a header at the beginning of the file to describe them. This is true of .xml and .html files, though in practice applied in different ways. In XML files something like the '<?xml version="1.0" encoding="UTF-8"?>' first line is always used as version '1.0' is the only commonly used version while 'dialects' (not really the exact concept we're discussing for FreeMarker, but similar) are described with additional attributes on the root element. For .html the standard header to use has varied over time. One advantage to using the first line approach is that it is much more flexible as you have more space and can even structure it, and another is that it allows the file extension (and related mime type) to remain stable over time. On the topic of mime types I don't know if 'text/x-freemarker' is official in any way for .ftl files but it seems the most commonly used one. Along with file name extensions It is also nice to mime types for remain stable over time. Some food for thought... and apologies that these comments open the discussion more instead of narrowing down a decision. -David