📜 ⬆️ ⬇️

Habr's export to FB2

Greetings

Some time ago I came across an article about exporting favorites to the format FB2.
I liked the idea, but there was one 'but': it was necessary to manually start the export on a local machine, but I wanted to immediately in the browser; and secondly - to start, you had to install PHP locally and download the source code.

So I decided to write a browser extension that would allow just exporting to FB2. In the course of writing, he also added export to FB2 and for Samizdat .

')
At first I decided to write userscript for Greasemonkey , but at some stage I encountered the inconvenience of developing and launching such extensions in Chrome, so I switched to developing a native extension under Chrome (maybe later I’ll return to finalizing the userscript version).

Now the project is still at an early stage and much of what was planned is not implemented, but even in this state, the extension can already be used. The extension itself can be taken here , and the source can be viewed here .

Screenshots:




From the currently implemented:
  1. For Habr's articles:
    • Text conversion in FB2.
    • Insert images from the article.
    • Almost correct conversion of the code tag ('spaces are compressed at the beginning of the line).
    • Converting tables into text view.
    • Convert a , b , i , s and img tags to the corresponding FB2 tags.

  2. For samlib:
    • Text conversion in FB2.

From planned to implementation:
  1. Support for adding custom converters for other sites.
  2. Support for adding other types of converters (XSLT conversion is currently used).
  3. Support for other types of saving results (now saved to a local file): GDrive, Dropbox, ...

At the moment, I have checked the functionality of the extension only on a small number of pages, therefore bugs are possible.
All problems found and non-working sites, please indicate in the comments or on Gitkhab.
Also welcome comments and improvements to the extension code.

Upd. Changelog moved here .

Source: https://habr.com/ru/post/174649/


All Articles