Skip to content

Commit

Permalink
Merge branch 'main' into flutter-gpu-review
Browse files Browse the repository at this point in the history
  • Loading branch information
chenglu authored Aug 7, 2024
2 parents e407fb4 + f4cd13b commit 78866a3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/content/posts/whats-new-in-flutter-3-24.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Flutter GPU 扩展了 Flutter 的直接渲染能力,实现高级图形和 3D

要深入了解 Flutter GPU 并了解如何在项目中利用它,请查看详细的 [Flutter GPU 博客文章](https://medium.com/flutter/getting-started-with-flutter-gpu-f33d497b7c11)。无论你是创建游戏还是复杂图形,Flutter 的新 GPU 功能都使其成为你的产品的强大选择。

## Web
## Web

### 多视图嵌入

Expand Down Expand Up @@ -160,7 +160,7 @@ Flutter Web 应用现在可以利用多视图嵌入,允许开发者同时将

资源: [插件指南](https://pub.flutter-io.cn/packages/interactive_media_ads)[示例应用](https://pub.flutter-io.cn/packages/interactive_media_ads/example)[Git 仓库](https://github.com/flutter/packages/tree/main/packages/interactive_media_ads)

## iOS
## iOS

### Swift Package Manager 初步支持

Expand Down
43 changes: 27 additions & 16 deletions tool/translator/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ const replace = require('gulp-replace');
// 为了翻译工具能正确匹配,
// 需要为一些结构格式做出调整。

// 适用路径
const gulpSrc = [
'../../_site/**/*.html',
'../../_site/!(about|community|disclaimer|posts|tutorials)/**/!(*_cn).html',
'!../../_site/{about,disclaimer,posts}/**/*.html',
'!../../_site/community/tutorials/**/*.html',
'../../_site/community/china/index.html',
'../../_site/*/index.html',
'../../_site/index.html',
];

// 去掉中文标点与中文间的空格
gulp.task('remove-space', () => {
return gulp.src(['../../_site/**/*.html'])
Expand All @@ -14,23 +25,23 @@ gulp.task('remove-space', () => {
// 匹配替换目录相关格式
gulp.task('mark-side-toc', () => {
// 宽显示屏右侧目录 正则匹配
const wideRegexp = /<li class="toc-entry nav-item toc-h(\d)">\s*<a class="nav-link" href="#(.*?)">(?!.*[\u4e00-\u9fa5])(.*?)<\/a>\s*<\/li>\s*<li class="toc-entry nav-item toc-h(\d)">\s*<a class="nav-link" href="#(.*?)">(?=.*[\u4e00-\u9fa5])(.*?)<\/a>/g;
const wideRegexp = /<li class="toc-entry nav-item toc-h(\d)">\s*<a class="nav-link" href="#(.*?)">(?!.*[\u4e00-\u9fa5])(.*?)<\/a>\s*<\/li>\s*<li class="toc-entry nav-item toc-h\1">\s*<a class="nav-link" href="#(.*?)">(?=.*[\u4e00-\u9fa5])(.*?)<\/a>/g;
// 移动端显示屏顶部目录 正则匹配
const mobileRegexp = /<li class="toc-entry toc-h(\d)">\s*<a href="#(.*?)">(?!.*[\u4e00-\u9fa5])(.*?)<\/a>\s*<\/li>\s*<li class="toc-entry toc-h(\d)">\s*<a href="#(.*?)">(?=.*[\u4e00-\u9fa5])(.*?)<\/a>/g;
const mobileRegexp = /<li class="toc-entry toc-h(\d)">\s*<a href="#(.*?)">(?!.*[\u4e00-\u9fa5])(.*?)<\/a>\s*<\/li>\s*<li class="toc-entry toc-h\1">\s*<a href="#(.*?)">(?=.*[\u4e00-\u9fa5])(.*?)<\/a>/g;

return gulp.src(['../../_site/**/*.html'])
return gulp.src(gulpSrc)
// 宽显示屏右侧目录
.pipe(
replace(wideRegexp, (match, p1, p2, p3, p4, p5, p6) => {
replace(wideRegexp, (match, p1, p2, p3, p4, p5) => {
// 注意:不能以 </li> 结尾,避免分级标题混乱
return `<li class="toc-entry nav-item toc-h${p1}"><a class="nav-link" href="#${p2}"><t>${p3}</t><t>${p6}</t></a>`;
return `<li class="toc-entry nav-item toc-h${p1}"><a class="nav-link" href="#${p2}"><t>${p3}</t><t>${p5}</t></a>`;
})
)
// 移动端显示屏顶部目录
.pipe(
replace(mobileRegexp, (match, p1, p2, p3, p4, p5, p6) => {
replace(mobileRegexp, (match, p1, p2, p3, p4, p5) => {
// 注意:不能以 </li> 结尾,避免分级标题混乱
return `<li class="toc-entry toc-h${p1}"><a href="#${p2}"><t>${p3}</t><t>${p6}</t></a>`;
return `<li class="toc-entry toc-h${p1}"><a href="#${p2}"><t>${p3}</t><t>${p5}</t></a>`;
})
)
.pipe(gulp.dest('../../_site'));
Expand All @@ -39,29 +50,29 @@ gulp.task('mark-side-toc', () => {
// 匹配替换正文分级标题相关格式
gulp.task('mark-side-level-title', () => {
// 正文分级标题 正则匹配
const titleRegexp = /<div class="header-wrapper">\s*<h(\d) id="(.*?)">(?!.*[\u4e00-\u9fa5])(.*?)<\/h(\d)>\s*<a class="heading-link" href="#(.*?)" aria-label="(.*?)">#<\/a>\s*<\/div>\s*<div class="header-wrapper">\s*<h(\d) id="(.*?)">(?=.*[\u4e00-\u9fa5])(.*?)<\/h(\d)>\s*<a class="heading-link" href="#(.*?)" aria-label="(.*?)">#<\/a>\s*<\/div>/g;
const titleRegexp = /<div class="header-wrapper">\s*<h(\d) id="(.*?)">(?!.*[\u4e00-\u9fa5])(.*?)<\/h\1>\s*<a class="heading-link" href="#(.*?)" aria-label="(.*?)">#<\/a>\s*<\/div>\s*<div class="header-wrapper">\s*<h\1 id="(.*?)">(?=.*[\u4e00-\u9fa5])(.*?)<\/h\1>\s*<a class="heading-link" href="#(.*?)" aria-label="(.*?)">#<\/a>\s*<\/div>/g;
// 正文分级标题(no_toc) 正则匹配
const titleNoTocRegexp = /<div class="header-wrapper">\s*<h(\d) class="no_toc" id="(.*?)">(?!.*[\u4e00-\u9fa5])(.*?)<\/h(\d)>\s*<a class="heading-link" href="#(.*?)" aria-label="(.*?)">#<\/a>\s*<\/div>\s*<div class="header-wrapper">\s*<h(\d) class="no_toc" id="(.*?)">(?=.*[\u4e00-\u9fa5])(.*?)<\/h(\d)>\s*<a class="heading-link" href="#(.*?)" aria-label="(.*?)">#<\/a>\s*<\/div>/g;
const titleNoTocRegexp = /<div class="header-wrapper">\s*<h(\d) class="no_toc" id="(.*?)">(?!.*[\u4e00-\u9fa5])(.*?)<\/h\1>\s*<a class="heading-link" href="#(.*?)" aria-label="(.*?)">#<\/a>\s*<\/div>\s*<div class="header-wrapper">\s*<h\1 class="no_toc" id="(.*?)">(?=.*[\u4e00-\u9fa5])(.*?)<\/h\1>\s*<a class="heading-link" href="#(.*?)" aria-label="(.*?)">#<\/a>\s*<\/div>/g;

return gulp.src(['../../_site/**/*.html'])
return gulp.src(gulpSrc)
// 正文分级标题
.pipe(
replace(titleRegexp, (match, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) => {
replace(titleRegexp, (match, p1, p2, p3, p4, p5, p6, p7, p8, p9) => {
return `
<div class="header-wrapper">
<h${p1} id="${p2}">${p3}</h${p1}><h${p1} id="${p2}">${p9}</h${p1}>
<a class="heading-link" href="#${p5}" aria-label="${p6}">#</a>
<h${p1} id="${p2}">${p3}</h${p1}><h${p1} id="${p2}">${p7}</h${p1}>
<a class="heading-link" href="#${p4}" aria-label="${p5}">#</a>
</div>
`;
})
)
// 正文分级标题(no_toc)
.pipe(
replace(titleNoTocRegexp, (match, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) => {
replace(titleNoTocRegexp, (match, p1, p2, p3, p4, p5, p6, p7, p8, p9) => {
return `
<div class="header-wrapper">
<h${p1} class="no_toc" id="${p2}">${p3}</h${p1}><h${p1} class="no_toc" id="${p2}">${p9}</h${p1}>
<a class="heading-link" href="#${p5}" aria-label="${p6}">#</a>
<h${p1} class="no_toc" id="${p2}">${p3}</h${p1}><h${p1} class="no_toc" id="${p2}">${p7}</h${p1}>
<a class="heading-link" href="#${p4}" aria-label="${p5}">#</a>
</div>
`;
})
Expand Down

0 comments on commit 78866a3

Please sign in to comment.