Add FastAPI (0.85.0) documentation
Unified · Split
| @@ -1,4 +1,8 @@ | ||
| 1 | 1 | [ |
| 2 | + [ | |
| 3 | + "2022-10-09", | |
| 4 | + "New documentation: <a href=\"/fastapi/\">FastAPI</a>" | |
| 5 | + ], | |
| 2 | 6 | [ |
| 3 | 7 | "2022-10-02", |
| 4 | 8 | "New documentation: <a href=\"/svelte/\">Svelte</a>" |
| @@ -326,6 +326,11 @@ credits = [ · 325 unmodified lines | ||
| 326 | 326 | '2019 by Falcon contributors', |
| 327 | 327 | 'Apache', |
| 328 | 328 | 'https://raw.githubusercontent.com/falconry/falcon/master/LICENSE' |
| 329 | + ], [ | |
| 330 | + 'FastAPI', | |
| 331 | + '2018 Sebastián Ramírez', | |
| 332 | + 'MIT', | |
| 333 | + 'https://github.com/tiangolo/fastapi/blob/master/LICENSE' | |
| 329 | 334 | ], [ |
| 330 | 335 | 'Fish', |
| 331 | 336 | '2005–2009 Axel Liljencrantz, 2009–2022 fish-shell contributors', |
| @@ -58,6 +58,7 @@ · 57 unmodified lines | ||
| 58 | 58 | 'pages/ember', |
| 59 | 59 | 'pages/erlang', |
| 60 | 60 | 'pages/express', |
| 61 | + 'pages/fastapi', | |
| 61 | 62 | 'pages/git', |
| 62 | 63 | 'pages/github', |
| 63 | 64 | 'pages/gnuplot', |
| @@ -0,0 +1,22 @@ | ||
| 1 | +._fastapi { | |
| 2 | + > h2 { @extend %block-heading; } | |
| 3 | + > h3 { @extend %block-label, %label-blue; } | |
| 4 | + | |
| 5 | + code { @extend %label; } | |
| 6 | + | |
| 7 | + .tabbed-block { | |
| 8 | + border: 1px dashed black; | |
| 9 | + padding: 0.5rem 1rem 0; | |
| 10 | + margin-bottom: 1rem; | |
| 11 | + } | |
| 12 | + .tabbed-block label { | |
| 13 | + font-weight: var(--bolderFontWeight); | |
| 14 | + } | |
| 15 | + | |
| 16 | + .admonition { @extend %note; } | |
| 17 | + .admonition.tip { @extend %note-green; } | |
| 18 | + .admonition.note { @extend %note-blue; } | |
| 19 | + .admonition-title { | |
| 20 | + font-weight: var(--bolderFontWeight); | |
| 21 | + } | |
| 22 | +} | |
| @@ -0,0 +1,34 @@ | ||
| 1 | +module Docs | |
| 2 | + class Fastapi | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + | |
| 5 | + def call | |
| 6 | + doc.css('.headerlink').remove | |
| 7 | + | |
| 8 | + if root_page? | |
| 9 | + doc.css('#sponsors ~ p', '#sponsors').remove | |
| 10 | + end | |
| 11 | + | |
| 12 | + doc.css('.tabbed-set').each do |node| | |
| 13 | + labels = node.css('.tabbed-labels label') | |
| 14 | + blocks = node.css('.tabbed-content .tabbed-block') | |
| 15 | + | |
| 16 | + blocks.each_with_index do |block_node, i| | |
| 17 | + block_node.prepend_child(labels[i]) if labels[i] | |
| 18 | + end | |
| 19 | + | |
| 20 | + node.css('> input, .tabbed-labels').remove | |
| 21 | + end | |
| 22 | + | |
| 23 | + doc.css('pre').each do |node| | |
| 24 | + node['class'] = "language-python" | |
| 25 | + node['data-language'] = "python" | |
| 26 | + node.content = node.at_css('code').content | |
| 27 | + end | |
| 28 | + | |
| 29 | + doc | |
| 30 | + end | |
| 31 | + | |
| 32 | + end | |
| 33 | + end | |
| 34 | +end | |
| @@ -0,0 +1,9 @@ | ||
| 1 | +module Docs | |
| 2 | + class Fastapi | |
| 3 | + class ContainerFilter < Filter | |
| 4 | + def call | |
| 5 | + at_css '.md-content > .md-content__inner' | |
| 6 | + end | |
| 7 | + end | |
| 8 | + end | |
| 9 | +end | |
| @@ -0,0 +1,40 @@ | ||
| 1 | +module Docs | |
| 2 | + class Fastapi | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + | |
| 5 | + def sanitized_path | |
| 6 | + path.gsub(/index$/, "") | |
| 7 | + end | |
| 8 | + | |
| 9 | + def path_parts | |
| 10 | + sanitized_path.split("/") | |
| 11 | + end | |
| 12 | + | |
| 13 | + def get_name | |
| 14 | + at_css('h1').content | |
| 15 | + end | |
| 16 | + | |
| 17 | + def get_type | |
| 18 | + if path_parts.length <= 1 | |
| 19 | + at_css('h1').content | |
| 20 | + else | |
| 21 | + path_parts[0...-1].join(": ").titleize + ": " + at_css('h1').content | |
| 22 | + end | |
| 23 | + end | |
| 24 | + | |
| 25 | + def additional_entries | |
| 26 | + entries = [] | |
| 27 | + type = get_type | |
| 28 | + | |
| 29 | + css('h2').each do |node| | |
| 30 | + name = node.content | |
| 31 | + id = path + "#" + node['id'] | |
| 32 | + entries << [name, id, type] | |
| 33 | + end | |
| 34 | + | |
| 35 | + entries | |
| 36 | + end | |
| 37 | + | |
| 38 | + end | |
| 39 | + end | |
| 40 | +end | |
| @@ -0,0 +1,31 @@ | ||
| 1 | +module Docs | |
| 2 | + class Fastapi < UrlScraper | |
| 3 | + self.name = 'FastAPI' | |
| 4 | + self.type = 'fastapi' | |
| 5 | + self.release = '0.85.0' | |
| 6 | + self.base_url = 'https://fastapi.tiangolo.com/' | |
| 7 | + self.root_path = '/' | |
| 8 | + self.links = { | |
| 9 | + home: 'https://fastapi.tiangolo.com/', | |
| 10 | + code: 'https://github.com/tiangolo/fastapi' | |
| 11 | + } | |
| 12 | + | |
| 13 | + options[:only_patterns] = [ | |
| 14 | + /\Afeatures\//, /\Apython-types\//, | |
| 15 | + /\Atutorial\//, /\Aadvanced\//, /\Aasync\//, | |
| 16 | + /\Adeployment\//, /\Aproject-generation\// | |
| 17 | + ] | |
| 18 | + | |
| 19 | + html_filters.push 'fastapi/container', 'fastapi/clean_html', 'fastapi/entries' | |
| 20 | + | |
| 21 | + options[:attribution] = <<-HTML | |
| 22 | + © 2018 Sebastián Ramírez<br> | |
| 23 | + Licensed under the MIT License. | |
| 24 | + HTML | |
| 25 | + | |
| 26 | + def get_latest_version(opts) | |
| 27 | + get_latest_github_release('tiangolo', 'fastapi', opts) | |
| 28 | + end | |
| 29 | + | |
| 30 | + end | |
| 31 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +https://fastapi.tiangolo.com/img/favicon.png | |