mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix parsing of class and category declaration line in layout files
* Omit commented-out lines * Properly escape backslash * Do not allow non-space chars after delaration * Allow blanks before # comment character Fixes: #9746
This commit is contained in:
parent
4b647c68a1
commit
c78352af07
@ -1150,8 +1150,8 @@ def processLayoutFile(file, bool_docbook):
|
||||
return x.strip()
|
||||
classname = file.split(os.sep)[-1].split('.')[0]
|
||||
# return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article}
|
||||
p = re.compile(r'\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}')
|
||||
q = re.compile(r'\DeclareCategory{(.*)}')
|
||||
p = re.compile(r'^\s*#\s*\\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
|
||||
q = re.compile(r'^\s*#\s*\\DeclareCategory{(.*)}\s*$')
|
||||
classdeclaration = ""
|
||||
categorydeclaration = '""'
|
||||
for line in open(file).readlines():
|
||||
@ -1246,8 +1246,8 @@ def checkLatexConfig(check_config, bool_docbook):
|
||||
# Construct the list of classes to test for.
|
||||
# build the list of available layout files and convert it to commands
|
||||
# for chkconfig.ltx
|
||||
declare = re.compile(r'\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}')
|
||||
category = re.compile(r'\DeclareCategory{(.*)}')
|
||||
declare = re.compile(r'^\s*#\s*\\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
|
||||
category = re.compile(r'^\s*#\s*\\DeclareCategory{(.*)}\s*$')
|
||||
empty = re.compile(r'^\s*$')
|
||||
testclasses = list()
|
||||
for file in glob.glob( os.path.join('layouts', '*.layout') ) + \
|
||||
|
@ -287,9 +287,9 @@ LayoutFileIndex LayoutFileList::addLocalLayout(
|
||||
// which uses the following regex
|
||||
// \Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}
|
||||
ifstream ifs(layout_file.toFilesystemEncoding().c_str());
|
||||
static regex const reg("^#\\s*\\\\Declare(LaTeX|DocBook)Class\\s*"
|
||||
static regex const reg("^\\s*#\\s*\\\\Declare(LaTeX|DocBook)Class\\s*"
|
||||
"(?:\\[([^,]*)(?:,.*)*\\])*\\s*\\{(.*)\\}\\s*");
|
||||
static regex const catreg("^#\\s*\\\\DeclareCategory\\{(.*)\\}");
|
||||
static regex const catreg("^\\s*#\\s*\\\\DeclareCategory\\{(.*)\\}\\s*");
|
||||
string line;
|
||||
string class_name;
|
||||
string class_prereq;
|
||||
|
@ -80,6 +80,9 @@ What's new
|
||||
|
||||
* INTERNALS
|
||||
|
||||
- Fix parsing problems of class and category declaration line in layout files
|
||||
that could break the textclass detection (bug 9746).
|
||||
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
Loading…
Reference in New Issue
Block a user