LightTable/LightTable — pull request #1208 by cndreisbach (2014-01-29 00:28:28+00:00)
Title: Improve extension support

Previously, extensions could be registered with MIME-type info and
editor tags only by the last segment of their filename. For example, the
extensions for the following files:

index.html -> "html"
index.html.erb -> "erb"
Dockerfile -> nil

Supporting different extension types is useful, but blinding taking all
segments after the first dot isn't good either:

i.like.to.name.files.with.periods.txt -> ".like.to..."

The solution is to create a series of file segments, from most specific
to least specific to check against. Taking our first examples again, we
get the following:

index.html -> ["index.html" "html"]
index.html.erb -> ["index.html" "html.erb" "erb"]
Dockerfile -> ["Dockerfile"]

Now, if we look for registered "extensions" (these can be whole
filenames), we can take the first one we see. For example, .erb
represents a templating language often used in Ruby, and extensions
before .erb are the target file type and will often have markup for that
type. So, for a .html.erb file, you want to have :editor.html as a tag
for sure, but probably also :editor.erb. For all other .erb files, just
:editor.erb is needed. You could register both the extension .html.erb
and .erb. "index.html.erb" would find the former, while mail.txt.erb
would find the latter.

This should allow much more flexibility in registering extensions.
I specifically need this for a Hoplon plugin.