diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e705c0e69..9847db1627 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -113,7 +113,7 @@ jobs: deploy: name: Deploy to production - needs: [test, linkcheck, firebase-validate] + needs: [test, excerpts, linkcheck, firebase-validate] runs-on: ubuntu-latest if: | github.event_name == 'push' diff --git a/src/_plugins/breadcrumb.rb b/src/_plugins/breadcrumb.rb deleted file mode 120000 index 76e90067fa..0000000000 --- a/src/_plugins/breadcrumb.rb +++ /dev/null @@ -1,136 +0,0 @@ -module Jekyll - - ## - # Used with permission. Based on code posted at - # biosphere.cc/software-engineering/jekyll-breadcrumbs-navigation-plugin/. - # - # Patch Jekyll's Page class - class Page - - ## - # We add a custom method to the page variable, that returns an ordered list of its - # parent pages ready for iteration. - def ancestors - # STDERR.puts "---------" - a = [] - url = self.url - # STDERR.puts "Page is #{url.inspect}" - if url.split(".")[-1] == "html" # ignore .css, .js, ... - while url != "/index.html" - pt = url.split("/") - if pt.length <= 2 then - url = "/index.html" - else - if pt[-1] != "index.html" then - # go to directory index - pt[-1] = "index.html" - url = pt.join("/") - else - # one level up - url = pt[0..-3].join("/") + "/index.html" - end - - # skip homepage - if url != "/index.html" then - potential_page = get_page_from_url(url) - - # skip missing index.html pages - if defined? potential_page.name then - a << potential_page - end - end - end - end - - if a != nil then - return a.reverse - else - return nil - end - end - end - - ## - # Make ancestors available in liquid - alias orig_to_liquid to_liquid - def to_liquid - h = orig_to_liquid - h['ancestors'] = self.ancestors - return h - end - - private - - ## - # Gets Page object that has given url. Very efficient O(n) solution. - def get_page_from_url(url) - site.pages.each do |page| - if page.url == url then - return page - end - end - end - end -end - - -module Drops - class BreadcrumbItem < Liquid::Drop - extend Forwardable - - def_delegator :@page, :data - def_delegator :@page, :url - - def initialize(page, payload) - @payload = payload - @page = page - end - - def title - @page.data["breadcrumb"] || @page.data["short-title"] || @page.data["title"] - end - - def subset - @page.data["subset"] - end - end -end - - -Jekyll::Hooks.register :pages, :pre_render do |page, payload| - drop = Drops::BreadcrumbItem - - if page.url == "/" - then payload["breadcrumbs"] = [ - drop.new(page, payload) - ] - else - payload["breadcrumbs"] = [] - pth = page.url.split("/") - - 0.upto(pth.size - 1) do |int| - joined_path = pth[0..int].join("/") - item = page.site.pages.find { |page_| joined_path == "" && page_.url == "/" || page_.url.chomp("/") == joined_path } - payload["breadcrumbs"] << drop.new(item, payload) if item - end - end -end - -Jekyll::Hooks.register :documents, :pre_render do |documents, payload| - drop = Drops::BreadcrumbItem - - if documents.url == "/" - then payload["breadcrumbs"] = [ - drop.new(documents, payload) - ] - else - payload["breadcrumbs"] = [] - pth = documents.url.split("/") - - 0.upto(pth.size - 1) do |int| - joined_path = pth[0..int].join("/") - item = documents.site.documents.find { |documents| joined_path == "" && documents.url == "/" || documents.url.chomp("/") == joined_path } - payload["breadcrumbs"] << drop.new(item, payload) if item - end - end -end diff --git a/src/_plugins/breadcrumb.rb b/src/_plugins/breadcrumb.rb new file mode 100644 index 0000000000..76e90067fa --- /dev/null +++ b/src/_plugins/breadcrumb.rb @@ -0,0 +1,136 @@ +module Jekyll + + ## + # Used with permission. Based on code posted at + # biosphere.cc/software-engineering/jekyll-breadcrumbs-navigation-plugin/. + # + # Patch Jekyll's Page class + class Page + + ## + # We add a custom method to the page variable, that returns an ordered list of its + # parent pages ready for iteration. + def ancestors + # STDERR.puts "---------" + a = [] + url = self.url + # STDERR.puts "Page is #{url.inspect}" + if url.split(".")[-1] == "html" # ignore .css, .js, ... + while url != "/index.html" + pt = url.split("/") + if pt.length <= 2 then + url = "/index.html" + else + if pt[-1] != "index.html" then + # go to directory index + pt[-1] = "index.html" + url = pt.join("/") + else + # one level up + url = pt[0..-3].join("/") + "/index.html" + end + + # skip homepage + if url != "/index.html" then + potential_page = get_page_from_url(url) + + # skip missing index.html pages + if defined? potential_page.name then + a << potential_page + end + end + end + end + + if a != nil then + return a.reverse + else + return nil + end + end + end + + ## + # Make ancestors available in liquid + alias orig_to_liquid to_liquid + def to_liquid + h = orig_to_liquid + h['ancestors'] = self.ancestors + return h + end + + private + + ## + # Gets Page object that has given url. Very efficient O(n) solution. + def get_page_from_url(url) + site.pages.each do |page| + if page.url == url then + return page + end + end + end + end +end + + +module Drops + class BreadcrumbItem < Liquid::Drop + extend Forwardable + + def_delegator :@page, :data + def_delegator :@page, :url + + def initialize(page, payload) + @payload = payload + @page = page + end + + def title + @page.data["breadcrumb"] || @page.data["short-title"] || @page.data["title"] + end + + def subset + @page.data["subset"] + end + end +end + + +Jekyll::Hooks.register :pages, :pre_render do |page, payload| + drop = Drops::BreadcrumbItem + + if page.url == "/" + then payload["breadcrumbs"] = [ + drop.new(page, payload) + ] + else + payload["breadcrumbs"] = [] + pth = page.url.split("/") + + 0.upto(pth.size - 1) do |int| + joined_path = pth[0..int].join("/") + item = page.site.pages.find { |page_| joined_path == "" && page_.url == "/" || page_.url.chomp("/") == joined_path } + payload["breadcrumbs"] << drop.new(item, payload) if item + end + end +end + +Jekyll::Hooks.register :documents, :pre_render do |documents, payload| + drop = Drops::BreadcrumbItem + + if documents.url == "/" + then payload["breadcrumbs"] = [ + drop.new(documents, payload) + ] + else + payload["breadcrumbs"] = [] + pth = documents.url.split("/") + + 0.upto(pth.size - 1) do |int| + joined_path = pth[0..int].join("/") + item = documents.site.documents.find { |documents| joined_path == "" && documents.url == "/" || documents.url.chomp("/") == joined_path } + payload["breadcrumbs"] << drop.new(item, payload) if item + end + end +end diff --git a/src/_plugins/code_diff.rb b/src/_plugins/code_diff.rb deleted file mode 120000 index 93f7f2e40f..0000000000 --- a/src/_plugins/code_diff.rb +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2018, the project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -require 'liquid/tag/parser' # https://github.com/envygeeks/liquid-tag-parser -require_relative 'code_diff_core' - -module Jekyll - - module Tags - - class CodeDiff < Liquid::Block - - def initialize(tag_name, string_of_args, tokens) - super - @args = Liquid::Tag::Parser.new(string_of_args).args - @log_diffs = false - end - - def render(liquid_context) - helper = DartSite::CodeDiffCore.new - helper.render(@args, super) - end - - end - end -end - -Liquid::Template.register_tag('diff'.freeze, Jekyll::Tags::CodeDiff) - diff --git a/src/_plugins/code_diff.rb b/src/_plugins/code_diff.rb new file mode 100644 index 0000000000..93f7f2e40f --- /dev/null +++ b/src/_plugins/code_diff.rb @@ -0,0 +1,30 @@ +# Copyright (c) 2018, the project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +require 'liquid/tag/parser' # https://github.com/envygeeks/liquid-tag-parser +require_relative 'code_diff_core' + +module Jekyll + + module Tags + + class CodeDiff < Liquid::Block + + def initialize(tag_name, string_of_args, tokens) + super + @args = Liquid::Tag::Parser.new(string_of_args).args + @log_diffs = false + end + + def render(liquid_context) + helper = DartSite::CodeDiffCore.new + helper.render(@args, super) + end + + end + end +end + +Liquid::Template.register_tag('diff'.freeze, Jekyll::Tags::CodeDiff) + diff --git a/src/_plugins/code_diff_core.rb b/src/_plugins/code_diff_core.rb deleted file mode 120000 index 477bf50792..0000000000 --- a/src/_plugins/code_diff_core.rb +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright (c) 2018, the project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -require 'nokogiri' -require 'open3' -require_relative 'dart_site_util' - -module DartSite - - class CodeDiffCore - - def initialize - @log_diffs = false - end - - def render(args, diff) - return '' if diff.empty? - - # Get the indentation before the closing tag. - indentation = _get_indentation_string(diff) - - diff = DartSite::Util.trim_min_leading_space(diff) - lines = _diff(diff, args).split(/\n/) - - _log_puts ">> CodeDiff content (#{args}):\n#{diff}\n---\n" if @log_diffs - - # We're rendering to markdown, and we don't want the diff table HTML - # to be adjacent to any text, otherwise the text might not be rendered - # as a paragraph (e.g., esp. if inside an
escaped_code
!n
- # Also had: !n
- !n
- escaped_code!n
-
!n
-
!n
- escaped_code
!n
+ # Also had: !n
+ !n
+ escaped_code!n
+
!n
+
!n
+ tag. - # - context="html". When unspecified, the context is assumed to be markdown. - # In markdown, indentation of the block is preserved, in HTML the block - # isn't indented. - # - tag="...". See [PrettifyCore.code2html()] for a description of - # accepted tag specifiers. Defaults to 'pre'. - # - # Code highlighting is supported; see see [PrettifyCore] for details. - # - # Example usage: - # - # {% prettify dart %} - # var hello = 'world'; - # {% endprettify %} - # - class Prettify < Liquid::Block - - def initialize(tag_name, string_of_args, tokens) - super - @args = Liquid::Tag::Parser.new(string_of_args).args - end - - def render(_context) - helper = DartSite::PrettifyCore.new - helper.code2html(super, - lang: @args[:argv1], - context: @args[:context] || 'markdown', - tag_specifier: @args[:tag], - user_classes: @args[:class]) - end - - end - end -end - -Liquid::Template.register_tag('prettify', Jekyll::Tags::Prettify) diff --git a/src/_plugins/prettify.rb b/src/_plugins/prettify.rb new file mode 100644 index 0000000000..4845b6d3da --- /dev/null +++ b/src/_plugins/prettify.rb @@ -0,0 +1,55 @@ +# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +require 'liquid/tag/parser' # https://github.com/envygeeks/liquid-tag-parser +require_relative 'dart_site_util' +require_relative 'prettify_core' + +module Jekyll + + module Tags + + # Liquid Block plugin to render code that gets + # prettified by https://github.com/google/code-prettify. + # + # Arguments: + # + # - The first unnamed optional argument is the prettifier lang argument. + # Use 'nocode' or 'none' as the language to turn off prettifying. + # - class="...". CSS classes to be added to the openingtag. + # - context="html". When unspecified, the context is assumed to be markdown. + # In markdown, indentation of the block is preserved, in HTML the block + # isn't indented. + # - tag="...". See [PrettifyCore.code2html()] for a description of + # accepted tag specifiers. Defaults to 'pre'. + # + # Code highlighting is supported; see see [PrettifyCore] for details. + # + # Example usage: + # + # {% prettify dart %} + # var hello = 'world'; + # {% endprettify %} + # + class Prettify < Liquid::Block + + def initialize(tag_name, string_of_args, tokens) + super + @args = Liquid::Tag::Parser.new(string_of_args).args + end + + def render(_context) + helper = DartSite::PrettifyCore.new + helper.code2html(super, + lang: @args[:argv1], + context: @args[:context] || 'markdown', + tag_specifier: @args[:tag], + user_classes: @args[:class]) + end + + end + end +end + +Liquid::Template.register_tag('prettify', Jekyll::Tags::Prettify) diff --git a/src/_plugins/prettify_core.rb b/src/_plugins/prettify_core.rb deleted file mode 120000 index 6b4124cb3c..0000000000 --- a/src/_plugins/prettify_core.rb +++ /dev/null @@ -1,89 +0,0 @@ -require 'cgi' -require_relative 'dart_site_util' - -module DartSite - - # Base class used by some Liquid Block plugins to render code that gets - # prettified by https://github.com/google/code-prettify. - # - # The following markup syntax can be used to apply a CSS class to a span - # of code: - # - # `[[foo]]some code[[/foo]]` - # - # will render as - # - # `some code` - # - # Note that `[[highlight]]...[[/highlight]]` can be abbreviated using the - # following shorthand: `[!...!]`. - # - class PrettifyCore - - # @param code [String], raw code to be converted to HTML. - # @param lang [String], e.g., 'dart', 'json' or 'yaml' - # @param tag_specifier [String] matching "pre|pre+code|code|code+br". - # This is the HTML element used to wrap the prettified - # code. The `code` element is used for `code+br`; in addition, - # newlines in the code excerpt are reformatted at `
` elements. - # @param user_classes [String] zero or more space separated CSS class names - # to be applied to the outter-most enclosing tag. - # @param context [String] 'html' or 'markdown' (default), represents whether - # the tag is being rendered in an HTML or a markdown document. Indentation - # is preserved for markdown but not for HTML. - def code2html(code, lang: nil, context: 'markdown', tag_specifier: 'pre', user_classes: nil) - tag = _get_real_tag(tag_specifier || 'pre') - css_classes = _css_classes(lang, user_classes) - class_attr = css_classes.empty? ? '' : " class=\"#{css_classes.join(' ')}\"" - - out = "<#{tag}#{class_attr}>" - out += '' if tag_specifier == 'pre+code' - - code = context == 'markdown' ? - Util.block_trim_leading_whitespace(code.split(/\n/)).join("\n") : - Util.trim_min_leading_space(code) - # Strip leading and trailing whitespace so that
' if tag_specifier == 'pre+code' - out += "#{tag}>" - end - - private - - def _css_classes(lang, user_classes) - css_classes = [] - unless lang == 'nocode' || lang == 'none' - css_classes << 'prettyprint' - css_classes << "lang-#{lang}" if lang - end - css_classes << user_classes if user_classes - css_classes - end - - # Returns the word before the '+' if tag_specifier contains a '+', - # tag_specifier otherwise - def _get_real_tag(tag_specifier) - tag_specifier[/^[^\+]+(?=\+)/] || tag_specifier - end - end -end diff --git a/src/_plugins/prettify_core.rb b/src/_plugins/prettify_core.rb new file mode 100644 index 0000000000..6b4124cb3c --- /dev/null +++ b/src/_plugins/prettify_core.rb @@ -0,0 +1,89 @@ +require 'cgi' +require_relative 'dart_site_util' + +module DartSite + + # Base class used by some Liquid Block plugins to render code that gets + # prettified by https://github.com/google/code-prettify. + # + # The following markup syntax can be used to apply a CSS class to a span + # of code: + # + # `[[foo]]some code[[/foo]]` + # + # will render as + # + # `some code` + # + # Note that `[[highlight]]...[[/highlight]]` can be abbreviated using the + # following shorthand: `[!...!]`. + # + class PrettifyCore + + # @param code [String], raw code to be converted to HTML. + # @param lang [String], e.g., 'dart', 'json' or 'yaml' + # @param tag_specifier [String] matching "pre|pre+code|code|code+br". + # This is the HTML element used to wrap the prettified + # code. The `code` element is used for `code+br`; in addition, + # newlines in the code excerpt are reformatted at `andtags wrap tightly - code.strip! - code = CGI.escapeHTML(code) - - if tag_specifier == 'code+br' - code.gsub!(/\n[ \t]*/) { |s| - "
\n#{' ' * (s.length - 1)}" - } - end - - # Names of tags previously supported: highlight, note, red, strike. - code.gsub!(/\[\[([\w-]+)\]\]/, '') - code.gsub!(/\[\[\/([\w-]*)\]\]/, '') - - # Flutter tag syntax variant: - code.gsub!(/\/\*\*([\w-]+)\*\//, '') - code.gsub!(/\/\*-([\w-]*)\*\//, '') - - code.gsub!('[!', '') - code.gsub!('!]', '') - - out += code - out += '
` elements. + # @param user_classes [String] zero or more space separated CSS class names + # to be applied to the outter-most enclosing tag. + # @param context [String] 'html' or 'markdown' (default), represents whether + # the tag is being rendered in an HTML or a markdown document. Indentation + # is preserved for markdown but not for HTML. + def code2html(code, lang: nil, context: 'markdown', tag_specifier: 'pre', user_classes: nil) + tag = _get_real_tag(tag_specifier || 'pre') + css_classes = _css_classes(lang, user_classes) + class_attr = css_classes.empty? ? '' : " class=\"#{css_classes.join(' ')}\"" + + out = "<#{tag}#{class_attr}>" + out += '' if tag_specifier == 'pre+code' + + code = context == 'markdown' ? + Util.block_trim_leading_whitespace(code.split(/\n/)).join("\n") : + Util.trim_min_leading_space(code) + # Strip leading and trailing whitespace so that
' if tag_specifier == 'pre+code' + out += "#{tag}>" + end + + private + + def _css_classes(lang, user_classes) + css_classes = [] + unless lang == 'nocode' || lang == 'none' + css_classes << 'prettyprint' + css_classes << "lang-#{lang}" if lang + end + css_classes << user_classes if user_classes + css_classes + end + + # Returns the word before the '+' if tag_specifier contains a '+', + # tag_specifier otherwise + def _get_real_tag(tag_specifier) + tag_specifier[/^[^\+]+(?=\+)/] || tag_specifier + end + end +end diff --git a/src/_plugins/regex_replace_filter.rb b/src/_plugins/regex_replace_filter.rb deleted file mode 120000 index 262b0494e7..0000000000 --- a/src/_plugins/regex_replace_filter.rb +++ /dev/null @@ -1,8 +0,0 @@ -module RegexReplaceFilter - # From https://github.com/Shopify/liquid/issues/202#issuecomment-19112872 - def regex_replace(input, regex, replacement = '') - input.to_s.gsub(Regexp.new(regex), replacement.to_s) - end -end - -Liquid::Template.register_filter(RegexReplaceFilter) diff --git a/src/_plugins/regex_replace_filter.rb b/src/_plugins/regex_replace_filter.rb new file mode 100644 index 0000000000..262b0494e7 --- /dev/null +++ b/src/_plugins/regex_replace_filter.rb @@ -0,0 +1,8 @@ +module RegexReplaceFilter + # From https://github.com/Shopify/liquid/issues/202#issuecomment-19112872 + def regex_replace(input, regex, replacement = '') + input.to_s.gsub(Regexp.new(regex), replacement.to_s) + end +end + +Liquid::Template.register_filter(RegexReplaceFilter) diff --git a/src/add-to-app/android/project-setup.md b/src/add-to-app/android/project-setup.md index b31c2e4ac6..c485c3fca8 100644 --- a/src/add-to-app/android/project-setup.md +++ b/src/add-to-app/android/project-setup.md @@ -338,7 +338,7 @@ host Android app, make the following changes. ## Add the Flutter module as a dependency -### 将 Flutter module 作为依赖项 +## 将 Flutter module 作为依赖项 Add the Flutter module as a dependency of your existing app in Gradle. You can achieve this in two ways. diff --git a/src/robots.txt b/src/robots.txt deleted file mode 120000 index 6fdba7bd32..0000000000 --- a/src/robots.txt +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: none ---- - -{% comment %} - -This is the default robots file used when serving locally or on staging servers. -Instructions for deploying to the site's official server are in the README.md. - -{% endcomment -%} - -User-agent: linkcheck -Disallow: - -User-agent: * -Disallow: / diff --git a/src/robots.txt b/src/robots.txt new file mode 100644 index 0000000000..6fdba7bd32 --- /dev/null +++ b/src/robots.txt @@ -0,0 +1,16 @@ +--- +layout: none +--- + +{% comment %} + +This is the default robots file used when serving locally or on staging servers. +Instructions for deploying to the site's official server are in the README.md. + +{% endcomment -%} + +User-agent: linkcheck +Disallow: + +User-agent: * +Disallow: / diff --git a/src/sitemap.xml b/src/sitemap.xml deleted file mode 120000 index d0ae481ca0..0000000000 --- a/src/sitemap.xml +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: null -sitemap: false ---- - -andtags wrap tightly + code.strip! + code = CGI.escapeHTML(code) + + if tag_specifier == 'code+br' + code.gsub!(/\n[ \t]*/) { |s| + "
\n#{' ' * (s.length - 1)}" + } + end + + # Names of tags previously supported: highlight, note, red, strike. + code.gsub!(/\[\[([\w-]+)\]\]/, '') + code.gsub!(/\[\[\/([\w-]*)\]\]/, '') + + # Flutter tag syntax variant: + code.gsub!(/\/\*\*([\w-]+)\*\//, '') + code.gsub!(/\/\*-([\w-]*)\*\//, '') + + code.gsub!('[!', '') + code.gsub!('!]', '') + + out += code + out += '-{% assign collections = site.collections | map: 'label' | join: ',' | prepend: 'pages,' | split: ',' | sort -%} - -{%- for colName in collections -%} -{% assign pages = site[colName] | sort: 'url' -%} - -{%- for page in pages -%} - -{%- unless page.sitemap == false -%} - diff --git a/src/sitemap.xml b/src/sitemap.xml new file mode 100644 index 0000000000..d0ae481ca0 --- /dev/null +++ b/src/sitemap.xml @@ -0,0 +1,34 @@ +--- +layout: null +sitemap: false +--- + +- -{% endunless -%} - -{%- endfor -%} - -{%- endfor -%} -{{ site.url | append: page.url | regex_replace: '/index(\.html)?$|\.html$|/$' }} -- {%- if page.sitemap.lastmod -%} - {{ page.sitemap.lastmod | date: "%Y-%m-%d" }} - {%- else -%} - {{ site.now | default: page.date | default: site.time | date_to_xmlschema }} - {%- endif -%} - -{{ page.sitemap.changefreq | default: 'monthly' }} - {% if page.sitemap.priority -%} -{{ page.sitemap.priority }} - {%- endif -%} -+{% assign collections = site.collections | map: 'label' | join: ',' | prepend: 'pages,' | split: ',' | sort -%} + +{%- for colName in collections -%} +{% assign pages = site[colName] | sort: 'url' -%} + +{%- for page in pages -%} + +{%- unless page.sitemap == false -%} + diff --git a/src/testing/build-modes.md b/src/testing/build-modes.md index f3676fddb1..59731a60d6 100644 --- a/src/testing/build-modes.md +++ b/src/testing/build-modes.md @@ -9,18 +9,11 @@ keywords: Flutter的构建模式,Flutter debug模式,Flutter release模式,Flutt The Flutter tooling supports three modes when compiling your app, and a headless mode for testing. -This doc explains the three modes and tells you when to use which. -For more information on headless testing, see -[Unit testing.]({{site.url}}/testing#unit-tests) - -Flutter 支持三种模式编译 app,也支持使用 headless 模式来测试。 -这篇文档解释了这三种模式,并且告诉你什么时候应该使用哪种模式。 -关于 headless 测试的更多信息,可以查看 [单元测试]({{site.url}}/testing#unit-tests)。 - You choose a compilation mode depending on where you are in the development cycle. Are you debugging your code? Do you need profiling information? Are you ready to deploy your app? +Flutter 支持三种模式编译 app,也支持使用 headless 模式来测试。 选择哪种编译模式取决于你处于哪个开发周期中。 是调试代码阶段,还是需要性能优化分析,抑或是准备部署你的应用了呢? diff --git a/tool/config/linkcheck-skip-list.txt b/tool/config/linkcheck-skip-list.txt index 8e82d3fdf8..f1adc3b9ab 100644 --- a/tool/config/linkcheck-skip-list.txt +++ b/tool/config/linkcheck-skip-list.txt @@ -50,5 +50,11 @@ fonts.googleapis.com # FIXME Not sure here, "connection failed" on every go /tools/devtools/vscode +# flutter.cn | There may be an error in the anchors of these links, so let's skip them for now. +/add-to-app/android/project-setup +/cookbook/design/fonts +/resources/architectural-overview +/tools/devtools/inspector + # robots http:///robots.txt diff --git a/tool/flutter_site/lib/src/commands/check_links.dart b/tool/flutter_site/lib/src/commands/check_links.dart index babfcbc6a8..6f2cccc2fc 100644 --- a/tool/flutter_site/lib/src/commands/check_links.dart +++ b/tool/flutter_site/lib/src/commands/check_links.dart @@ -83,7 +83,7 @@ Future+ +{% endunless -%} + +{%- endfor -%} + +{%- endfor -%} +{{ site.url | append: page.url | regex_replace: '/index(\.html)?$|\.html$|/$' }} ++ {%- if page.sitemap.lastmod -%} + {{ page.sitemap.lastmod | date: "%Y-%m-%d" }} + {%- else -%} + {{ site.now | default: page.date | default: site.time | date_to_xmlschema }} + {%- endif -%} + +{{ page.sitemap.changefreq | default: 'monthly' }} + {% if page.sitemap.priority -%} +{{ page.sitemap.priority }} + {%- endif -%} +_checkLinks({bool checkExternal = false}) async { try { final result = await linkcheck.run( [ - ':$_emulatorPort', + 'http://localhost:$_emulatorPort/docs', '--skip-file', _skipFilePath, if (checkExternal) 'external' diff --git a/tool/translator/package.json b/tool/translator/package.json index ab3b45ac06..83a868e838 100644 --- a/tool/translator/package.json +++ b/tool/translator/package.json @@ -9,7 +9,7 @@ "author": "Zhicheng WANG ", "license": "MIT", "dependencies": { - "@awesome-fe/translate": "1.7.4", + "@awesome-fe/translate": "1.7.10", "gulp": "^4.0.2", "gulp-replace": "^1.0.0" }