Profile Information
Name: Akanksha Gupta
Preferred pronoun: she
Email: akanksha2879@gmail.com
irc nick: akangupt
Mediawiki User: Akangupt
Location: Mandi, Himachal Pradesh, India
Time Zone: UTC+5:30
Typical working hours: (Indian Standard Time)
5PM to 1AM - before 7th December 2015
10AM to 6PM - 7th December 2015 - 21st February 2015
5PM to 1AM - After 21st February 2015
Synopsis
It’s convenient to get the information from wiki pages directly rather than searching in git repositories for documentation and code snippets. To facilitate this, developers end up dumping the git-docs on wiki.
Wiki pages of git-docs are always either outdated or wrong. This is intuitive because developers are not required to keep track of every commit/merge in corresponding repositories and then update the wiki-pages accordingly.
Solution:
In order to avoid outdated, wrong documentations and facilitate the ease of inserting code snippets from git repositories to wiki, the proposal is to create an extension, which would transclude the git content in wiki and update them when corresponding git-docs get updated.
This extension will be allowed to access the data in extension.json (Required) and hooks.yaml (Optional). This data will be fed to wiki template that creates extension infobox and hook pages respectively.
Possible mentors
The plan
Step-1 :
Create an extension which can transclude content from git in wiki pages . This involves:
- Creating the parser function '#GitAtWiki'.
Git server can be requested for :- A file
- Part of the file by specifying a regex.
- Code snippet in a file.
Parser function will have a syntax like:
{{#GitAtWiki: FILENAME|repo=REPOSITORY|branch=BRANCHNAME|from:STARTPATTERN|to:ENDPATTERN|code:YES}}
Parameters for the parser function:
- filename: Required. The filename whose content is going to be displayed. For example : {{#GitAtWiki: docs/hooks.txt}}
- repo: Optional. Repository name. Default: The default repository will be set using the`$egGitAtWikiDefaultRepo` setting in LocalSetting file. For example, for Mediawiki core: $egGitHubDefaultRepo = 'wikimedia/mediawiki';
- branch: Optional. The branch to look for the file. Default = master.
- from: Optional. The start regex pattern from where content will be pulled. Default = Start of file.
- to: Optional. The end regex pattern till where the content will be pulled. Default = End of file.
- code: Optional. Specify code = 'yes' to highlight the fetched code. Default = 'no'.
- Requesting the file over HTTP or file_get_contents and caching the response with an expiration time (approximately 3 days) and source url as a caching key. The raw content URL, which is used to fetch the files, can be modified using the`$egGitAtWikiDefaultUrl` setting in LocalSetting file. By default it will be set for Github:
$egGitAtWikiDefaultUrl = 'https://raw.githubusercontent.com';
$sourceUrl = $egGitAtWikiDefaultUrl."/".$repo."/".$branch."/".$filename ; $fetchedValue = \Http::get( $sourceUrl );
To transclude the file from Gitlab/phabricator-diffusion/git.wikimedia.org/gerrit.wikimedia.org : $egGitAtWikiDefaultUrl(by the user) and $sourceUrl (in the code) will be edited accordingly.
- Making the received content renderable after sanitizing it.
File Format | Rendering Method |
---|---|
MarkDown files | Example : Readme.md. These files will be converted to html using Michelf\Markdown or similar methods. |
Mediawiki files and Wiki files | Example : Readme.mediawiki and lua.wiki . These files will be rendered as it is. |
Text files etc. | Example : Readme.txt. These files will be rendered using <poem> and <nowiki> tags. |
For mediawiki files, wiki files (based on extension of file) and code snippets (if code parameter is YES) :
return array( $fileContents, 'nowiki' => false, 'noparse' => true, 'isHTML' => false );
For text files :
$output = '<poem>' . htmlspecialchars( $fileContents ) . '</poem>'; return array( $output, 'nowiki' => true, 'noparse' => true, 'isHTML' => true );
Step-2 :
Updating the wiki pages when git-docs get updated.
Idea is to maintain a mapping/database of source (git-doc) and destination (wiki-page) and adding a post commit hook which triggers the update remotely from Jenkins.
Step-3:
Write a PHP script to process the text given by extension. Extension will fetch the text from hooks.yaml and return the information about a specific hook with the help of PHP and lua. Hence, this extension will be used to create the individual hook pages easily.
Phases
Phase I: Request for a repository, wikimedia lab instance and explore existing parser functions and their code culture.
Phase II: Create the extension which satisfies the use cases when the git server is requested for a file or code snippet.
Phase III: Make the extension to follow the use cases when the git server is requested for the part of a file by specifying the regex patterns.
Phase IV: Create a bot to update the wiki-pages. (step-2)
Phase V: Write a mechanism to process the text. (step-3)
Phase VI: Deploy and test the final extension and document the extension.
Deliverables
- Required. The extension which satisfies the use cases when the git server is requested for a file or a code snippet. (phase II)
- Required. A feature in the extension for the use cases when the git server is requested for the part of file by specifying the regex patterns. (phase III)
- Required. A bot to update the wiki-pages. (phase IV)
- Optional. A mechanism to process the text given by the extension. (phase V)
- Required. Documentation for the GitAtWiki extension. (Phase VI)
Timeline
Period | Task |
---|---|
Before Dec 7 | Request for a repository, get a wikimedia lab instance and explore existing parser functions and their code culture. (Phase I) |
Dec 7 - Dec 10 | Create the basic setup/files for extension like internationalisation etc. |
Dec 11 - Dec 28 | Write the script for the parser function which satisfies the use cases when the git server is requested a file or a code snippet. (Phase II) |
Dec 29 - Jan 6 | Write the unit tests and test the code. |
Jan 7 - Jan 16 | Get the security review, code review, address the issues/bugs and deploy the extension (THE MVP) . Start the documentation for the extension. Create a feature in the extension for the use cases when the git server is requested for the part of file by specifying regex pattern. (Phase III) |
Jan 17 - Jan 22 | Write the unit tests and test the code. |
Jan 23 - Jan 30 | Send the code for review and address the issues/bugs. Create the basic setup for the mechanism to update the wiki-pages. |
Jan 31 - Feb 17 | Write the script to execute the functionalities of a mechanism which updates the wiki-pages. (Phase IV) |
Feb 18 - Feb 26 | Write the unit tests and test the code. |
Feb 27 - March 7 | Send the code for review, fix the bugs, deploy the extension and document the final extension. (Phase VI) |
NOTE : Try to add the lua module, if complexity of work and time permits. (Phase V)
Additional Information About The Project
Existing extensions :
Extension | Pitfalls |
---|---|
Git2Pages | Execs git clone and other commands to create local files which takes more space. It doesn’t have the option of only allowing a whitelist of sites, which can create a security hazard. |
Gitweb and GitHub | Sends a HTTP request to the git server but doesn’t satisfy the use cases when git server is requested for : (1) Part of the file by specifying start and end line numbers. (2) Code snippet in a file. |
After the project :
A bot, which can fetch all the information of a hook with the help of the lua module created in this project, can be built to create the missing hook pages . (T93043)
Participation
- The progess report of the project will be updated weekly on this page.
- The source code will be published on gerrit.
- I will ask for help/doubts on MediaWiki-General, #wikimedia-dev and #wikimedia-tech irc channels as I've already been doing.
- To get an opinion/feedback, I will use wikitech-I mailing list.
About Me
Education: I'm an undergraduate student of computer science at IIT Mandi, India.
How did you hear about the program?
From my friends who have already done an outreachy internship.
Do you meet the eligibility requirements outlined at https://wiki.gnome.org/Outreachy#Eligibility (if no, explain why not)?
Yes, I am eligible.
Will you have any other time commitments, such as school work, another job, planned vacation, etc., during the duration of the program?
1st December 2015 - 21st February 2016 : Winter vacations. I will not have any other commitments.
22nd February 2016 - 7th March 2016 : College will take 20 hours per week (Also, These days will be the starting 15 days of the college, hence the schedule is going to be very light as we are supposed to spend this time in examining and choosing the courses.)
I will dedicate at least 42 hours per week during my internship.
We advise all candidates eligible to Google Summer of Code and FOSS Outreach Program for Women to apply for both programs. Are you planning to apply to both programs and, if so, with what organization(s)?
Only OPW, for Wikimedia
What makes you want to make this the most awesomest wiki enhancement ever?
Seeing the ever growing community of developers and contributors in wiki motivates me. It becomes the platform to train the new generation of developers by its huge knowledge database but a problem arises, as I found, while in process of exploring the wiki for learning. Sometimes if information is available in a big amount it’s always advisable to keep your data at one place or at least only in one copy so as to reduce and minimise the inconsistencies in various data sources for the same information. Currently no extension provides the functionalities to auto modify the pages for all wikis and at least inform the end user that the content is revised or deprecated. I think with the implementation of this project this problem can be solved and its effect will be long lasting and far reaching.
Why did you choose wikimedia?
Wikimedia was the source of my initial knowledge about the internet world and was my first step into the cyber world and since then there has not been a day when I don’t go to Wikipedia or some other wiki for one or the other type of information. It is a dawn of the new era of learning through the internet and undeniably wiki is a major contributor to that learning process and in some terms defines the present day internet. I have always admired the elegance and at the same time the simplicity of the idea and admired its contributors for the wonderful piece of idea. It always has been on my wishlist to contribute to the growth of internet and the knowledge pool at large of the world and by this project this might just be true, to make the internet and the cyber age a better thing than it was a day ago.
Past Experience
I have done many coding projects during my graduation and implemented various algorithms and data structures. As part of my industrial internship I worked with Amazon India during summer of 2015.
Academic Projects :
- Remote Directory Editor : Multiple clients can connect to the server and use various features. It provides you with simple shell interface and supports features mainly including removing, renaming, adding files, listing the files, moving and changing mode of the working directory.
- Chat-room: A user signs in. User can see online users, add/remove/block/unblock them in local address book, change his status (online/busy), see his statistics, use admin features, configure account, message/file transfer. (Using PHP, MySQL, HTML, CSS, Javascript)
- Web-email : A user signs up with additional features as user profile, contact address list. User can mail to all domain email addresses and can receive mails from same domain addresses. (Using hmail server , PHP, MySQL, HTML, CSS, Javascript)
- A Fiery Vengeance : A Japanese role playing game(JRPG) with features like save game, inventory, Health interface, dynamic fights, turn-based fights and other small games. (Using Python, Tiled and open source library pygame )
- Voice Guided Dehumidifier : A voice commanded system which will dehumidify the room with the help of desiccant material like silica gel.
Microtask completed : T115388