Close

Formatting guidelines

A project log for HackaDump

Just some dumb bash scripts to backup all my project's pages at http://hackaday.io

yann-guidon-ygdesYann Guidon / YGDES 04/04/2016 at 05:080 Comments

I'm lazy.

I'm too lazy to implement a proper scraper for log pages, even though I would spare efforts by making some efforts. I have even started to implement a suitable feature for the projects list pages. But the "quick and dirty solution" so far is to list all the project logs by hand, in the "details" page. After all there are other advantages, including easier navigation.

The script uses grep and sed to recognise a specific pattern that indicates the start of the list. First, note that the elements are separated by a line break, "<br>" code in HTML, so you have to hit "shift+enter" instead of only "enter" (which generates a paragraph "<p>")

The list starts with a bold keyword, recognised in HTML by: "<strong>Logs:</strong>" (click on the bold B in the edition menu)

Then the rest of the page should be the list of links. Each link starts at the beginning of each line (remember: shift+enter) with a number (no ordering is checked) followed by a dot and a space, then a link ("<a ") and a line break. Yeah, these are absolute links, so be careful...

overall the script detects this:

Logs:
42. some link
43. another link

There are some other minor gotchas so don't hesitate to look at the scraped and sed'ed files named logs.url if something is weird.

I told you it was dirty...

Discussions