pl.po: update
[elinks.git] / contrib / lua / bm-to-elinks-bookmarks.lua
blobad823207e049d21312a0cb514805e7d5ec564bfc
1 #!/usr/bin/lua -f
2 -- Convert bm.lua-format bookmarks to ELinks-format bookmarks.
3 -- Peter Wang, 2002-12-19
5 prog = arg[0]
6 infile = arg[1]
8 if not infile then
9 print("Convert bm.lua-format bookmarks to ELinks-format bookmarks.\n")
10 print("Usage: " .. prog .. " bookmark.lst")
11 print("Output is written to stdout.\n")
12 exit(1)
13 end
15 bookmarks = dofile(infile)
16 if type(bookmarks) ~= "table" then
17 print("Error loading " .. infile)
18 exit(1)
19 end
21 function tab2spc(s) return gsub(s, "\t", " ") end -- just in case
23 for i, cat in bookmarks do
24 print(tab2spc(cat.category), "", 0, "FE")
26 for i = 1, getn(cat) do
27 local bm = cat[i]
28 print(tab2spc(bm.name), tab2spc(bm.url), 1)
29 end
30 end