mirror of
https://github.com/google/styleguide.git
synced 2026-10-28 08:25:21 +08:00
enable block html parsing for zippies
This doesn't directly support zippies, but it's needed in cases where guides use <div> blocks as the first zippy element. For now, it should be a noop. This resyncs the vim guide to the latest (with most zippies removed) and replaces the manual Python TOC with an automatic one like most of the other guides.
This commit is contained in:
1 parent
e257cb5e92
commit
1090d42f3a
3 files changed
+24
-80
No files matched your search
@@ -1,3 +1,9 @@
|
||||
# Config settings for Jekyll site rendering.
|
||||
|
||||
title: Google Style Guides
|
||||
|
||||
# Needed to support <div> blocks used with <details> and zippies.
|
||||
# Our markdown files largely don't use raw HTML (by design), so it
|
||||
# shouldn't have negative impacts in general.
|
||||
kramdown:
|
||||
parse_block_html: true
|
||||
+2
-80
@@ -6,86 +6,8 @@ See README.md for details.
|
||||
|
||||
# Google Python Style Guide
|
||||
|
||||
<!-- markdown="1" is required for GitHub Pages to render the TOC properly. -->
|
||||
|
||||
<details markdown="1">
|
||||
<summary>Table of Contents</summary>
|
||||
|
||||
- [1 Background](#s1-background)
|
||||
- [2 Python Language Rules](#s2-python-language-rules)
|
||||
* [2.1 Lint](#s2.1-lint)
|
||||
* [2.2 Imports](#s2.2-imports)
|
||||
* [2.3 Packages](#s2.3-packages)
|
||||
* [2.4 Exceptions](#s2.4-exceptions)
|
||||
* [2.5 Mutable Global State](#s2.5-global-variables)
|
||||
* [2.6 Nested/Local/Inner Classes and Functions](#s2.6-nested)
|
||||
* [2.7 Comprehensions & Generator Expressions](#s2.7-comprehensions)
|
||||
* [2.8 Default Iterators and Operators](#s2.8-default-iterators-and-operators)
|
||||
* [2.9 Generators](#s2.9-generators)
|
||||
* [2.10 Lambda Functions](#s2.10-lambda-functions)
|
||||
* [2.11 Conditional Expressions](#s2.11-conditional-expressions)
|
||||
* [2.12 Default Argument Values](#s2.12-default-argument-values)
|
||||
* [2.13 Properties](#s2.13-properties)
|
||||
* [2.14 True/False Evaluations](#s2.14-truefalse-evaluations)
|
||||
* [2.16 Lexical Scoping](#s2.16-lexical-scoping)
|
||||
* [2.17 Function and Method Decorators](#s2.17-function-and-method-decorators)
|
||||
* [2.18 Threading](#s2.18-threading)
|
||||
* [2.19 Power Features](#s2.19-power-features)
|
||||
* [2.20 Modern Python: from \_\_future\_\_ imports](#s2.20-modern-python)
|
||||
* [2.21 Type Annotated Code](#s2.21-type-annotated-code)
|
||||
- [3 Python Style Rules](#s3-python-style-rules)
|
||||
* [3.1 Semicolons](#s3.1-semicolons)
|
||||
* [3.2 Line length](#s3.2-line-length)
|
||||
* [3.3 Parentheses](#s3.3-parentheses)
|
||||
* [3.4 Indentation](#s3.4-indentation)
|
||||
+ [3.4.1 Trailing commas in sequences of items?](#s3.4.1-trailing-commas)
|
||||
* [3.5 Blank Lines](#s3.5-blank-lines)
|
||||
* [3.6 Whitespace](#s3.6-whitespace)
|
||||
* [3.7 Shebang Line](#s3.7-shebang-line)
|
||||
* [3.8 Comments and Docstrings](#s3.8-comments-and-docstrings)
|
||||
+ [3.8.1 Docstrings](#s3.8.1-comments-in-doc-strings)
|
||||
+ [3.8.2 Modules](#s3.8.2-comments-in-modules)
|
||||
+ [3.8.2.1 Test modules](#s3.8.2.1-test-modules)
|
||||
+ [3.8.3 Functions and Methods](#s3.8.3-functions-and-methods)
|
||||
+ [3.8.3.1 Overridden Methods](#s3.8.3.1-overridden-methods)
|
||||
+ [3.8.4 Classes](#s3.8.4-comments-in-classes)
|
||||
+ [3.8.5 Block and Inline Comments](#s3.8.5-block-and-inline-comments)
|
||||
+ [3.8.6 Punctuation, Spelling, and Grammar](#s3.8.6-punctuation-spelling-and-grammar)
|
||||
* [3.10 Strings](#s3.10-strings)
|
||||
+ [3.10.1 Logging](#s3.10.1-logging)
|
||||
+ [3.10.2 Error Messages](#s3.10.2-error-messages)
|
||||
* [3.11 Files, Sockets, and similar Stateful Resources](#s3.11-files-sockets-closeables)
|
||||
* [3.12 TODO Comments](#s3.12-todo-comments)
|
||||
* [3.13 Imports formatting](#s3.13-imports-formatting)
|
||||
* [3.14 Statements](#s3.14-statements)
|
||||
* [3.15 Accessors](#s3.15-accessors)
|
||||
* [3.16 Naming](#s3.16-naming)
|
||||
+ [3.16.1 Names to Avoid](#s3.16.1-names-to-avoid)
|
||||
+ [3.16.2 Naming Conventions](#s3.16.2-naming-conventions)
|
||||
+ [3.16.3 File Naming](#s3.16.3-file-naming)
|
||||
+ [3.16.4 Guidelines derived from Guido's Recommendations](#s3.16.4-guidelines-derived-from-guidos-recommendations)
|
||||
* [3.17 Main](#s3.17-main)
|
||||
* [3.18 Function length](#s3.18-function-length)
|
||||
* [3.19 Type Annotations](#s3.19-type-annotations)
|
||||
+ [3.19.1 General Rules](#s3.19.1-general-rules)
|
||||
+ [3.19.2 Line Breaking](#s3.19.2-line-breaking)
|
||||
+ [3.19.3 Forward Declarations](#s3.19.3-forward-declarations)
|
||||
+ [3.19.4 Default Values](#s3.19.4-default-values)
|
||||
+ [3.19.5 NoneType](#s3.19.5-nonetype)
|
||||
+ [3.19.6 Type Aliases](#s3.19.6-type-aliases)
|
||||
+ [3.19.7 Ignoring Types](#s3.19.7-ignoring-types)
|
||||
+ [3.19.8 Typing Variables](#s3.19.8-typing-variables)
|
||||
+ [3.19.9 Tuples vs Lists](#s3.19.9-tuples-vs-lists)
|
||||
+ [3.19.10 Type variables](#s3.19.10-typevars)
|
||||
+ [3.19.11 String types](#s3.19.11-string-types)
|
||||
+ [3.19.12 Imports For Typing](#s3.19.12-imports-for-typing)
|
||||
+ [3.19.13 Conditional Imports](#s3.19.13-conditional-imports)
|
||||
+ [3.19.14 Circular Dependencies](#s3.19.14-circular-dependencies)
|
||||
+ [3.19.15 Generics](#s3.19.15-generics)
|
||||
+ [3.19.16 Build Dependencies](#s3.19.16-build-dependencies)
|
||||
- [4 Parting Words](#4-parting-words)
|
||||
|
||||
</details>
|
||||
* TOC
|
||||
{:toc}
|
||||
|
||||
<a id="s1-background"></a>
|
||||
<a id="1-background"></a>
|
||||
|
||||
@@ -551,12 +551,16 @@ Vim plugins should provide any or all of the following: **Commands**,
|
||||
### Commands
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
* Define in `plugin/commands.vim`.
|
||||
* CommandNamesLikeThis.
|
||||
* Prefer semantic names to a unified prefix.
|
||||
* Do not use `[!]`
|
||||
* Extract logic into functions.
|
||||
|
||||
</div>
|
||||
|
||||
* `CommandNamesLikeThis`
|
||||
|
||||
* Commands should be defined in one block with no whitespace between them.
|
||||
@@ -611,12 +615,16 @@ Vim plugins should provide any or all of the following: **Commands**,
|
||||
### Autocommands
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
* Define in `plugin/autocmds.vim`.
|
||||
* Use augroups.
|
||||
* `augroup_names_like_this`.
|
||||
* Clear the augroup first.
|
||||
* Extract logic into functions.
|
||||
|
||||
</div>
|
||||
|
||||
* All autocommands should be defined in the `plugin/autocmds.vim` file.
|
||||
|
||||
* This allows users to disable your autocommands with `Glaive myplugin
|
||||
@@ -645,12 +653,16 @@ Vim plugins should provide any or all of the following: **Commands**,
|
||||
### Functions
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
* FunctionNamesLikeThis.
|
||||
* Autoload all functions.
|
||||
* Prefix script-local functions with `s:`
|
||||
* Use `[!]`.
|
||||
* Use `[abort]`.
|
||||
|
||||
</div>
|
||||
|
||||
* `FunctionNamesLikeThis`
|
||||
|
||||
* Prefix all script-local functions with `s:`
|
||||
@@ -695,10 +707,14 @@ Vim plugins should provide any or all of the following: **Commands**,
|
||||
### Mappings
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
* Provide opt-in key mappings in `plugin/mappings.vim`.
|
||||
* `<Plug>` mappings can be defined in `plugin/plugs.vim` (unlike mappings.vim,
|
||||
plugs.vim is opt-out).
|
||||
|
||||
</div>
|
||||
|
||||
* Define key mappings in `plugin/mappings.vim`, using
|
||||
`maktaba#plugin#MapPrefix` to get a prefix.
|
||||
|
||||
|
||||
Reference in new issue
Block a user