aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2021-08-06 09:43:28 +0200
committerMatěj Cepl <mcepl@cepl.eu>2021-08-06 09:43:33 +0200
commitac954b825bf22851fad303e33bd27f76ab70c510 (patch)
treef07ca599ec7118f666ebab98a2c5c124e7b97ca8
parent83ed6b960eafdc4763c6a0aebc691ec2ef3d2db2 (diff)
downloadepubgrep-ac954b825bf22851fad303e33bd27f76ab70c510.tar.gz
Make sure title is always assigned in _metadata search
Fixes #1
-rwxr-xr-xepubgrep.py2
1 files changed, 1 insertions, 1 deletions
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)