SF.net SVN: docutils:[9715 ] trunk/docutils/docs/ref/d octree.txt

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9715
          http://sourceforge.net/p/docutils/code/9715
Author:   milde
Date:     2024-05-18 08:45:24 +0000 (Sat, 18 May 2024)
Log Message:
-----------
Style document tree Element Hierarchy Diagram with colours.

Use inline CSS styles to give all blocks belonging to the same
element category a unique colour.

Modified Paths:
--------------
    trunk/docutils/docs/ref/doctree.txt

Modified: trunk/docutils/docs/ref/doctree.txt
===================================================================
--- trunk/docutils/docs/ref/doctree.txt	2024-05-18 08:45:16 UTC (rev 9714)
+++ trunk/docutils/docs/ref/doctree.txt	2024-05-18 08:45:24 UTC (rev 9715)
@@ -45,8 +45,8 @@
 The Docutils document model uses strict element content models.
 
 Below is a *simplified* diagram of the hierarchy of elements in the
-Docutils document tree structure.  An element may contain any other
-elements immediately below it in the diagram (ignoring empty blocks).
+Docutils document tree structure.
+An element may contain elements immediately below it in the diagram.
 Element types in square brackets indicate recursive or one-to-many
 relationships: structural elements (sections) may contain sub-sections,
 some body elements may contain other body elements, etc.
@@ -53,7 +53,36 @@
 The `element reference`_ details valid parents and children
 for each element.
 
+.. raw:: html
+
+   <style type="text/css"><!--
+     table.e-hierarchy {border: 1px solid}
+     table.e-hierarchy td {border: 0px; padding: 0.5em}
+     table.e-hierarchy a {color: black; text-decoration: underline}
+     /* root element */
+     table.e-hierarchy tr:first-child  {background: tomato}
+     table.e-hierarchy td:nth-child(2) {background: tomato}
+     table.e-hierarchy td:nth-child(3) {background: tomato}
+     /* structural elements */
+     table.e-hierarchy tr:nth-child(2) {background: limegreen}
+     table.e-hierarchy tr:nth-child(3) td:first-child {background: limegreen}
+     /* structural subelements */
+     table.e-hierarchy tr:nth-child(3) td:nth-child(2) {background: mediumseagreen}
+     /* body elements */
+     table.e-hierarchy tr:nth-child(4) > td {background: orchid}
+     table.e-hierarchy tr:nth-child(5) td:nth-child(2){background: orchid}
+     table.e-hierarchy tr:nth-child(5) td:nth-child(3){background: orchid}
+     /* body subelements */
+     table.e-hierarchy tr:nth-child(5) > td {background: thistle}
+     table.e-hierarchy tr:nth-child(6) td:first-child {background: thistle}
+     /* inline elements */
+     table.e-hierarchy tr:nth-child(6) td:nth-child(2){background: gold}
+     /* text */
+     table.e-hierarchy tr:last-child  {background: khaki}
+   --></style>
+
 .. table::
+   :class: e-hierarchy
    :width: 65%
    :widths: 1 2 1 1
    :align: center

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.