You are on page 1of 2

REBOL [

Title: "convertir bd sqlite3 bookmarks android browser exportada a fichero tcl


a html google chrome"
Date: 20-february-2014
Author: "Andres"
]

fic: %./bookmarks.tcl

bookmarks: read/lines fic

date-to-epoch: func [
"Return date in unix time format from a date in REBOL format"
rebol-date [date!] "Date in REBOL time format"
][
if rebol-date/time = none [
rebol-date: to-date rejoin [rebol-date "/00:00:00"]
]
rebol-date: rebol-date - now/zone
return to-integer (rebol-date - 1-Jan-1970 * 86400) +
(rebol-date/time/hour * 3600) +
(rebol-date/time/minute * 60) + rebol-date/time/second
]

fec: date-to-epoch now

cab: {
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
}

isub: {<DL><p>}
fsub: {</DL><p>}
fav: func [ url [string!] texto [string!] ico [string!] ] [
r: copy ""
join r [{<DT><A HREF="} url {" ADD_DATE="} fec {"} either empty? ico [""]
[{ ICON="} ico {"}] {>} texto {</A>}]

]
sub: func [ url [string!] texto [string!] ] [
r: copy ""
join r [{<DT><H3 ADD_DATE="} fec {" LAST_MODIFIED="} fec {"} {>} texto {</H3>}]
]

favs: copy []

foreach bm bookmarks [
b: to-block bm
t: b/2
u: b/3
folder?: b/4 = {1}
p: b/5
append favs reduce [fav u t ""]
]

You might also like