Skip to contentSkip to conversation

reST syntax: normalize using "::" to start literal blocks

PATCH New Robert P. J. Day 1 participant 1 message Oct 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reST syntax: normalize using "::" to start literal blocks

Currently, there is some chaos regarding how to introduce a literal block in reST; the standard and simplest way is to end the introductory sentence with "::" (with no leading space before the "::", follow this with a blank line, then the indented block content.

As it is, there is a variety of ways being used to do this, so a simple script using Perl is used to normalize all of this variety. The script:

#!/bin/sh

#
# collapse [:.] at end of line followed by bare "::" into

  # trailing "::"
  #
  for r in $(find . -name "*.rst") ; do
      perl -0777 -pi -e 's/[:.]\n::\n/::\n/g' ${r}
  done

#
# simplify ": ::" at end of line to "::"
#

  for r in $(find . -name "*.rst") ; do
      perl -pi -e 's/: ::$/::/' ${r}
  done

As you can see, the first loop both collapses two lines into one, while modifying a trailing "." to a trailing ":" in the introductory sentence because, well, it should have been a colon in the first place.

The second loop is self-explanatory.

The above represents the entire processing done on the documentation.

---

ok, here's an improved version of "::" normalization. it appears to
build, but i'm open to suggestions.

documentation/brief-yoctoprojectqs/brief-yoctoprojectqs.rst +1 -1
index c9622d364..21b016fda 100644
@@ -223,7 +223,7 @@ an entire Linux distribution, including the toolchain, from source.
 
       You can significantly speed up your build and guard against fetcher
       failures by using mirrors. To use mirrors, add these lines to your
-      local.conf file in the Build directory: ::
+      local.conf file in the Build directory::
 
          SSTATE_MIRRORS = "\
          file://.* http://sstate.yoctoproject.org/dev/PATH;downloadfilename=PATH \n \
documentation/bsp-guide/bsp.rst +28 -28

224 lines not on this page · raw message

documentation/dev-manual/dev-manual-common-tasks.rst +206 -412

1,806 lines not on this page · raw message

documentation/dev-manual/dev-manual-qemu.rst +2 -4
index c91e8b538..341ecc84d 100644
@@ -325,8 +325,7 @@ present, the toolchain is also automatically used.
 QEMU Command-Line Syntax
 ========================
 
-The basic ``runqemu`` command syntax is as follows:
-::
+The basic ``runqemu`` command syntax is as follows::
 
    $ runqemu [option ] [...]
 
@@ -337,8 +336,7 @@ timestamp when it needs to look for an image. Minimally, through the use
 of options, you must provide either a machine name, a virtual machine
 image (``*wic.vmdk``), or a kernel image (``*.bin``).
 
-Following is the command-line help output for the ``runqemu`` command:
-::
+Following is the command-line help output for the ``runqemu`` command::
 
    $ runqemu --help
 
documentation/kernel-dev/kernel-dev-advanced.rst +28 -56

242 lines not on this page · raw message

documentation/kernel-dev/kernel-dev-common.rst +30 -60

260 lines not on this page · raw message

documentation/kernel-dev/kernel-dev-concepts-appx.rst +2 -4
index 681faee52..3108299e0 100644
@@ -361,8 +361,7 @@ To determine whether or not a given option is "hardware" or
 "non-hardware", the kernel Metadata in ``yocto-kernel-cache`` contains
 files that classify individual or groups of options as either hardware
 or non-hardware. To better show this, consider a situation where the
-``yocto-kernel-cache`` contains the following files:
-::
+``yocto-kernel-cache`` contains the following files::
 
    yocto-kernel-cache/features/drm-psb/hardware.cfg
    yocto-kernel-cache/features/kgdb/hardware.cfg
@@ -402,8 +401,7 @@ provides explanations for the various files:
    (i.e. ``hardware.kcf`` or ``non-hardware.kcf``).
 
 Here is a specific example using the
-``kernel-cache/bsp/mti-malta32/hardware.cfg``:
-::
+``kernel-cache/bsp/mti-malta32/hardware.cfg``::
 
    CONFIG_SERIAL_8250
    CONFIG_SERIAL_8250_CONSOLE
documentation/kernel-dev/kernel-dev-faq.rst +2 -4
index d6be98a0a..a83af347a 100644
@@ -59,8 +59,7 @@ These other variables are useful for installing specific modules:
 
 For example, set the following in the ``qemux86.conf`` file to include
 the ``ab123`` kernel modules with images built for the ``qemux86``
-machine:
-::
+machine::
 
    MACHINE_EXTRA_RRECOMMENDS += "kernel-module-ab123"
 
@@ -73,8 +72,7 @@ How do I change the Linux kernel command line?
 The Linux kernel command line is
 typically specified in the machine config using the ``APPEND`` variable.
 For example, you can add some helpful debug information doing the
-following:
-::
+following::
 
    APPEND += "printk.time=y initcall_debug debug"
 
documentation/kernel-dev/kernel-dev-maint-appx.rst +4 -8
index 69f680688..56bc73d46 100644
@@ -28,8 +28,7 @@ in the Yocto Project Linux kernel in any clone of the Yocto Project
 Linux kernel source repository and ``yocto-kernel-cache`` Git trees. For
 example, the following commands clone the Yocto Project baseline Linux
 kernel that branches off ``linux.org`` version 4.12 and the
-``yocto-kernel-cache``, which contains stores of kernel Metadata:
-::
+``yocto-kernel-cache``, which contains stores of kernel Metadata::
 
    $ git clone git://git.yoctoproject.org/linux-yocto-4.12
    $ git clone git://git.yoctoproject.org/linux-kernel-cache
@@ -42,16 +41,14 @@ section.
 
 Once you have cloned the kernel Git repository and the cache of Metadata
 on your local machine, you can discover the branches that are available
-in the repository using the following Git command:
-::
+in the repository using the following Git command::
 
    $ git branch -a
 
 Checking out a branch allows you to work with a particular Yocto Linux
 kernel. For example, the following commands check out the
 "standard/beagleboard" branch of the Yocto Linux kernel repository and
-the "yocto-4.12" branch of the ``yocto-kernel-cache`` repository:
-::
+the "yocto-4.12" branch of the ``yocto-kernel-cache`` repository::
 
    $ cd ~/linux-yocto-4.12
    $ git checkout -b my-kernel-4.12 remotes/origin/standard/beagleboard
@@ -222,8 +219,7 @@ build process generates a build tree that is separate from your kernel's
 local Git source repository tree. This build tree has a name that uses
 the following form, where ``${MACHINE}`` is the metadata name of the
 machine (BSP) and "kernel_type" is one of the Yocto Project supported
-kernel types (e.g. "standard"):
-::
+kernel types (e.g. "standard")::
 
    linux-${MACHINE}-kernel_type-build
 
documentation/overview-manual/overview-manual-concepts.rst +12 -24
index d9f50e519..a9e4cc7e8 100644
@@ -57,8 +57,7 @@ This section briefly introduces BitBake. If you want more information on
 BitBake, see the :doc:`BitBake User Manual <bitbake:index>`.
 
 To see a list of the options BitBake supports, use either of the
-following commands:
-::
+following commands::
 
    $ bitbake -h
    $ bitbake --help
@@ -68,8 +67,7 @@ The most common usage for BitBake is ``bitbake recipename``, where
 to as the "target"). The target often equates to the first part of a
 recipe's filename (e.g. "foo" for a recipe named ``foo_1.3.0-r0.bb``).
 So, to process the ``matchbox-desktop_1.2.3.bb`` recipe file, you might
