Well, I think the simplest way is just to go through the list from start
writing the data of each post, and possibly writing a 'post separator
signature', just ignore the links.
Then you just read them in the same order they were written and link in
the posts one after another...