fix: dev: export
This commit is contained in:
parent
40c1a90147
commit
f98f5fdac0
8
buku
8
buku
@ -2784,14 +2784,14 @@ def convert_bookmark_set(
|
||||
out = ''
|
||||
if export_type == 'markdown':
|
||||
for row in resultset:
|
||||
if row[2] == '':
|
||||
if not row[2]:
|
||||
out += '- [Untitled](' + row[1] + ')\n'
|
||||
else:
|
||||
out += '- [' + row[2] + '](' + row[1] + ')\n'
|
||||
count += 1
|
||||
elif export_type == 'org':
|
||||
for row in resultset:
|
||||
if row[2] == '':
|
||||
if row[2]:
|
||||
out += '* [[{}][Untitled]]\n'.format(row[1])
|
||||
else:
|
||||
out += '* [[{}][{}]]\n'.format(row[1], row[2])
|
||||
@ -2809,10 +2809,10 @@ def convert_bookmark_set(
|
||||
' <DL><p>\n'.format(timestamp))
|
||||
|
||||
for row in resultset:
|
||||
out += (' <DT><A HREF="%s" ADD_DATE="%s" LAST_MODIFIED="%s"' % (row[1], timestamp, timestamp))
|
||||
out += ' <DT><A HREF="%s" ADD_DATE="%s" LAST_MODIFIED="%s"' % (row[1], timestamp, timestamp)
|
||||
if row[3] != DELIM:
|
||||
out += ' TAGS="' + row[3][1:-1] + '"'
|
||||
out += '>' + row[2] if row[2] else '' + '</A>\n'
|
||||
out += '>{}</A>\n'.format(row[2] if row[2] else '')
|
||||
if row[4] != '':
|
||||
out += ' <DD>' + row[4] + '\n'
|
||||
count += 1
|
||||
|
@ -738,11 +738,12 @@ def test_copy_to_clipboard(platform, params):
|
||||
' <DT><H3 ADD_DATE="1556430615" LAST_MODIFIED="1556430615" PERSONAL_TOOLBAR_FOLDER="true">Buku bookmarks</H3>\n'
|
||||
' <DL><p>\n'
|
||||
' <DT><A HREF="htttp://example.com" ADD_DATE="1556430615" LAST_MODIFIED="1556430615"></A>\n'
|
||||
' <DT><A HREF="htttp://example.org" ADD_DATE="1556430615" LAST_MODIFIED="1556430615"></A>\n'
|
||||
' <DT><A HREF="http://google.com" ADD_DATE="1556430615" LAST_MODIFIED="1556430615">Google</A>\n'
|
||||
' </DL><p>\n</DL><p>'
|
||||
],
|
||||
['org', '* [[htttp://example.com][Untitled]]\n* [[http://google.com][Google]]\n'],
|
||||
['markdown', '- [Untitled](htttp://example.com)\n- [Google](http://google.com)\n'],
|
||||
['org', '* [[htttp://example.com][]]\n* [[htttp://example.org][None]]\n* [[http://google.com][Untitled]]\n'],
|
||||
['markdown', '- [Untitled](htttp://example.com)\n- [Untitled](htttp://example.org)\n- [Google](http://google.com)\n'],
|
||||
['random', None],
|
||||
])
|
||||
def test_convert_bookmark_set(export_type, exp_res, monkeypatch):
|
||||
@ -750,7 +751,7 @@ def test_convert_bookmark_set(export_type, exp_res, monkeypatch):
|
||||
import buku
|
||||
bms = [
|
||||
(1, 'htttp://example.com', '', ',', '', 0),
|
||||
(1, 'htttp://example.com', None, ',', '', 0),
|
||||
(1, 'htttp://example.org', None, ',', '', 0),
|
||||
(2, 'http://google.com', 'Google', ',', '', 0)]
|
||||
if export_type == 'random':
|
||||
with pytest.raises(AssertionError):
|
||||
@ -761,5 +762,5 @@ def test_convert_bookmark_set(export_type, exp_res, monkeypatch):
|
||||
return 1556430615
|
||||
monkeypatch.setattr(buku.time, 'time', return_fixed_number)
|
||||
res = convert_bookmark_set(bms, export_type=export_type)
|
||||
assert res['count'] == 2
|
||||
assert res['count'] == 3
|
||||
assert exp_res == res['data']
|
||||
|
Loading…
Reference in New Issue
Block a user