Last active
October 27, 2020 04:03
-
-
Save zbyna/91ddc3bde3f855c7cca381ed5a40ef32 to your computer and use it in GitHub Desktop.
VIM - checking reStructuredText (Sphinx) markups used in godot docs - without confirmation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ONLY in VIM 8.0.1630 and later | |
" (trim function added see: https://github.com/vim/vim/commit/295ac5ab5e840af6051bed5ec9d9acc3c73445de) | |
" You can execute more than one command in command line by placing a | between two commands. | |
" You can execute the file by running this :source <filename> | |
" :ref:`label-name` | |
" weblate.org machine translation adds space after : like: : ref: | |
" %s/: ref: /:ref:/gc - zřejmě bylo špatně :-) stane se :-) | |
%s/: ref: / :ref:/g | |
%s/: kbd: / :kbd:/g | |
%s/: download: / :download:/g | |
%s/: doc: / :doc:/g | |
%s/>` __/>`__/g | |
%s/>` _/>`_/g | |
" two asterisks: **text** for strong emphasis (boldface) | |
" fixing ** text** nad **text ** | |
%s/\*\*\(.\{-}\)\*\*/\='**'.trim(submatch(1)).'**'/g | |
" backquotes: ``text`` for code samples | |
%s/\`\`\(.\{-}\)\`\`/\='``'.trim(submatch(1)).'``'/g | |
" one asterisk: *text* for emphasis (italics) | |
%s/\*\(.\{-}\)\*/\='*'.trim(submatch(1)).'*'/g | |
" `Link text <https://domain.invalid/>`_ for inline web links - pravděpodobně špatně, protože vyhází i mezery, který oddělujou název linku od adresy | |
" There must be a space between the link text and the opening < for the URL. see: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks | |
" %s/\`\(.\{-}\)\`/\='`'.trim(submatch(1)).'`'/g | |
" fixing error from above line 28, hopefully :-) | |
" \a is alfabetic character see: http://www.vimregex.com/ | |
%s/\a<http/ <http/gc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment