Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:Hooks/ParserSectionCreate

From mediawiki.org
<Manual:Hooks
This feature was removed completely in version 1.40.0 (after being deprecated in 1.35.0).There is no replacement hook. Instead,<section> tag wrapping will be done by core in future.
ParserSectionCreate
Available fromversion 1.19.0 (r92506,CodeReview archive)
Removed inversion 1.40.0 (Gerrit change 861504)
Called each time the parser creates a document section from wikitext.
Define function:
publicstaticfunctiononParserSectionCreate($parser,$section,&$sectionContent,$showEditLinks){...}
Attach hook:Inextension.json:
{"Hooks":{"ParserSectionCreate":"MediaWiki\\Extension\\MyExtension\\Hooks::onParserSectionCreate"}}
Called from:File(s):parser/Parser.php
Interface:ParserSectionCreateHook.php

For more information about attaching hooks, seeManual:Hooks.
For examples of extensions using this hook, seeCategory:ParserSectionCreate extensions.


Details

[edit]

Use this to apply per-section modifications to HTML (like wrapping the section in a DIV). Caveat: DIVs are valid wikitext, and a DIV can begin in one section and end in another. Make sure your code can handle that case gracefully.

  • $parser: the calling Parser instance.
  • $section: the section number, zero-based, but section 0 is usually empty.
  • &$sectionContent: ref to the content of the section. modify this.
  • $showEditLinks: boolean describing whether this section has an edit link.
Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:Hooks/ParserSectionCreate&oldid=6202420"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp