This change is in two parts -- the first commit does the rename and the second goes through and updates references to .txt files. All tests pass.
The benefit of this change is primarily for people -- on user interfaces with syntax highlighting (e.g. IntelliJ / VSCode / Notepad++ editors, code mirrors, etc), the text is presented natively as reStructuredText, and editor features can assist with e.g. autocompletion.
Docutils itself of course does not care which file extension is used.
I have not renamed any of the include files or template files in docutils.parsers
or docutils.writers
, as they form part of the public API and would need a deprecation cycle (or aliasing in the parsing code)
A
Please see https://github.com/AA-Turner/docutils/pull/3 and https://github.com/AA-Turner/docutils/pull/3.patch for the commits and patch.
Docutils is quite clear about the standard filename extension for a reStructuredText file, so I don't see this accepted anytime soon.
The policies advise:
Compatible editors can use this to set the editing mode.
In the jed programmer's editor, I use a hook
Maybe something similar is available in other "intelligent" editors, too.
Hi Günter,
That text was written in 2002 -- twenty years ago.
I would argue that the de facto reality is that ".rst" is the standard extension for reStructuredText files, and has been for quite some time -- it is required for Python Enhancement Proposals (PEP 12 [1]) and the Python documentation (since 2007 [2]). Wikipedia has used the
.rst
extension for 10 years [3]. The linux kernel has been using.rst
files for 5 years, when they switched to reStructuredText [4]. Any tool usinglinguist
will pick up.rst
as the extension (since the start of the project in 2011) [5].I could go on! My plea is to update the FAQ -- my suggested edit notes that "ReStructuredText files should be readable as plaintext", which I believe is in spirit of the original text. In response to the "why bother" comment in the original FAQ text -- I would argue it is as the rest of the world seems to assume that the extension is
.rst
, and Docutils as the official custodian of reStructuredText should embrace this.A
Original FAQ text:
The links didn't render for some reason, let me try again:
1: https://python.github.io/peps/pep-0012/
2: https://github.com/python/cpython/tree/8ec7f656134b1230ab23003a94ba3266d7064122/Doc
3: https://en.wikipedia.org/w/index.php?title=ReStructuredText&diff=487960232&oldid=487396784
4: https://github.com/torvalds/linux/commit/22cba31bae9dc357622f09d22b82ca5a112b4fde#diff-65f82f80279ec12ce6d19e0a686d262618611be80d1a264e1cffed0d14c814a4
5: https://github.com/github/linguist/blob/37243ec6bed3e697beeb874fc94efb9e42ca7f8c/lib/linguist/extensions.yml#L502-L506
Hei,
first of all I appreciate Adam nudging, although the project must slow him down, because not every docutils user is a programmer. For example removng rst2html.py is a 2 second change for Adam (more like 2 minutes for me) but might be hard for people running the same script for 10 years.
As for the file extension:
I don't know
cheers
Yes, if you double click on the file it will open a pop-up asking what application you want to use to edit the files, and then you can select 'notepad' (preinstalled) or any other text editor. Windows can then remember the file association.
I do understand entirely -- any change is by its very nature breaking fron the status quo ante.
The latest patch I proposed though has no breaking changes (keeps
rst2html.py
etc), but less of the enhancements.Can I take it that you'd support this change @grubert? (Trying to forge consensus!)
A
P.S. I have added an image of the file association pop-up box, as it is on my Windows 10 PC.
The "de facto" status is why I did not reject the proposal right away.
I am not against "endorsing" rst as extension for rST files.
However, I remember David Goodger beeing very clear about his preference in this question on several occasions.
I don't think it is an urgent issue, so I prefer to let David decide.
Perhaps if we don't hear from him in a month (early Februray) we could revisit this issue? (I was taught to try to be explicit rather than 'in the future' for reminders!)
A
:-) yes nag in early February
there are two sides:
developers working on the file: it is cool if the editor knows ot is reST, therefore .rst
readers reading some file, easing access, prefer .txt
linux kernel documentation is developers, not users or readers.
We're getting dangerously close to mid-late February! Sorry for my brief absence -- deadlines and real life, sadly. Hence this post with said nag ;-)
A
thanks for the reminder
we still have the two opinions (developers and readers)
and I don't have a clue :-)
Thinking about this, I now favour changing the extension of rST source files to
.rst
. The PEP sources at peps.python.org are an "official precedence case".Writer template files are not rST sources and should keep their extension.
Standard include files shoud change after an advance warning and transition period.
(We can implement a fallback with warning in the "include" directive implementation.)
I have recreated the branch/patch for the rename, please have a look:
All
.txt
files in docutils/, web/, and sandbox/infrastructure/ have been renamed.Writer template files remain unchanged.
A
We would need to adapt background scripts, too. I am unsure whether the following changes correctly describe the behaviour after applying this patch :
I downloaded the patch set and tried to commit it to a local branch but failed:
sandbox/infrastructure/docutils-update.local errors will pop up when
run , no problem to me
Last edit: Adam Turner 2024-08-15
infrastructure docutils-update.local should prefer .rst but falls back on
.txt
./docs/user/Makefile.docutils-update
has fixed filenames but is only one file
Last edit: Adam Turner 2024-08-15
i could apply the rename this week ... nag me
Last edit: Adam Turner 2024-08-15
nut i would only apply on svn ... might be not what's wanted
Last edit: Adam Turner 2024-08-15
applied the patch