Commit graph

410 commits

Author SHA1 Message Date
Prateek Saxena 1565a1d3c9 Move the article renderer in to the renderers property
To allow multiple renderers (for different types of content)
to be defined.

Change-Id: I50320646e26f36a0a2bc425c82ccc58912840f84
2015-10-01 08:48:00 +00:00
Prateek Saxena 6eef4f325b Add jscs and jshint tasks to the Gruntfile
Adds the jscs and jshint packages for development and their tasks in
Grunt. Also fixes all the code convention errors.

Change-Id: If1c9dfdbe22d4912d78b6a51b1292866970a85cc
2015-09-04 13:57:52 +05:30
Prateek Saxena 03f4fa63b2 core: getTitle: Return undefined for non URI links
mw.Uri throws an exception when dealing with -

    href="javascript:void(0);"
    href="mailto:abc@example.com"
    etc.

Using a try…catch to return undefined in this case.

Bug: T95215
Change-Id: I632e9dc0e70a5fddf9f2573572bfc8e7f6232923
2015-04-21 19:19:43 +05:30
wctaiwan 642bdf013e Use href attribute to calculate titles
This is needed for wikis that use LanguageConverter, since the title
attribute is converted to the user's variant, and the canonical title is
needed for the API unless converttitles is specified.

For filtering, instead of comparing linkHref and expectedHref, filter
out links that have other query parameters or aren't in content
namespaces.

Bug: T93605
Change-Id: I5534753307ed5e1d4b27c52c616fd143b2a397e1
2015-04-06 05:55:25 -04:00
Prateek Saxena 20f2bef272 renderer.article.getProcessedElements: Stop escaping the title and the extract
Both the title and the extract were being html escaped thus producing
string like ' and " when used with .text(). So, we now use
document.createTextNode() for the normal text and .text() with the bolded
one.

Bug: T93720
Change-Id: I6bbc52e427dc636b7b0be1ad4f749d9273ff61b3
2015-03-26 19:28:20 +05:30
Prateek Saxena 3eaf2829e8 renderer.article: Remove leading spaces before brackets
Bug: T69225
Change-Id: I83f79fa0ebd19bea6ed7ea266cece0778210adb2
2015-03-05 15:32:45 +05:30
Prateek Saxena df0b988eec renderer.article: Bold the title no matter what the trailing characters
Bug: T69229
Change-Id: I833c0dcae98010bc74b6b58ae8035aaac4e6465b
2015-03-05 15:31:42 +05:30
Prateek Saxena a43ef7ca51 Remove the need of .html in article.getProcessedHtml
Instead of replacing all instances of the title in the extract -

  '$1<b>$2</b>$3'

We now put symbolic strings there which we use to split the string
and then make an array of text and <b> elements that get appended
to $contentbox.

Bug: T76378
Change-Id: I02222bbff84532f63cac67af1bf889c328ec6ff2
2015-03-05 15:30:06 +05:30
Prateek Saxena b24e39e9fc Run mw.html.escape on page extract and title
Add test for XSS attack

Bug: T69180
Change-Id: I213169bd9daed979e63f50cf3926f7196eb6181c
2014-12-01 11:23:14 -08:00
Prateek Saxena 40222517ca render.article.getProcessesHtml: Add tests
Change-Id: I2e000fd884df9113f1810ec1ca2aa1562a88790b
2014-06-11 12:47:52 +05:30