Skip to content

Commit 5df4933

Browse files
committed
Clarify wording of what lines need to be
- 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.
1 parent 014fdd4 commit 5df4933

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
copyright = '2019--2024, EditorConfig Team'
2222
author = 'EditorConfig Team'
2323

24-
version = '0.16.0'
25-
release = '0.16.0'
24+
version = '0.16.1'
25+
release = '0.16.1'
2626

2727
# -- General configuration ---------------------------------------------------
2828

index.rst

+22-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. Copyright (c) 2019--2020 EditorConfig Team
1+
.. Copyright (c) 2019--2024 EditorConfig Team
22
All rights reserved.
33
44
Redistribution and use in source and binary forms, with or without
@@ -73,20 +73,31 @@ EditorConfig organization.
7373
File Format
7474
===========
7575

76+
.. versionchanged:: 0.16.1
77+
7678
EditorConfig files are in an INI-like file format.
77-
In an EditorConfig file, all beginning whitespace on each line is considered
78-
irrelevant. Each line must be one of the following:
79+
To read an EditorConfig file, take one line at a time. For each line:
80+
81+
#. Strip all leading and trailing whitespace
82+
#. If the remaining text is empty, ignore the line.
83+
#. If the remaining text is not empty, process the text as specified for its
84+
type below.
85+
86+
The types of lines are:
87+
88+
- Comment: starts with a ``;`` or a ``#``. Comment lines are ignored.
7989

80-
- Blank: contains only whitespace characters.
81-
- Comment: starts with a ``;`` or a ``#``.
8290
- Section Header: starts with a ``[`` and ends with a ``]``.
83-
- May not use any non-whitespace characters outside of the surrounding
84-
brackets.
91+
These lines define globs; see :ref:`glob-expressions`.
92+
8593
- May contain any characters between the square brackets (e.g.,
8694
``[`` and ``]`` and even spaces and tabs are allowed).
8795
- Forward slashes (``/``) are used as path separators.
8896
- Backslashes (``\\``) are not allowed as path separators (even on Windows).
97+
8998
- Key-Value Pair (or Pair): contains a key and a value, separated by an ``=``.
99+
See :ref:`supported-pairs`.
100+
90101
- Key: The part before the first ``=`` (trimmed of whitespace, but including
91102
any whitespace in the middle).
92103
- Value: The part after the first ``=`` (trimmed of whitespace, but including
@@ -131,6 +142,8 @@ The parts of an EditorConfig file are:
131142
- Section: the lines starting from a Section Header until the beginning of
132143
the next Section Header or the end of the file.
133144

145+
.. _glob-expressions:
146+
134147
Glob Expressions
135148
================
136149

@@ -183,6 +196,8 @@ precedence. If multiple EditorConfig files have matching sections, the rules
183196
from the closer EditorConfig file are read last, so pairs in closer
184197
files take precedence.
185198

199+
.. _supported-pairs:
200+
186201
Supported Pairs
187202
===============
188203

0 commit comments

Comments
 (0)