-
Notifications
You must be signed in to change notification settings - Fork 26
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
Clarify whitespace handling #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one question, otherwise LTGM
index.rst
Outdated
|
||
- Blank: contains only whitespace characters. | ||
- Blank: contains nothing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
- Blank: contains nothing. | |
- Blank: contains nothing or only whitespace characters. |
?
There was a problem hiding this comment.
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: ...
Any news here? :-) |
@cxw42 thanks for opening this - i got a question, so this to clarify that all empty lines (using only invisible characters) are ignored and all other lines should be interpreted after trimming (removing all invisible characters)? I am asking this because i was confused if that is meant with "once leading whitespace is removed (and ignoring any trailing line separator". |
I'd say the only meaning changes here are, that blank lines may be empty when before they needed to have any whitespace, except if you consider the line separator part of the line. In the latter case I'd say all here is just using clearer words without semantic changes |
Thanks @Vampire - i'm no native speaker so i wonder if the whole description is just difficult paraphrase of
|
90b0a62
to
f4ebd49
Compare
I would re-add an explicit mentioning of empty lines. |
Updated!
Changes
$ git diff f4ebd49 5df4933
diff --git a/index.rst b/index.rst
index 2cf9e03..3ab63ce 100644
--- a/index.rst
+++ b/index.rst
@@ -79,18 +79,25 @@ EditorConfig files are in an INI-like file format.
To read an EditorConfig file, take one line at a time. For each line:
#. Strip all leading and trailing whitespace
+#. If the remaining text is empty, ignore the line.
#. If the remaining text is not empty, process the text as specified for its
type below.
The types of lines are:
-- Comment: starts with a ``;`` or a ``#``.
+- Comment: starts with a ``;`` or a ``#``. Comment lines are ignored.
+
- Section Header: starts with a ``[`` and ends with a ``]``.
+ These lines define globs; see :ref:`glob-expressions`.
+
- 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 ``=``.
+ See :ref:`supported-pairs`.
+
- 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
@@ -119,7 +126,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.
@@ -135,6 +142,8 @@ The parts of an EditorConfig file are:
- Section: the lines starting from a Section Header until the beginning of
the next Section Header or the end of the file.
+.. _glob-expressions:
+
Glob Expressions
================
@@ -187,6 +196,8 @@ precedence. If multiple EditorConfig files have matching sections, the rules
from the closer EditorConfig file are read last, so pairs in closer
files take precedence.
+.. _supported-pairs:
+
Supported Pairs
===============
|
f4ebd49
to
5df4933
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
5df4933
to
f4d169a
Compare
Change single-backticks to double-backticks as required by rst.
- Clarify that leading and trailing whitespace are ignored on all lines (so empty lines count as blank, which they technically did not before). - Express the parsing logic imperatively to make it easier to read. - Add links within the document from line types to relevant sections.
f4d169a
to
2dc95c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! 🎆
Fixes editorconfig/editorconfig#500