fix(parser,render): [[iftags]]の条件評価バグとCSS漏出を修正#22
Merged
Conversation
evaluateTagConditionがrequired=[], forbidden=[]のとき 全チェックをスキップしてtrueを返していた。 空条件はWikidotの「supercommentout」パターンであり、 常にfalseを返すべき。
Wikidot仕様ではbare tag(例: `[[iftags scp tale]]`)は OR条件(いずれか1つ一致で表示)だが、パーサーリゾルバは AND条件(全タグ必須)として扱っていた。 TagConditionにoptionalフィールドを追加し、 レンダラーと同じOR評価ロジックを実装。
pageTags未提供時にcollectStylesがiftags内のstyle要素を 無条件に抽出し、iftags条件に関係なくCSSが出力されていた。 collectStylesFromElementsでif-tags要素をスキップし、 renderIfTagsで条件一致時にstyleをinline出力するように変更。
collectStylesでif-tags位置にsentinelを挿入し、render時にslotとして 正しい位置にスタイルを出力する仕組みを導入。 resolve済み・未resolve両パスでCSS cascadeが一致する。
parser側のparseTagConditionと同じく、プレフィックスのみのトークン (例: "-", "+")はタグ名が空のため無視する。 これにより[[iftags -]]等がresolve/render両パスで一貫してfalseを返す。
@wdprlib/renderが@wdprlib/parserからSTYLE_SLOT_PREFIXをimportしていたが、 package.jsonに依存宣言がなかった。両パッケージが共通に依存する @wdprlib/astに定数を移動し、正しい依存グラフに修正。
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wdpr-demo-v1-files | ad88e30 | Commit Preview URL Branch Preview URL |
Feb 08 2026, 06:21 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[[iftags]]ブロックに関する以下のバグを修正:evaluateTagConditionが空条件でtrueを返していた(rendererはfalse)。[[iftags]](supercommentout)内のCSSやコンテンツが漏出する原因+/-なし)をparserはAND条件、rendererはOR条件として評価していた。Wikidot仕様はOR(rendererが正しい)getPageTags未提供時、iftags子要素のstyleがtree.stylesに漏出し、条件に関係なくCSSが出力されていたrenderInlineStylesフラグをRenderContextに追加し、任意深度のstyleを出力可能に[[iftags -]]等のプレフィックスのみトークンで、parser/renderer間の評価が異なっていた@wdprlib/render→@wdprlib/parserの未宣言依存を、@wdprlib/astへの移動で解消