Page MenuHomePhabricator

Include the extracted intro of a page using parser function
Open, Needs TriagePublic

Description

I think it should be possible to include the extracted limited opening of a page (what you see in PagePreviews) in another page using a parser function.
the syntax should be similiar to wikipediaExtracts.

For example, let's suppose you're writing an article about J.K. Rowling and you want to write a little about Harry Potter, instead of copying the start of the Harry Potter's article, you'll just add somthing like

==HarryPotter==
Main Article: '''[[Harry Potter]]'''
{{#PagePreview:HarryPotter}}

this will be exteremly usefull when you write an article about a movie and write a paragraph about his sequel, which is not out yet, so the details might change. If you used the suggested parser function, Once the sequel's article changes (maybe a little later when cache is used) so will the Preview included in the movie's article.

Event Timeline

nyemini created this task.Apr 5 2019, 9:18 AM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptApr 5 2019, 9:18 AM
nyemini updated the task description. (Show Details)Apr 5 2019, 9:21 AM
Nirmos added a subscriber: Nirmos.Apr 5 2019, 9:29 AM

This can be accomplished using the Template:Excerpt.

If you check the wikitext of the template, you will see that it uses the #lsth parser function and the Excerpt module.

You may also find the concept of cascading content interesting, cheers!

Thank you!
It seems to solve my problem. There is a question however wheter or not it should be Parser function.

Jdlrobson added a subscriber: Jdlrobson.

Page previews uses the page summary endpoint and doesn't have anything to do with the parser. The HTML for the summary must be in the page of the HTML. I'm not sure what the appropriate project for this should be but this sounds like something that can be done with the existing wiki markup.