diff --git a/ChangeLog.txt b/ChangeLog.txt index 33403311fa..9eebcfa14f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,8 +3,10 @@ pre-2.x.x - assign menu accelerators P - &Plugins, and K - Chec&kpoints (thank you BeckyEbook) - add ability to change keyboard focus using keyboard shortcuts or menus to BookBrowser, Preview, CodeView, ClipsWindow, and TableOfContents Windows - Bug Fixes - - patch Qt6.5.3 to avoid transient child window resize bug on Windows + Bug Fixes + - patch Qt6.5.3 to avoid transient child window resize bug on Windows + - fix QuickParser bug when parseing attribute names not properly ignoreing all legal whitespace + Sigil-2.0.2 Bug Fixes diff --git a/src/Parsers/QuickParser.cpp b/src/Parsers/QuickParser.cpp index 051ecc0b7c..24f0919060 100644 --- a/src/Parsers/QuickParser.cpp +++ b/src/Parsers/QuickParser.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** -** Copyright (C) 2020-2021 Kevin B. Hendricks, Stratford Ontario +** Copyright (C) 2020-2023 Kevin B. Hendricks, Stratford Ontario ** ** This file is part of Sigil. ** @@ -29,6 +29,8 @@ #include "Misc/Utility.h" #include "Parsers/QuickParser.h" +const QString WHITESPACE_CHARS=" \v\t\n\r\f"; + QuickParser::QuickParser(const QString &source, QString default_lang) : m_source(source), m_pos(0), @@ -261,7 +263,7 @@ int QuickParser::findTarget(const QString &tgt, int p, bool after) int QuickParser::skipAnyBlanks(const QStringRef &tgt, int p) { - while((p < tgt.length()) && (tgt.at(p) == ' ')) p++; + while((p < tgt.length()) && (WHITESPACE_CHARS.contains(tgt.at(p)))) p++; return p; } diff --git a/src/Resource_Files/plugin_launchers/python/quickparser.py b/src/Resource_Files/plugin_launchers/python/quickparser.py index f82647afb6..36d8faca41 100644 --- a/src/Resource_Files/plugin_launchers/python/quickparser.py +++ b/src/Resource_Files/plugin_launchers/python/quickparser.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab -# Copyright (c) 2014-2021 Kevin B. Hendricks, and Doug Massay +# Copyright (c) 2014-2023 Kevin B. Hendricks, and Doug Massay # Copyright (c) 2014 John Schember # All rights reserved. # @@ -39,6 +39,8 @@ SPECIAL_HANDLING_TYPES = ['xmlheader', 'doctype', 'comment', 'cdata', 'pi'] +WHITESPACE_CHARS = (' ', '\n', '\r', '\f', '\t', '\v') + class QuickXHTMLParser(object): def __init__(self): @@ -109,14 +111,14 @@ def parsetag(self, s): if ttype is None: # parse any attributes while s.find('=', p) != -1 : - while p < n and s[p:p + 1] == ' ' : p += 1 + while p < n and s[p:p + 1] in WHITESPACE_CHARS : p += 1 b = p while p < n and s[p:p + 1] != '=' : p += 1 # attribute names can be mixed case and are in SVG aname = s[b:p] aname = aname.rstrip(' ') p += 1 - while p < n and s[p:p + 1] == ' ' : p += 1 + while p < n and s[p:p + 1] in WHITESPACE_CHARS : p += 1 if s[p:p + 1] in ('"', "'") : qt = s[p:p + 1] p = p + 1