Wiki - File versioning

故事扮演 提交于 2019-12-21 05:19:27

问题


I am building a wiki-like website, and am wondering how to implement the file versioning to create articles history. I would like to be able, when someone edits a file, to be able to display which parts were edited, and to revert back to a previous file if necessary.

EDIT: Thank you for your responses. I started to go through them, and then I realized my post was not very precise. So I may add that I am using Java as a development language (Groovy through Grails to be precise). Also, the application I am building is not only a Wiki. It does plenty of other stuff but some parts should be editable by several users. So I am looking for the best candidate for that particular job.


回答1:


I would just look at how ikiwiki or gitit are implemented (Perl and Haskell, respectively) as both are able to use Git as a backend.

As to ikiwiki (I'm using it for my intranet wiki at work) it saves page sources (wiki formatting) as plain files, and after each save (or git push from the outside) it "compiles" the site to a set of static pages. It uses make-style approach for compiling the site though so ony the changed pages are rebuilt.




回答2:


Speaking of Git, what you need is already implemented in the forms of git blame and git checkout.

Even though you could use those commands to get the job done, you would probably be better off with libgit2 which is basically all the functionality you need, but as a library instead of executables.




回答3:


You may want to have a look at Gollum, Github's git-powered wiki engine.



来源:https://stackoverflow.com/questions/11071810/wiki-file-versioning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!