Pages renderer for e-maxx-eng (PHP or Python)

Back to OpenSource Participation forum

Rodion (admin)     2015-07-22 18:22:23
User avatar

There is a site http://e-maxx.ru/algo/ with invaluable collection of about a hunderd whimsical algorithms, many of them quite advanced and not easily found anywhere. The site is not in English however. Some time ago we started a project at GitHub to facilitate collaborative translation - people create new pages using their understanding of the matter and google-translate - and make pull-requests.

Right now it looks like this:

The problem is that someone needs to run the pages generating tool after sources are updated by accepting pull request. All can be much simpler if some small web-service sometimes fetches these sources, converts them and either renders them at its own web-interface or pushes to github pages (or other static hoster).

Alternative idea is to make all these with some shell scripts and run automatically from someone's desktop, but this do not sound quite reliable or innovative enough :)

I believe this could be done in PHP or Python or Java and hosted at some free resource (including google appengine). However the project lacks a volunteer to do this :(

YetAnotherMinion     2015-07-22 20:27:36

Will something using the GitHub Webhooks API fit what you are trying to do? My understanding is that you can set it up to make a POST request to your server each time the translation repo is updated. Then a private server can pull the translation repo, run the page generation tool, and then push to gh_pages branch of website using a private ssh key.

YetAnotherMinion     2015-07-23 01:55:32

The webhook can run when ever some one proposes a pull request or when it is actually merged, its all configurable.

I looked into this further, and it is possible to update git files in a repo throught GitHub HTTP API. No need to run git in the traditional manner, you can create and edit files, as well as fetch file contents. Now I see the markdown converter is written in PHP, and google app engine has a PHP runtime.

I have never written a line of PHP code in my life, so I can try and make the attempt if no one else is available, but it sounds like you are much better at PHP (having written this entire site and the code checkers, an impressive accomplishment!)

Rodion (admin)     2015-07-23 02:41:45
User avatar

> I looked into this further, and it is possible to update git files in a repo throught GitHub HTTP API

Yes, I was considering this for about last week. What troubles me is that it seems significant amount of work - to create such an autonomous "committer" in comparison to idea of setting up git with ssh keys at some VPS. However necessity of having live VPS at hand is similar to having some person who will always care of updating the site...

Though the positive thing is that such a tool could be used by any people for any similar sites, not particularly this. I know some people maintain static sites at github pages using Jekyll and other standalone tools. So they may have a kind of alternative.

On the other side it is not strictly necessary to push the generated html back - the server can display them on its own (then the old site will have redirect to new pages). So it is the matter to research / consider...

>Now I see the markdown converter is written in PHP

I know there are libraries in Python - though probably there could be some minor incompatibilities or differences in features. Converting utility itself is simple enough and I think I can try to rewrite its logic in Python if necessary.

I myself never thought I will be writing in PHP as I am Java developer and most of my colleagues hate even the word PHP, haha, boasting of java strictness, rigindess and, well, verbosity. However I think the choice was correct - if I start with Java probably I never get that far due to far slower pace... :)

UPD Another curious opportunity is to leave the idea of server and cron jobs and instead to make site with static markdown files and javascript rendering them into html on the fly. TeX formulas on the site are working this way... There probably are some SEO disadvantages and I do not know of JS renderers for markdown...

YetAnotherMinion     2015-07-23 16:03:09

Here is a project that I found that does almost exactly what you are trying to do. It uses Travis CI which is free for open source projects to run build scripts on a VPS each time git events happen. It is very easy and manages the Webhook api for you.

Rodion (admin)     2015-07-26 05:29:12
User avatar

Hi, thanks! I'll try to research about this bit more! Surely it is preferable not to reinvent the wheels :)

Please login and solve 5 problems to be able to post at forum