==Project
====Possible Mentors
- Primary Mentor: @Spage
- Co-mentor: @Tgr
- Other mentor(s): @Ankitashukla
====Synopsis
A lot of the documentation for MediaWiki lives on git. People resort to copy-pasting of this content into wiki pages, resulting in copies of the same content lying around in multiple locations, tending to drift away from one another as some get updated, and some don't. A solution to this is to develop an extension that can transclude content (snippets of sample code, documentation, etc.) from the files on a git server in wiki pages as and when needed.
====Workflow of the extension
# Wiki page editor requests for a snippet of documentation or code using a magic word that allows the user to specify the git repository source, possibly a start and end point for the snippet (something similar to `{{#snippet:}}` in [[https://www.mediawiki.org/wiki/Extension:Git2Pages#Usage | Extension:Git2Pages]])
# The extension queries (HTTP) the git server for the requested snippet, caches it with a suitable expiration date, and a cron job that deletes the cache when transcluded text is updated on git (in the case where the text is transcluded from `HEAD`). The functionality for this would be something similar to the parser function for [[https://www.mediawiki.org/wiki/Extension:GitHub | Extension:GitHub]]’s magic word `{{#github:}}`.
# The extension receives the snippet of text that it requested for, and converts it to:
- HTML - For normal text.
- contents of a `{{#source}}` tag - for sample code snippets (see [[https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi_ParserFunction | SyntaxHighlight]]).
- nothing, render as is - for wikitext.
# The extension then sanitizes the HTML and/or wikitext , and renders it onto the wiki page.
====Phases
- **Step I** : Write the parser functions (gets called with a magic word) to query the git server for the required code/text snippet.
- Wiki page to the extension: A magic word that calls the parser function.
- The extension to the git server: A function that send HTTP requests to the git server for the required text snippet and receives it.
- **Step II** : Rendering the text to be transcluded.
- All text is to be converted to its rendering equivalent (see point 3 in workflow of the extension), sanitized (if needed), and rendered.
- Conversion of text to wikitext could a possible future additional feature, if compelling use cases for the same are found.
- **Step III** : Testing
- Test the normal functionality of the extension by writing and running tests.
- Identify the different ways in which the extension’s features could be abused, and put safe guards in place against them.
- **Step IV** : Deployment of the extension on MediaWiki
- Create the required documentation page for the extension.
- Announce the deployment on `wikitech-l` mailing list
===Deliverables
- **The MVP** : A very basic implementation of the extension that can fetch file content from a git server and transclude it in a wiki page.
- **Snippets** : Work on getting snippets of text from a file instead of the entire file, and convert them into their respective rendering format. Add functionality for start and end line numbers, or character offsets.
- **Sources of transcluded text** : Enable the extension to fetch these snippets from different file formats ( a list of such formats ?).
- **The Extension** : Combine the above to transclude snippets of code into a wiki page.
====Timeline
| **Time Period** | **Task(s)** |
| Nov 17 - Dec 7 | Community Bonding Period, request for a gerrit repository and a Wikimedia labs instance for the extension|
| **Week 1** (Dec 7 - Dec 13) | Explore the existing art on the parser functions that are to be written, start work on the parser function (Step I) |
| **Week 2** (Dec 14 - Dec 20) | Look around for instances of transcluded text from file formats that had not been identified previously |
| **Weeks 3, 4** (Dec 21 - Jan 3) | Work on the MVP (Steps I and II) |
| **Weeks 5, 6** (Jan 4 - Jan 17) | Finish the MVP, review work done till now and introduce any changes deemed necessary |
| **Week 7 - Week 11** ( Jan 18 - Feb 14 ) | Work on fetching and rendering snippets, add functionality to transclude from additional file formats (if found), write tests for the extension (Steps II and III) |
| **Weeks 12 , 13** (Feb 15 - Feb 28) | Create documentation for the extension, try to implement additional features, write and review tests (Steps III and IV) |
| **Week 14** ( Feb 29 - Mar 7) | (Wrap-up) Review documentation, fix minor bugs, deploy the extension (Step IV) |
==Profile
**Name:** Smriti Singh
**Email:** smritis.31095@gmail.com
**IRC handle (freenode):** galorefitz
**Internet Presence** : [[https://www.mediawiki.org/wiki/User:Galorefitz | MediaWiki user page]]
**Location:**
1. Manama, Kingdom of Bahrain (December) (+03:00 GMT)
2. Hyderabad, India (January - March) ( +05:30 GMT)
**Typical Working Hours:**
1. **December**: 6-8 hours a day, between 6:30 a.m - 8:30 p.m (GMT) (at least 40 hours a week)
2. **January - March** : 6-8 hours a day, between 10:30 a.m - 7:30 p.m (GMT) (at least 40 hours a week)
====Communication
I will be submitting reports regularly, tracking the progress of the project, on Phabricator. I will be available on `#wikimedia-dev` and `#wikimedia-tech` on IRC (freenode) during my working hours, so I can be reached there. I will also be responding on the relevant phabricator tasks. The source code will be pushed to Gerrit, and will be accessible, viewable and reviewable there.
====Contributions
The [[https://phabricator.wikimedia.org/T114719 | microtask]] I completed for this project helped me find a [[https://phabricator.wikimedia.org/T115206 | bug]] in the extension (Git2Pages). I investigated it, but couldn't completely resolve it, and so posted my findings on the filed task. My contributions to the community can be viewed [[https://gerrit.wikimedia.org/r/#/q/owner%3A%22Galorefitz%22,n,z | here]] and [[https://phabricator.wikimedia.org/p/Galorefitz/ | here]].
====About Me
**Education:** In progress. I am a Computer Science Student (currently in my third year), studying at the International Institute of Information Technology (IIIT), Hyderabad, India.
**How did you hear about this program?** From senior year students in college.
**Why MediaWiki?** I started contributing to MediaWiki in May, 2015. The people here were quick to respond, very encouraging, and amazingly helpful. Contributing, seeing my work make a difference to the community, felt great. Not many communities have all of the above, and this is what encouraged me to choose MediaWiki.
**Why this project?** Well, documentation is important. Even more so for newcomers, who are just beginning to maneuver their way through **so much code**. If the documentation that they (and for that matter, anyone) have access to has several versions, that say different things, it gets confusing. It’s our responsibility, as a community, to ensure that the documentation being provided by us is consistent and up-to-date.
===Additional Information (as mandated by [[https://wiki.gnome.org/Outreachy#Application_Form | Gnome]])
**Do you meet the eligibility requirements outlined [[https://wiki.gnome.org/Outreachy#Eligibility | here]]** ? - Yes.
**Preferred pronoun** - she
**Prior Commitments** -
December, 2015 : None.
January, 2016 - March, 2016 : College, will take approximately 30 hours a week (including examination times)
**Course details**
My college has a system of electives for every semester, and so I am not sure right now what courses I’ll be taking and how many credits they’ll be. The total number of credits, though, will be either 16 or 20. For more information, please refer to https://www.iiit.ac.in/academics/curriculum/undergraduate/BTech-CSE (Year III, Semester II)