From ac954b825bf22851fad303e33bd27f76ab70c510 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Fri, 6 Aug 2021 09:43:28 +0200 Subject: Make sure title is always assigned in _metadata search Fixes #1 --- epubgrep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epubgrep.py b/epubgrep.py index 718554a..b6c3720 100755 --- a/epubgrep.py +++ b/epubgrep.py @@ -95,6 +95,7 @@ def _metadata_search(mdata: dict, sre: re.Pattern, fname: str, :param: col: should we colorize the output """ out = '' + title = '' decoded_line = mdata.get('description') tags = mdata.get('subject') @@ -104,7 +105,6 @@ def _metadata_search(mdata: dict, sre: re.Pattern, fname: str, title = f'\n{fname}' out += title + '\n' out += _colorize_found(decoded_line, res, col) - title = '' if tags: for tag in tags: res = sre.search(tag) -- cgit