From 002b7b568b0b464fe129349a58f1269af1eb1dad Mon Sep 17 00:00:00 2001 From: Olaf Meeuwissen Date: Thu, 24 Oct 2019 22:24:52 +0900 Subject: [PATCH] Tweak styling of content and tables Word-wrapping in tables is enabled and content will use the full width available to display "body" content. For LaTeX based outputs tabularcolumns spec have been added based on A4 media. This should work for Letter as well but has not been tested. --- _static/css/custom.css | 60 ++++++++++++++++++++++++++++++++++++++++++ conf.py | 1 + sane.rst | 17 ++++++++++-- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 _static/css/custom.css diff --git a/_static/css/custom.css b/_static/css/custom.css new file mode 100644 index 0000000..b8e3adf --- /dev/null +++ b/_static/css/custom.css @@ -0,0 +1,60 @@ +@import 'theme.css'; + +/* Use full available width to render content. */ +.wy-nav-content { + max-width: 100%; +} + +/* Prevent spurious white space in table headings. */ +thead p { + margin-bottom: 0px; +} + +/* Add column separators in table headings. */ +.rst-content table.docutils th { + border-left: 1px solid #e1e4e5; +} + +/* Fix column content alignment to match LaTeX output. */ +.rst-content table.docutils td { + vertical-align: top; +} + +/* Right align second column code values. */ +.rst-content table.docutils td:nth-child(2) { + text-align: right; +} + +/* Left align second column vendor names. */ +.rst-content table.docutils#vendor-names td:nth-child(2) { + text-align: left; +} + +/* Left align second column scan area option descriptions. */ +.rst-content table.docutils#scan-area td:nth-child(2) { + text-align: left; +} + +/* Left align all content for the network protocol tables. */ +div#network-protocol table.docutils td { + text-align: left; +} + +/* Word wrap column content to match LaTeX output. */ +.wy-table-responsive table td { + white-space: normal; +} + +/* Word wrap column content to match LaTeX output. */ +.wy-table-responsive table th { + white-space: normal; +} + +/* Prevent spurious white space below macro roles in tables. */ +.rst-content dl:not(.docutils) { + margin-bottom: 0px; +} +.rst-content tbody dd { + margin: 0px; + line-height: 0px; +} diff --git a/conf.py b/conf.py index bda1251..9abca3c 100644 --- a/conf.py +++ b/conf.py @@ -62,6 +62,7 @@ highlight_language = 'c' # a list of builtin themes. # html_theme = 'sphinx_rtd_theme' +html_style = 'css/custom.css' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/sane.rst b/sane.rst index 8bf258c..de6f605 100644 --- a/sane.rst +++ b/sane.rst @@ -323,9 +323,9 @@ The interface as documented here is declared as a C callable interface in a file called ``sane/sane.h``. This file should normally be included via a C pre-processor directive of the form: -:: + :: - #include + #include Version Control --------------- @@ -602,6 +602,7 @@ list of available status codes is listed in :func:`sane_strstatus()` to convert status codes into a legible string. +.. tabularcolumns:: |\X{12}{32}|r|l| .. table:: Status Codes :name: tab:status :align: center @@ -676,8 +677,10 @@ the type of the device. For consistency’s sake, the following strings should be used when appropriate (the lists will be expanded as need arises): +.. tabularcolumns:: |L|L| .. table:: Predefined Device Information Strings :align: center + :name: vendor-names +---------------------+--------------+ | Vendor Strings | @@ -695,6 +698,7 @@ arises): | ``Kodak`` | ``Noname`` | +---------------------+--------------+ +.. tabularcolumns:: |L| .. table:: :align: center @@ -795,6 +799,8 @@ Member :member:`type` specifies the type of the option value. The possible values for type :type:`SANE_Value_Type` are described in :numref:`tab:valuetype`. + +.. tabularcolumns:: |\X{8}{32}|r|\X{20}{32}| .. table:: Option Value Types (:type:`SANE_Value_Type`) :name: tab:valuetype :align: center @@ -839,6 +845,7 @@ in millimeters. A frontend is generally expected to provide appropriate conversion routines so that a user can express quantities in a customary unit (e.g., inches or centimeters). +.. tabularcolumns:: |\X{10}{32}|r|l| .. table:: Physical Units (:type:`SANE_Unit`) :name: tab:units :align: center @@ -907,6 +914,7 @@ of a given capability bitset: the option with the capability set :data:`cap` is software settable. +.. tabularcolumns:: |\X{12}{32}|r|\X{16}{32}| .. table:: Option Capabilities :name: tab:capabilities :align: center @@ -973,6 +981,7 @@ type :type:`SANE_Constraint_Type` and the interpretation of the :member:`constraint` union is described in :numref:`tab:constraints`. +.. tabularcolumns:: |\X{12}{32}|r|\X{16}{32}| .. table:: Option Value Constraints :name: tab:constraints :align: center @@ -1248,6 +1257,7 @@ by parameter :data:`a` which is a value of type :type:`SANE_Action`. The possible values and their meaning is described in :numref:`tab:actions`. +.. tabularcolumns:: |\X{10}{32}|r|\X{18}{32}| .. table:: Action Values (:type:`SANE_Action`) :name: tab:actions :align: center @@ -1275,6 +1285,7 @@ non-:macro:`NULL`). The returned value is a bitset that may contain any combination of the values described in :numref:`tab:info`. +.. tabularcolumns:: |\X{11}{32}|r|\X{17}{32}| .. table:: Additional Information Returned When Setting an Option :name: tab:info :align: center @@ -1378,6 +1389,7 @@ to be returned. The possible values for type :numref:`tab:frameformat`. The meaning of these values is described in more detail in Section :raw-latex:`\ref{sec:imageformat}`. +.. tabularcolumns:: |\X{8}{32}|r|l| .. table:: Frame Format (:type:`SANE_Frame`) :name: tab:frameformat :align: center @@ -1843,6 +1855,7 @@ table below: .. index:: tl-x, tl-y, br-x, br-y +.. tabularcolumns:: |L|L| .. table:: :name: scan-area :align: center