-type the following:
-::
+type the following::
 
    $ bitbake matchbox-desktop
 
@@ -1101,15 +1099,13 @@ the image. The formats used for the root filesystem depend on the
 support compression.
 
 As an example, a dynamically created task when creating a particular
-image type would take the following form:
-::
+image type would take the following form::
 
    do_image_type
 
 So, if the type
 as specified by the ``IMAGE_FSTYPES`` were ``ext4``, the dynamically
-generated task would be as follows:
-::
+generated task would be as follows::
 
    do_image_ext4
 
@@ -1516,8 +1512,7 @@ cross-compiler that is used internally within BitBake only.
    .
 
 The chain of events that occurs when ``gcc-cross`` is bootstrapped is as
-follows:
-::
+follows::
 
    gcc -> binutils-cross -> gcc-cross-initial -> linux-libc-headers -> glibc-initial -> glibc -> gcc-cross -> gcc-runtime
 
@@ -1575,8 +1570,7 @@ might not be the same machine as the Build Host.
    can take advantage of pre-built images that ship with the Yocto
    Project and already contain cross-development toolchain installers.
 
-Here is the bootstrap process for the relocatable toolchain:
-::
+Here is the bootstrap process for the relocatable toolchain::
 
    gcc -> binutils-crosssdk -> gcc-crosssdk-initial -> linux-libc-headers -> glibc-initial -> nativesdk-glibc -> gcc-crosssdk -> gcc-cross-canadian
 
