2nd Week Report: Studying Parsoid code for the existing Linter categories.

Nice meeting you here again, hope you are enjoying the story. Let me divert a little before getting to the Parsoid code, lets throw an eye on this article: Parsoid: How Wikipedia catches up with the web. This article in a brief manner gives an overview of how Parsoid works, I highly encourage you to check it out.

Parsoid has a linter module that examines the DOM and detects wikitext and HTML patterns that needs to be fixed by editors. The linter() function in this module takes the body element of the DOM and calls findLints() function that loops through the body node after node and in turn calls logWikitextFixups(). logWikitextFixups() is called in the findLlints() and its role is to call the different functions for the different linter issues we want to detect.

The task is to add one more function to called in the logWikitextFixups() for links in links.

I think we are done examining this module found in lib/wt2html/pp/processors/linter.js directory, hope I’ve not missed out something. One more thing, these functions for these linter issues all have their mocha test in the tests/mocha/linter.js. Now I think I’ve touched everything, if you check out the code and wonder how hundred of lines of code can have such a short summary, remember that one important tip for new contributors is not to try to understand the whole thing (source code in this case). For more tips like this one see Maria Codes‘post on Reflections On My OPW (Outreach Program for Women now called Outreachy) Internship.

Before adding the function for links in links we need to be able to figure out when the DOM has information that comes from links-in-links.

I think I missed out something very important, what do we mean by links in links? why is it an issue? what are some the examples to illustrate its occurrence? See the task on phabricator Outreach-17 Project: Add a new Linter Category: Links-in-Links, it has an example. Hope to see you next when I’ll be answering these questions above.

Related posts

Leave a Comment