Refactor Netscape bookmark exporting

Relates to https://github.com/shaarli/netscape-bookmark-parser/issues/5

Fixes:
- respect the Netscape bookmark format "specification"

Modifications:
- [application] introduce the NetscapeBookmarkUtils class
- [template] export           - improve formatting, rename export selection parameter
- [template] export.bookmarks - template for Netscape exports
- [tests] bookmark filtering, additional field generation

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
VirtualTam 2016-04-10 17:34:07 +02:00
parent 745304c842
commit cd5327bee8
5 changed files with 202 additions and 42 deletions

10
tpl/export.bookmarks.html Normal file
View file

@ -0,0 +1,10 @@
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<!-- This is an automatically generated file.
It will be read and overwritten.
Do Not Edit! -->{ignore}The RainTPL loop is formatted to avoid generating extra newlines{/ignore}
<TITLE>{$pagetitle}</TITLE>
<H1>Shaarli export of {$selection} bookmarks on {$date}</H1>
<DL><p>{loop="links"}
<DT><A HREF="{$value.url}" ADD_DATE="{$value.timestamp}" PRIVATE="{$value.private}" TAGS="{$value.taglist}">{$value.title}</A>{if="$value.description"}{$eol}<DD>{$value.description}{/if}{/loop}
</DL><p>

View file

@ -2,15 +2,21 @@
<html>
<head>{include="includes"}</head>
<body>
<div id="pageheader">
{include="page.header"}
<div id="toolsdiv">
<a href="?do=export&amp;what=all"><b>Export all</b> <span>: Export all links</span></a><br><br>
<a href="?do=export&amp;what=public"><b>Export public</b> <span>: Export public links only</span></a><br><br>
<a href="?do=export&amp;what=private"><b>Export private</b> <span>: Export private links only</span></a>
<div class="clear"></div>
</div>
</div>
{include="page.footer"}
<div id="pageheader">
{include="page.header"}
<div id="toolsdiv">
<a href="?do=export&amp;selection=all">
<b>Export all</b><span>: Export all links</span>
</a><br>
<a href="?do=export&amp;selection=public">
<b>Export public</b><span>: Only export public links</span>
</a><br>
<a href="?do=export&amp;selection=private">
<b>Export private</b><span>: Only export private links</span>
</a>
<div class="clear"></div>
</div>
</div>
{include="page.footer"}
</body>
</html>