Hansa::Modeline
Content-based modeline detection, ported from go-enry v2's GetLanguagesByModeline strategy. Emacs modelines are checked first, then Vim ones, over the first and last 5 lines.
Constants
EMACS_LANG = /(?i:mode)\s*:\s*([^\s;]+)/
EMACS_MODELINE = /-\*-\s*(.+?)\s*-\*-/
SEARCH_SCOPE = 5
VIM_LANG = /(?i:filetype|ft|syntax)\s*=(\w+)(?:\s|:|$)/
VIM_MODELINE = /(?:(?:\s|^)vi(?:m[<=>]?\d+|m)?|[\t ]*ex)\s*:\s*(.*)$/