QScintilla/MiniEditor.py

changeset 2221
f72f8b0478cb
parent 2217
e80c74f2a25a
child 2261
f4bb5648fc29
equal deleted inserted replaced
2219:031fae60d778 2221:f72f8b0478cb
2578 Private method to generate a dummy filename for binding a lexer. 2578 Private method to generate a dummy filename for binding a lexer.
2579 2579
2580 @param line0 first line of text to use in the generation process (string) 2580 @param line0 first line of text to use in the generation process (string)
2581 """ 2581 """
2582 bindName = self.__curFile 2582 bindName = self.__curFile
2583 2583 line0 = line0.lower()
2584 if line0.startswith("<?xml"): 2584
2585 # override extension for XML files 2585 # check first line if it does not start with #!
2586 if line0.startswith(("<html", "<!doctype html", "<?php")):
2587 bindName = "dummy.html"
2588 elif line0.startswith(("<?xml", "<!doctype")):
2586 bindName = "dummy.xml" 2589 bindName = "dummy.xml"
2590 elif line0.startswith("index: "):
2591 bindName = "dummy.diff"
2592 elif line0.startswith("\\documentclass"):
2593 bindName = "dummy.tex"
2587 2594
2588 # check filetype 2595 # check filetype
2589 if self.filetype in ["Python", "Python2", "Python3"]: 2596 if self.filetype in ["Python", "Python2", "Python3"]:
2590 bindName = "dummy.py" 2597 bindName = "dummy.py"
2591 elif self.filetype == "Ruby": 2598 elif self.filetype == "Ruby":

eric ide

mercurial