LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to print listing of Firefox bookmarks? (http://www.linuxquestions.org/questions/linux-software-2/how-to-print-listing-of-firefox-bookmarks-848598/)

tommyttt 12-06-2010 02:22 AM

How to print listing of Firefox bookmarks?
 
Hi fellow linux users;

Many years ago I was able to print a listing of bookmarks in Mozilla browser. I would like to do that again.

The problem is that I'm now using Firefox 3.6.12 and can't find anything in the menus to allow this. I've tried cut and paste from the organize bookmarks view but it doesn't work very well, loosing formatting.

Can anyone suggest a method to obtain a printed listing?

Thanks, Tom

repo 12-06-2010 02:38 AM

You can export the bookmarks as a html file and then print the file
Quote:

bookmarks => organize bookmarks => import and backup => export
Kind regards

TheIndependentAquarius 12-06-2010 02:38 AM

1 Attachment(s)
How about:

Bookmarks->Organize bookmarks...->Import and Backup...->Backup...

Save the file with the desired name. The extension will be .json which you can read in a human readable format here: http://jsonformat.com/#jsondataurllabel

OR

Bookmarks->Organize bookmarks...->Import and Backup...->Export HTML...

Save the file with you desired name and it results in something like the attached image:

colucix 12-06-2010 02:43 AM

There is a solution in the mozilla forums: http://support.mozilla.com/en-US/questions/748417. Basically you have to export bookmarks as HTML, open the file and then execute a javascript from the address bar:
Code:

javascript:(function(){var d=document,sS='a[href^="http://"]:after, a[href^="https://"]:after {content:"< " attr(href) " >";padding:0 0 0 1em;} a[href] {text-decoration:none;}',nS=d.createElement('STYLE');nS.setAttribute('type','text/css');nS.innerHTML=unescape(sS);d.getElementsByTagName('head')[0].appendChild(nS);})();
this will put http addresses near the bookmark names, the you can print the page. You can also apply your own parsing command from a terminal and extract the information you want to print, organizing them at your pleasure. Hope this helps.

TheIndependentAquarius 12-06-2010 02:57 AM

1 Attachment(s)
colucix,

I just tried out your way, and it worked superbly, the screen shot attached:

tommyttt 12-07-2010 03:01 AM

Gentlemen/ladies, thanks for the replies. From the descriptions they should do what I want. I'll give them a try tomorrow.

Thanks again, Tom

mlangdn 12-07-2010 07:41 AM

colucix,

Worked great for me too, thanks!

TheIndependentAquarius 01-20-2011 01:02 AM

But I am not able to "copy" the link addresses from there :( Any advises?

colucix 01-20-2011 02:25 AM

Strange, it works for me. I have the usual "Copy link location" in the right-click menu and I can copy and paste in the URL bar where only the address will appear. Do the entries in the transformed page look like normal URLs?

TheIndependentAquarius 01-20-2011 02:44 AM

1 Attachment(s)
I open that html file in the firefox, press Ctrl - A to select all, press ctrl - c to copy, and ctrl - v to paste and then this is what I get :(
Code:

Bookmarks Menu

Recently Bookmarked
Recent Tags
bits

5.5 Packing and Unpacking Bit Strings
array of bits - C / C++ answers
comp.lang.c Frequently Asked Questions
Cprogramming.com - Tutorials - Bitwise Operators and Bit Manipulations in C and C++
C syntax - Wikipedia, the free encyclopedia
Handel-C Forum - How do i specify an array of bits ??
How to do bit packing in c++? - Yahoo! Answers
Packing Bits with Bit Fields
unsigned char into array of bits - C

FLTK

#defines
Examples
Fl_JPG_Image() linking path
    Fl_JPG_Image() needs const char* FLTK Forum
Function Reference
Man
.........


colucix 01-20-2011 04:53 AM

Now I can see what the problem really is. Indeed the URLs cannot be selected at all. They don't appear as text objects but I cannot explain why. As I mentioned earlier, I retrieved the solution from the Mozilla support forum, but I'm not a javascript expert.

Anyway, I can offer a workaround to print bookmarks in a similar format, without the brief descriptions that appear for some links. Here is an awk code that will print the title and the URL embedded in <> as shown by the java script. The section names of the bookmarks list will be printed out, as well:
Code:

awk '
/<H[0-9]/ {
  print gensub(/.*<H[0-9].*>(.+)<\/H[0-9]>.*/,"\\1","g")
}

/HREF=/ && /https*:\/\// {
  print gensub(/.*<A HREF="([^ ]+)".*>(.+)<\/A>.*/,"\\2  <\\1>","g")
}

/^$/' bookmarks.html > bookmarks_with_urls

This does not solve the issue, but can be useful to copy/paste the complete URLs. Hopefully.

TheIndependentAquarius 01-20-2011 10:24 PM

Thank you for that script, but could you tell me too how to run it? i.e.
like this?
Code:

awk 'scriptName' bookmarks.html

TheIndependentAquarius 01-20-2011 10:33 PM

I ran it that way and then opened bookmarks.html and selected, copied and pasted here: :(
Did I miss some point here? and I can't see the file bookmarks_with_urls anywhere!
Code:

5.5 Packing and Unpacking Bit Strings
array of bits - C / C++ answers
comp.lang.c Frequently Asked Questions
Cprogramming.com - Tutorials - Bitwise Operators and Bit Manipulations in C and C++
C syntax - Wikipedia, the free encyclopedia
Handel-C Forum - How do i specify an array of bits ??
How to do bit packing in c++? - Yahoo! Answers
Packing Bits with Bit Fields
unsigned char into array of bits - C


colucix 01-21-2011 02:13 AM

Ehm... sorry Anisha but I already put the awk command in my example. It is a complete command line, not a script. The script is simply
Code:

/<H[0-9]/ {
  print gensub(/.*<H[0-9].*>(.+)<\/H[0-9]>.*/,"\\1","g")
}

/HREF=/ && /https*:\/\// {
  print gensub(/.*<A HREF="([^ ]+)".*>(.+)<\/A>.*/,"\\2  <\\1>","g")
}

/^$/

to be run as
Code:

awk -f scriptname bookmarks.html > bookmarks_with_urls

TheIndependentAquarius 01-21-2011 02:22 AM

Code:

anisha@linux-uitj:~> cd Desktop/
anisha@linux-uitj:~/Desktop> awk '
> /<H[0-9]/ {                   
>  print gensub(/.*<H[0-9].*>(.+)<\/H[0-9]>.*/,"\\1","g")
> }                                                     
>                                                       
> /HREF=/ && /https*:\/\// {
>  print gensub(/.*<A HREF="([^ ]+)".*>(.+)<\/A>.*/,"\\2  <\\1>","g")
> }
>
> /^$/' bookmarks.html > bookmarks_with_urls
anisha@linux-uitj:~/Desktop> ls
....
bookmarks.html
bookmarks_with_urls
...
anisha@linux-uitj:~/Desktop> file bookmarks_with_urls
bookmarks_with_urls: very short file (no magic)

anisha@linux-uitj:~/Desktop>



All times are GMT -5. The time now is 07:38 PM.