Skip to content

PLATFORM-11770 pvxcode - render utility#11

Open
slayful wants to merge 1 commit into
masterfrom
PLATFORM-11770
Open

PLATFORM-11770 pvxcode - render utility#11
slayful wants to merge 1 commit into
masterfrom
PLATFORM-11770

Conversation

@slayful
Copy link
Copy Markdown
Contributor

@slayful slayful commented May 16, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “utility framework” rendering mode for PvXCode so that [build] / [skill] BBCode can be emitted as <fandom-util.PvxCode ... /> tags (instead of legacy HTML), gated by configuration and re-run through the parser for ParserTagHookHandler processing.

Changes:

  • Extended parseGwbbcode() with a utilityMode flag and introduced parseGwbbcodeUtility() to route [build] / [skill] to utility-mode callbacks.
  • Added utility-mode replacement helpers that emit <fandom-util.PvxCode ... /> tags.
  • Updated the parser hook (PvXCode::parserRender) to enable/disable legacy ResourceLoader modules and to re-parse output in utility mode.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
gwbbcode/gwbbcode.inc.php Adds utility-mode parsing path and callbacks that emit Utility Framework placeholder tags.
classes/PvXCode.php Adds config-gated utility mode and re-parses output so utility tags are processed by the parser.
Comments suppressed due to low confidence (2)

gwbbcode/gwbbcode.inc.php:2391

  • This comment block describes the feature gate as $wgPvxCodeUtility / $wgEnableUtilityFramework, but there is no $wgPvxCodeUtility usage in this repo and the actual gate in classes/PvXCode.php reads config keys (PvxCodeUtility and FandomConfigNames::EnableUtilityFramework). To avoid confusion, update the comment to use the same configuration mechanism/name used by the code.
 * UTILITY-FRAMEWORK MODE REPLACEMENT FUNCTIONS
 *
 * When $wgPvxCodeUtility (and $wgEnableUtilityFramework) are on, [build] and
 * [skill] bbcode is rendered as <fandom-util.PvxCode .../> tags that the
 * Fandom\GameUtility\ParserTagHookHandler turns into a placeholder for the
 * @fandom-utility/pvx-code Utility Framework package.

gwbbcode/gwbbcode.inc.php:2464

  • skill_replace_utility() always emits a <fandom-util.PvxCode ... /> tag, even when the skill name is not valid. The legacy skill_replace() returns the original text when gws_skill_id() fails; in utility mode this change can turn invalid/typoed skill names into utility placeholders instead of leaving the bbcode untouched. Consider validating with gws_skill_id() (and returning the original match when invalid) to preserve legacy behavior.
function skill_replace_utility( $reg ): string {
	[ , , $name ] = $reg;
	$name = html_safe_decode( $name );

	return gwbbcode_utility_tag( [ 'skill' => $name ] );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gwbbcode/gwbbcode.inc.php
Comment on lines 46 to +53
/**
* Prepares the page and then replaces gwBBCode with HTML
* This function is directly called by: extension\classes\PvXCode.php
* @param $text
* @param bool $build_name
* @param string $text
* @param string|false $build_name
* @param bool $utilityMode When true, builds and skills are rendered as
* <fandom-util.PvxCode ...> tags via {@see parseGwbbcodeUtility} instead of
* the legacy HTML pipeline.
Comment thread gwbbcode/gwbbcode.inc.php
Comment on lines +126 to +128
if ( !empty( $build_name ) && !preg_match( '#(\[build[^\]]*?) name="[^\]"]+"#isS', $text ) ) {
$text = preg_replace( '#(\[build )#is', "\\1name=\"$build_name\" ", $text );
}
Comment thread gwbbcode/gwbbcode.inc.php
Comment on lines +2424 to +2426
$prof = gws_build_profession( $att );
$primary = $prof !== false ? $prof['professions'] : '';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants