fix: parse imported and embedded tags like CLI arguments so hyphenated tags survive
This commit is contained in:
parent
991e499fad
commit
90047c22b5
3 changed files with 28 additions and 12 deletions
|
|
@ -243,3 +243,14 @@ def test_import_skips_known_tags_and_empty_lines(tree):
|
|||
(tree / 'context.txt').write_text('./a.mp3 --- #lofi #snare\n./b.mp3 --- \n')
|
||||
assert OrvaniTag().load('context.txt') == [0, 'context.txt', 1]
|
||||
assert lines(tree) == ['a.mp3 --- #lofi #snare']
|
||||
|
||||
|
||||
def test_import_keeps_hyphenated_tags(tree):
|
||||
(tree / 'context.txt').write_text('./a.mp3 --- @home-office #lo-fi rock+roll take-2\n')
|
||||
assert OrvaniTag().load('context.txt')[0] == 0
|
||||
assert lines(tree) == ['a.mp3 --- @home-office #lo-fi rock+roll take-2']
|
||||
|
||||
|
||||
def test_duplicate_and_bare_prefixes(tree):
|
||||
OrvaniTag().add('a.mp3', '#lofi', '#lofi', 'C', '+', 'D')
|
||||
assert lines(tree) == ['a.mp3 --- #lofi C + D']
|
||||
|
|
|
|||
|
|
@ -151,3 +151,12 @@ def test_write_ignores_configured_types_the_plugin_cannot_handle(cwd):
|
|||
OrvaniTag().add('doc.abc', '#lofi')
|
||||
assert OrvaniTag().write_metadata('doc.abc', 'pdf') == [4, ['.pdf'], 'pdf', True]
|
||||
assert (cwd / 'doc.abc').read_text() == 'not a pdf'
|
||||
|
||||
|
||||
def test_pdf_keeps_hyphenated_tags(cwd):
|
||||
writer = PdfWriter()
|
||||
writer.add_blank_page(72, 72)
|
||||
writer.add_metadata({'/Keywords': '+side-project #lo-fi'})
|
||||
writer.write(cwd / 'doc.pdf')
|
||||
OrvaniTag().read_metadata('doc.pdf')
|
||||
assert (cwd / orvani.CONTEXT_FILE).read_text() == 'doc.pdf --- +side-project #lo-fi\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue