From 52687894ab3f215d404b8e84137c87d5afedef35 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 30 Mar 2017 16:01:16 -0500 Subject: [PATCH] Tweak _filelist--color coding. --- calibre-plugin/inihighlighter.py | 12 ++++-------- fanficfare/adapters/adapter_test1.py | 1 - 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/calibre-plugin/inihighlighter.py b/calibre-plugin/inihighlighter.py index 131ca43e..5b169fcc 100644 --- a/calibre-plugin/inihighlighter.py +++ b/calibre-plugin/inihighlighter.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, print_function) __license__ = 'GPL v3' -__copyright__ = '2016, Jim Miller' +__copyright__ = '2017, Jim Miller' __docformat__ = 'restructuredtext en' import re @@ -14,10 +14,6 @@ try: except ImportError as e: from PyQt4.Qt import (Qt, QSyntaxHighlighter, QTextCharFormat, QBrush, QFont) -# r'add_to_+key - - - class IniHighlighter(QSyntaxHighlighter): ''' QSyntaxHighlighter class for use with QTextEdit for highlighting @@ -44,16 +40,16 @@ class IniHighlighter(QSyntaxHighlighter): # *all* entry keywords -- change known later. reentrykeywords = r'('+(r'|'.join([ e % r'[a-zA-Z0-9_]+' for e in entry_keywords ]))+r')' - self.highlightingRules.append( HighlightingRule( r"^(add_to_)?"+reentrykeywords+r"\s*[:=]", Qt.darkMagenta ) ) + self.highlightingRules.append( HighlightingRule( r"^(add_to_)?"+reentrykeywords+r"(_filelist)?\s*[:=]", Qt.darkMagenta ) ) if entries: # separate from known entries so entry named keyword won't be masked. # *known* entry keywords reentrykeywords = r'('+(r'|'.join([ e % reentries for e in entry_keywords ]))+r')' - self.highlightingRules.append( HighlightingRule( r"^(add_to_)?"+reentrykeywords+r"\s*[:=]", Qt.blue ) ) + self.highlightingRules.append( HighlightingRule( r"^(add_to_)?"+reentrykeywords+r"(_filelist)?\s*[:=]", Qt.blue ) ) # *known* keywords rekeywords = r'('+(r'|'.join(keywords))+r')' - self.highlightingRules.append( HighlightingRule( r"^(add_to_)?"+rekeywords+r"\s*[:=]", Qt.blue ) ) + self.highlightingRules.append( HighlightingRule( r"^(add_to_)?"+rekeywords+r"(_filelist)?\s*[:=]", Qt.blue ) ) # *all* sections -- change known later. self.highlightingRules.append( HighlightingRule( r"^\[[^\]]+\].*?$", Qt.red, QFont.Bold, blocknum=1 ) ) diff --git a/fanficfare/adapters/adapter_test1.py b/fanficfare/adapters/adapter_test1.py index 2001984c..2515b4e0 100644 --- a/fanficfare/adapters/adapter_test1.py +++ b/fanficfare/adapters/adapter_test1.py @@ -326,7 +326,6 @@ Some more longer description. "I suck at summaries!" "Better than it sounds!"

Prologue

This is a fake adapter for testing purposes. Different sid's will give different errors:

-

Config(personal.ini)

sid>=1000 will use custom test story data from your configuration(personal.ini)

Hard coded ids:

http://test1.com?sid=664 - Crazy string title