r92643 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92642‎ | r92643 | r92644 >
Date:17:08, 20 July 2011
Author:raindrift
Status:resolved (Comments)
Tags:
Comment:
Documenting new parser hook, re r92506.
This refers to an extension that's not checked in quite yet, FYI
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1355,6 +1355,17 @@
13561356 $file: file object that will be used to create the image
13571357 &$params: 2-D array of parameters
13581358
 1359+'ParserSectionCreate': Called each time the parser creates a document section
 1360+from wikitext. Use this to apply per-section modifications to HTML (like
 1361+wrapping the section in a DIV). Caveat: DIVs are valid wikitext, and a DIV
 1362+can begin in one section and end in another. Make sure your code can handle
 1363+that case gracefully. See the EditSectionClearerLink extension for an
 1364+example.
 1365+$this: the calling Parser instance
 1366+$section: the section number, zero-based, but section 0 is usually empty
 1367+&$sectionContent: ref to the content of the section. modify this.
 1368+$showEditLinks: boolean describing whether this section has an edit link
 1369+
13591370 'ParserTestParser': called when creating a new instance of Parser in
13601371 maintenance/parserTests.inc
13611372 $parser: Parser object created

Follow-up revisions

RevisionCommit summaryAuthorDate
r94106Followup r92643: refer to the passed object as $parser, not $thisdemon13:30, 9 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92506Refactored section assembly code to be more readable...raindrift23:23, 18 July 2011

Comments

#Comment by 😂 (talk | contribs)   13:29, 9 August 2011

Don't refer to the passed object as $this, call it $parser or something. People will use $this in their code and then wonder why it breaks :)

#Comment by 😂 (talk | contribs)   13:30, 9 August 2011

Took care of it in the followup.

Status & tagging log