This commit is contained in:
Kovid Goyal 2024-11-11 11:14:39 +05:30
parent ec445d6c32
commit 6b91f666e4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 7 deletions

View File

@ -12,8 +12,6 @@ import sys
import traceback import traceback
from functools import partial from functools import partial
from qt.webengine import QWebEngineView
from qt.core import ( from qt.core import (
QAbstractItemView, QAbstractItemView,
QApplication, QApplication,
@ -36,13 +34,13 @@ from qt.core import (
Qt, Qt,
QTableWidget, QTableWidget,
QTableWidgetItem, QTableWidgetItem,
QTextBrowser,
QTextCharFormat, QTextCharFormat,
QTextOption, QTextOption,
QToolButton, QToolButton,
QVBoxLayout, QVBoxLayout,
pyqtSignal, pyqtSignal,
) )
from qt.webengine import QWebEngineView
from calibre import sanitize_file_name from calibre import sanitize_file_name
from calibre.constants import config_dir from calibre.constants import config_dir

View File

@ -6,8 +6,10 @@ __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
from enum import IntEnum from enum import IntEnum
from calibre import prepare_string_for_xml from calibre import prepare_string_for_xml
class NodeKinds(IntEnum): class NodeKinds(IntEnum):
DOCUMENT = -1 DOCUMENT = -1
CODE_TEXT = -2 CODE_TEXT = -2
@ -413,7 +415,7 @@ class FFMLProcessor:
self.move_pos(len('``')) self.move_pos(len('``'))
end = self.find('``') end = self.find('``')
if end < 0: if end < 0:
self.error(f'Missing closing "``" for CODE_TEXT') self.error('Missing closing "``" for CODE_TEXT')
node = CodeText(self.text_to(end)) node = CodeText(self.text_to(end))
self.move_pos(end + len('``')) self.move_pos(end + len('``'))
return node return node
@ -422,7 +424,7 @@ class FFMLProcessor:
self.move_pos(1) self.move_pos(1)
end = self.find('`') end = self.find('`')
if end < 0: if end < 0:
self.error(f'Missing closing "`" for italics') self.error('Missing closing "`" for italics')
node = ItalicTextNode(self.text_to(end)) node = ItalicTextNode(self.text_to(end))
self.move_pos(end + 1) self.move_pos(end + 1)
return node return node
@ -431,7 +433,7 @@ class FFMLProcessor:
self.move_pos(len(':guilabel:`')) self.move_pos(len(':guilabel:`'))
end = self.find('`') end = self.find('`')
if end < 0: if end < 0:
self.error(f'Missing ` (backquote) for :guilabel:') self.error('Missing ` (backquote) for :guilabel:')
node = GuiLabelNode(self.text_to_no_newline(end, 'GUI_LABEL (:guilabel:`)')) node = GuiLabelNode(self.text_to_no_newline(end, 'GUI_LABEL (:guilabel:`)'))
self.move_pos(end + len('`')) self.move_pos(end + len('`'))
return node return node
@ -440,7 +442,7 @@ class FFMLProcessor:
self.move_pos(len('[CODE]\n')) self.move_pos(len('[CODE]\n'))
end = self.find('[/CODE]') end = self.find('[/CODE]')
if end < 0: if end < 0:
self.error(f'Missing [/CODE] for block') self.error('Missing [/CODE] for block')
node = CodeBlock(self.text_to(end)) node = CodeBlock(self.text_to(end))
self.move_pos(end + len('[/CODE]')) self.move_pos(end + len('[/CODE]'))
if self.text_to(1) == '\n': if self.text_to(1) == '\n':