@@ -1754,8 +1748,7 @@ to the task.
 
 Like the ``WORKDIR`` case, situations exist where dependencies should be
 ignored. For these situations, you can instruct the build process to
-ignore a dependency by using a line like the following:
-::
+ignore a dependency by using a line like the following::
 
    PACKAGE_ARCHS[vardepsexclude] = "MACHINE"
 
@@ -1765,8 +1758,7 @@ reference it.
 
 Equally, there are cases where you need to add dependencies BitBake is
 not able to find. You can accomplish this by using a line like the
-following:
-::
+following::
 
    PACKAGE_ARCHS[vardeps] = "MACHINE"
 
@@ -1796,8 +1788,7 @@ and the dependent task hashes can be influenced. Within the BitBake
 configuration file, you can give BitBake some extra information to help
 it construct the basehash. The following statement effectively results
 in a list of global variable dependency excludes (i.e. variables never
-included in any checksum):
-::
+included in any checksum)::
 
    BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR \\
        SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL TERM \\
@@ -1822,8 +1813,7 @@ desired. This file defines the two basic signature generators
 "OEBasicHash". By default, a dummy "noop" signature handler is enabled
 in BitBake. This means that behavior is unchanged from previous
 versions. OE-Core uses the "OEBasicHash" signature handler by default
-through this setting in the ``bitbake.conf`` file:
-::
+through this setting in the ``bitbake.conf`` file::
 
    BB_SIGNATURE_HANDLER ?= "OEBasicHash"
 
@@ -1877,8 +1867,7 @@ The Yocto Project team has tried to keep the details of the
 implementation hidden in ``sstate`` class. From a user's perspective,
 adding shared state wrapping to a task is as simple as this
 :ref:`ref-tasks-deploy` example taken
-from the :ref:`deploy <ref-classes-deploy>` class:
-::
+from the :ref:`deploy <ref-classes-deploy>` class::
 
    DEPLOYDIR = "${WORKDIR}/deploy-${PN}"
    SSTATETASKS += "do_deploy"
@@ -1983,8 +1972,7 @@ The following list explains the previous example:
 Behind the scenes, the shared state code works by looking in
 :term:`SSTATE_DIR` and
 :term:`SSTATE_MIRRORS` for
-shared state files. Here is an example:
-::
+shared state files. Here is an example::
 
    SSTATE_MIRRORS ?= "\
        file://.\* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
documentation/overview-manual/overview-manual-development-environment.rst +2 -4
index 4bedd6df6..e3f4bc491 100644
@@ -435,8 +435,7 @@ local working area (also called a branch) that tracks a specific
 development branch from the upstream source Git repository. in other
 words, you can define your local Git environment to work on any
 development branch in the repository. To help illustrate, consider the
-following example Git commands:
-::
+following example Git commands::
 
    $ cd ~
    $ git clone git://git.yoctoproject.org/poky
@@ -482,8 +481,7 @@ create and checkout a local working Git branch based on a tag name. When
 you do this, you get a snapshot of the Git repository that reflects the
 state of the files when the change was made associated with that tag.
 The most common use is to checkout a working branch that matches a
-specific Yocto Project release. Here is an example:
-::
+specific Yocto Project release. Here is an example::
 
    $ cd ~
    $ git clone git://git.yoctoproject.org/poky
documentation/profile-manual/profile-manual-intro.rst +5 -5
index 0d435e0c0..53a032b3f 100644
@@ -43,12 +43,12 @@ an 'sdk' image e.g. ::
    $ bitbake core-image-sato-sdk
 
 or alternatively by adding 'tools-profile' to the EXTRA_IMAGE_FEATURES line in
