make it possible to activate highlighter only for specific file types
In stage 1 we use a glob pattern matching the file name. Stage 2 (which I will maybe implement some day) might use some additional magic byte sequence for file type detection.
This commit is contained in:
@@ -24,12 +24,13 @@ class LogFileModel:
|
||||
def __init__(self, file: str, settings: Settings):
|
||||
self.settings = settings
|
||||
self._file = os.path.realpath(file)
|
||||
self._file_name = os.path.basename(self._file)
|
||||
|
||||
def highlighters(self):
|
||||
all_highlighters = Highlighting.read_config(self.settings)
|
||||
active_highlighters = []
|
||||
for h in all_highlighters:
|
||||
if h.is_active():
|
||||
if h.is_active() and h.file_type_matches(self._file_name):
|
||||
active_highlighters.append(h)
|
||||
return active_highlighters
|
||||
|
||||
|
||||
Reference in New Issue
Block a user