Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: remove preprocessor-specific attributes#653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
dummdidumm wants to merge2 commits intomain
base:main
Choose a base branch
Loading
fromremove-attributes

Conversation

@dummdidumm
Copy link
Member

  • global for style tags
  • src for script/style tags

fixes#652

@dominikg does this fix the v-p-s issue?

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to runpnpm lint!)

Tests

  • Run the tests withnpm test orpnpm test

- global for style tags- src for script/style tagsfixes#652
/** Add a custom language preprocessor*/
potatoLanguage({ content, filename, attributes }) {
const {code,map }=require('potato-language').render(content);
const {src,...cleanedAttributes }= attributes;
Copy link
Member

Choose a reason for hiding this comment

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

this example does not make sense as i assume potato-language uses the lang attribute value.

If you want to show it here, the preprocessor would have to use a custompotato attribute that then gets filtered

};
};

exportconstremoveSrcAttribute=(attributes:Record<string,any>)=>{
Copy link
Member

@dominikgdominikgAug 28, 2024
edited
Loading

Choose a reason for hiding this comment

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

should this be a generic util?

exportconstfilterAttributes(attributes:Record<string,any>,filterFn:(a:string)=>boolean){returnObject.fromEntries(Object.entries(attributes).filter(([a])=>filterFn(a)))}

usage:

constcleanAttributes=filterAttributes(attributes,a=>a!=='src');// orconstattributesToRemove=['foo','bar'];constcleanMultipleAttributes=filterAttributes(attributes,a=>!attributesToRemove.includes(a))

that can be reused for global and potentially others?

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

Reviewers

1 more reviewer

@dominikgdominikgdominikg left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

svelte5 - custom attributes likesrc must be removed from tag when preprocessing them

3 participants

@dummdidumm@dominikg

[8]ページ先頭

©2009-2025 Movatter.jp