-your local.conf: ::
+your local.conf::
 
    EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile"
 
 If you use the 'tools-profile' method, you don't need to build an sdk image -
-the tracing and profiling tools will be included in non-sdk images as well e.g.: ::
+the tracing and profiling tools will be included in non-sdk images as well e.g.::
 
    $ bitbake core-image-sato
 
@@ -59,7 +59,7 @@ the tracing and profiling tools will be included in non-sdk images as well e.g.:
 
    You can prevent that by setting the
    :term:`INHIBIT_PACKAGE_STRIP`
-   variable to "1" in your ``local.conf`` when you build the image: ::
+   variable to "1" in your ``local.conf`` when you build the image::
 
       INHIBIT_PACKAGE_STRIP = "1"
 
@@ -69,11 +69,11 @@ If you've already built a stripped image, you can generate debug
 packages (xxx-dbg) which you can manually install as needed.
 
 To generate debug info for packages, you can add dbg-pkgs to
-EXTRA_IMAGE_FEATURES in local.conf. For example: ::
+EXTRA_IMAGE_FEATURES in local.conf. For example::
 
    EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile dbg-pkgs"
 
 Additionally, in order to generate the right type of debuginfo, we also need to
-set :term:`PACKAGE_DEBUG_SPLIT_STYLE` in the ``local.conf`` file: ::
+set :term:`PACKAGE_DEBUG_SPLIT_STYLE` in the ``local.conf`` file::
 
    PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory'
documentation/profile-manual/profile-manual-usage.rst +92 -92

210 lines not on this page · raw message

documentation/ref-manual/faq.rst +9 -14
index 8c2b34be5..7012a883a 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-1.3.rst +3 -4
index 5f975850b..a39ccad8d 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-1.4.rst +1 -2
index daaea0ffa..358508423 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-1.6.rst +3 -5
index a6c4c8a93..545668630 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-1.7.rst +2 -4
index 5a5151ec1..6afbc525c 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-1.8.rst +3 -3
index d601e6b63..a577c0c78 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-2.0.rst +2 -4
index 4eea94887..5b1c34bb2 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-2.1.rst +1 -2
index 0220221e0..1f71e44cb 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-2.2.rst +5 -9
index 8afa8ffdd..4a6956e72 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-2.5.rst +1 -1
index 1aeddc81c..ab1027037 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-2.6.rst +2 -4
index 2f0da48ab..d50962bc8 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-3.1.rst +3 -4
index 4fcd2490d..299173713 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/migration-3.2.rst +3 -3
index 9b65e26c4..4645edab0 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/ref-classes.rst +24 -48

72 lines not on this page · raw message

documentation/ref-manual/ref-devtool-reference.rst +16 -32

48 lines not on this page · raw message

documentation/ref-manual/ref-features.rst +1 -2
index f28ad2bb4..dbd9801fe 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/ref-images.rst +1 -1
index 56ec8562f..a1b33d46d 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/ref-kickstart.rst +2 -4
index 7f6d4ebe1..098a7cd6c 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/ref-qa-checks.rst +5 -5
index 54977dcb2..a16b7d8c1 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/ref-structure.rst +6 -12
index db1ea9797..5d5238653 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/ref-tasks.rst +13 -26
index 9ef014139..86a8e521e 100644

Lines of this file are not shown. View the raw message.

documentation/ref-manual/ref-variables.rst +6 -6
index e552351e3..146d8d147 100644

Lines of this file are not shown. View the raw message.

documentation/sdk-manual/sdk-appendix-customizing.rst +6 -12
index 5a33f6385..1b72e8270 100644

Lines of this file are not shown. View the raw message.

documentation/sdk-manual/sdk-extensible.rst +13 -26
index 5ff75ada2..7f03b8fa9 100644

Lines of this file are not shown. View the raw message.

documentation/sdk-manual/sdk-using.rst +3 -6
index 4b151e45c..3ed745df3 100644

Lines of this file are not shown. View the raw message.

documentation/sdk-manual/sdk-working-projects.rst +2 -4
index 5c828fd58..a2f61143c 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

Part of the diff is not shown here. View the raw message.