Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify whitespace handling #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions conf.py
Expand Up @@ -21,8 +21,8 @@
copyright = '2019--2020, EditorConfig Team'
author = 'EditorConfig Team'

version = '0.16.0'
release = '0.16.0'
version = '0.16.1'
release = '0.16.1'

# -- General configuration ---------------------------------------------------

Expand Down
20 changes: 11 additions & 9 deletions index.rst
Expand Up @@ -73,23 +73,25 @@ EditorConfig organization.
File Format
===========

.. versionchanged:: 0.16.1

EditorConfig files are in an INI-like file format.
In an EditorConfig file, all beginning whitespace on each line is considered
irrelevant. Each line must be one of the following:
In an EditorConfig file, all beginning whitespace on each line is ignored.
Each line must be one of the following, once leading whitespace is removed
(and ignoring any trailing line separator):

- Blank: contains only whitespace characters.
- Blank: contains nothing.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe

Suggested change
- Blank: contains nothing.
- Blank: contains nothing or only whitespace characters.

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, I scratched my head a bit about that as well. The line just before the bullets says "once leading whitespace is removed", so there would be nothing left. I thought that was cleaner than adding "may contain leading whitespace" to each bullet.

How about moving blanks out of the bullets? Something like:

+When reading an EditorConfig file, the following are ignored:
+ - blank lines (empty, or nothing but whitespace)
+ - all beginning whitespace on each line.
+Each non-blank line must be one of the following, once leading whitespace is removed
+(and ignoring any trailing line separator):
- - Blank: contains only whitespace characters
  - Comment: ...

- Comment: starts with a ``;`` or a ``#``.
- Section Header: starts with a ``[`` and ends with a ``]``.
- May not use any non-whitespace characters outside of the surrounding
brackets.
- Trailing whitespace may follow the closing ``]``.
- May contain any characters between the square brackets (e.g.,
``[`` and ``]`` and even spaces and tabs are allowed).
- Forward slashes (``/``) are used as path separators.
- Backslashes (``\\``) are not allowed as path separators (even on Windows).
- Key-Value Pair (or Pair): contains a key and a value, separated by an `=`.
- Key: The part before the first `=` (trimmed of whitespace, but including
- Key-Value Pair (or Pair): contains a key and a value, separated by an ``=``.
- Key: The part before the first ``=`` (trimmed of whitespace, but including
any whitespace in the middle).
- Value: The part after the first `=` (trimmed of whitespace, but including
- Value: The part after the first ``=`` (trimmed of whitespace, but including
any whitespace in the middle).

Any line that is not one of the above is invalid.
Expand All @@ -115,7 +117,7 @@ This specification does not define any "escaping" mechanism for

.. admonition :: Compatibility

The EditorConfig file format formerly allowed the use of `;` and `#` after the
The EditorConfig file format formerly allowed the use of ``;`` and ``;`` after the
beginning of the line to mark the rest of a line as comment. This led to
confusion how to parse values containing those characters. Old EditorConfig
parsers may still allow inline comments.
Expand Down