annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/doc/libtextstyle/libtextstyle_1.html @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
rev   line source
jpayne@68 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
jpayne@68 2 <html>
jpayne@68 3 <!-- Created on February, 21 2024 by texi2html 1.78a -->
jpayne@68 4 <!--
jpayne@68 5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
jpayne@68 6 Karl Berry <karl@freefriends.org>
jpayne@68 7 Olaf Bachmann <obachman@mathematik.uni-kl.de>
jpayne@68 8 and many others.
jpayne@68 9 Maintained by: Many creative people.
jpayne@68 10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
jpayne@68 11
jpayne@68 12 -->
jpayne@68 13 <head>
jpayne@68 14 <title>GNU libtextstyle: 1. Introduction</title>
jpayne@68 15
jpayne@68 16 <meta name="description" content="GNU libtextstyle: 1. Introduction">
jpayne@68 17 <meta name="keywords" content="GNU libtextstyle: 1. Introduction">
jpayne@68 18 <meta name="resource-type" content="document">
jpayne@68 19 <meta name="distribution" content="global">
jpayne@68 20 <meta name="Generator" content="texi2html 1.78a">
jpayne@68 21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
jpayne@68 22 <style type="text/css">
jpayne@68 23 <!--
jpayne@68 24 a.summary-letter {text-decoration: none}
jpayne@68 25 pre.display {font-family: serif}
jpayne@68 26 pre.format {font-family: serif}
jpayne@68 27 pre.menu-comment {font-family: serif}
jpayne@68 28 pre.menu-preformatted {font-family: serif}
jpayne@68 29 pre.smalldisplay {font-family: serif; font-size: smaller}
jpayne@68 30 pre.smallexample {font-size: smaller}
jpayne@68 31 pre.smallformat {font-family: serif; font-size: smaller}
jpayne@68 32 pre.smalllisp {font-size: smaller}
jpayne@68 33 span.roman {font-family:serif; font-weight:normal;}
jpayne@68 34 span.sansserif {font-family:sans-serif; font-weight:normal;}
jpayne@68 35 ul.toc {list-style: none}
jpayne@68 36 -->
jpayne@68 37 </style>
jpayne@68 38
jpayne@68 39
jpayne@68 40 </head>
jpayne@68 41
jpayne@68 42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
jpayne@68 43
jpayne@68 44 <table cellpadding="1" cellspacing="1" border="0">
jpayne@68 45 <tr><td valign="middle" align="left">[ &lt;&lt; ]</td>
jpayne@68 46 <td valign="middle" align="left">[<a href="libtextstyle_2.html#SEC4" title="Next chapter"> &gt;&gt; </a>]</td>
jpayne@68 47 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 48 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 49 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 50 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 51 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 52 <td valign="middle" align="left">[<a href="libtextstyle_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
jpayne@68 53 <td valign="middle" align="left">[<a href="libtextstyle_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
jpayne@68 54 <td valign="middle" align="left">[<a href="libtextstyle_5.html#SEC46" title="Index">Index</a>]</td>
jpayne@68 55 <td valign="middle" align="left">[<a href="libtextstyle_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
jpayne@68 56 </tr></table>
jpayne@68 57
jpayne@68 58 <hr size="2">
jpayne@68 59 <a name="Introduction"></a>
jpayne@68 60 <a name="SEC1"></a>
jpayne@68 61 <h1 class="chapter"> <a href="libtextstyle_toc.html#TOC1">1. Introduction</a> </h1>
jpayne@68 62
jpayne@68 63 <p>Text is easier to read when it is accompanied with styling information,
jpayne@68 64 such as color, font attributes (weight, posture), or underlining, and
jpayne@68 65 this styling is customized appropriately for the output device.
jpayne@68 66 </p>
jpayne@68 67 <p>GNU libtextstyle provides an easy way to add styling to programs that
jpayne@68 68 produce output to a console or terminal emulator window. It does this
jpayne@68 69 in a way that allows the end user to customize the styling using the
jpayne@68 70 industry standard, namely Cascading Style Sheets (CSS).
jpayne@68 71 </p>
jpayne@68 72
jpayne@68 73
jpayne@68 74 <a name="Style-definitions"></a>
jpayne@68 75 <a name="SEC2"></a>
jpayne@68 76 <h2 class="section"> <a href="libtextstyle_toc.html#TOC2">1.1 Style definitions</a> </h2>
jpayne@68 77
jpayne@68 78 <p>Let's look at the traditional way styling is done for specific programs.
jpayne@68 79 </p>
jpayne@68 80 <p>Browsers, when they render HTML, use CSS styling.
jpayne@68 81 </p>
jpayne@68 82 <p>The older approach to user-customizable text styling is that the user
jpayne@68 83 associates patterns with escape sequences in an environment variable or a
jpayne@68 84 command-line argument. This is the approach used, for example, by the
jpayne@68 85 GNU &lsquo;<samp>ls</samp>&rsquo; program in combination with the &lsquo;<samp>dircolors</samp>&rsquo; program.
jpayne@68 86 The processing is distributed across several steps:
jpayne@68 87 </p><ol>
jpayne@68 88 <li>
jpayne@68 89 There is default style definition that is hard-coded in the
jpayne@68 90 &lsquo;<samp>dircolors</samp>&rsquo; program. The user can also define their own definitions
jpayne@68 91 in a file such as &lsquo;<tt>~/.dir_colors</tt>&rsquo;. This style definition contains
jpayne@68 92 explicit terminal escape sequences; thus, it can only be used with
jpayne@68 93 consoles and terminal emulators, and each style definition applies only
jpayne@68 94 to a certain class of mostly-compatible terminal emulators.
jpayne@68 95 </li><li>
jpayne@68 96 The <code>dircolors</code> program, when invoked, translates such a style
jpayne@68 97 definition to a sequence of shell statements that sets an environment
jpayne@68 98 variable <code>LS_COLORS</code>.
jpayne@68 99 </li><li>
jpayne@68 100 The shell executes these statements, and thus sets the environment
jpayne@68 101 variable <code>LS_COLORS</code>.
jpayne@68 102 </li><li>
jpayne@68 103 The program looks at the environment variable and emits the listed escape
jpayne@68 104 sequences.
jpayne@68 105 </li></ol>
jpayne@68 106
jpayne@68 107 <p>In contrast, this library implements styling as follows:
jpayne@68 108 </p><ol>
jpayne@68 109 <li>
jpayne@68 110 There is a default style definition in a CSS file that is part of the
jpayne@68 111 same package as the stylable program. The user can also define their own
jpayne@68 112 definitions in a CSS file, and set an environment environment variable to
jpayne@68 113 point to it.
jpayne@68 114 </li><li>
jpayne@68 115 The program looks at the environment variable, parses the CSS file,
jpayne@68 116 translates the styling specifications to the form that is appropriate for
jpayne@68 117 the output device (escape sequences for terminal emulators, inline CSS
jpayne@68 118 and <code>&lt;span&gt;</code> elements for HTML output), and emits it.
jpayne@68 119 </li></ol>
jpayne@68 120
jpayne@68 121 <p>Thus, with GNU libtextstyle, the styling has the following properties:
jpayne@68 122 </p><ul>
jpayne@68 123 <li>
jpayne@68 124 It is easier for the user to define their own styling, because the file
jpayne@68 125 format is standardized and supported by numerous syntax aware editors.
jpayne@68 126 </li><li>
jpayne@68 127 A styling file does not depend on the particular output device. An HTML
jpayne@68 128 output and a black-on-white terminal emulator can use the same styling
jpayne@68 129 file. A white-on-black (or even green-on-black) terminal emulator will
jpayne@68 130 need different styling, though.
jpayne@68 131 </li><li>
jpayne@68 132 It is simpler: There is no need for a program that converts the style
jpayne@68 133 specification from one format to another.
jpayne@68 134 </li></ul>
jpayne@68 135
jpayne@68 136
jpayne@68 137 <a name="Built_002din-versus-separate-styling"></a>
jpayne@68 138 <a name="SEC3"></a>
jpayne@68 139 <h2 class="section"> <a href="libtextstyle_toc.html#TOC3">1.2 Built-in versus separate styling</a> </h2>
jpayne@68 140
jpayne@68 141 <p>There are generally two approaches for adding styling to text:
jpayne@68 142 </p><ul>
jpayne@68 143 <li>
jpayne@68 144 The program that generates the text adds the styling. It does so through
jpayne@68 145 interleaved statements that turn on or off specific attributes.
jpayne@68 146 </li><li>
jpayne@68 147 The styling gets added by a separate program, that postprocesses the
jpayne@68 148 output. This separate program usually uses regular expressions to
jpayne@68 149 determine which text regions to style with a certain set of text
jpayne@68 150 attributes.
jpayne@68 151 </li></ul>
jpayne@68 152
jpayne@68 153 <p>The first approach produces a styling that is 100% correct, regardless of
jpayne@68 154 the complexity of the text that is being output. This is the preferred
jpayne@68 155 approach for example for JSON, XML, or programming language text.
jpayne@68 156 </p>
jpayne@68 157 <p>The second approach works well if the output has a simple, easy-to-parse
jpayne@68 158 format. It may produce wrong styling in some cases when the text format
jpayne@68 159 is more complex. This approach is often used for viewing log files.
jpayne@68 160 </p>
jpayne@68 161 <p>GNU libtextstyle supports both approaches; it includes an example program
jpayne@68 162 for each of the two approaches.
jpayne@68 163 </p>
jpayne@68 164
jpayne@68 165 <table cellpadding="1" cellspacing="1" border="0">
jpayne@68 166 <tr><td valign="middle" align="left">[<a href="#SEC1" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
jpayne@68 167 <td valign="middle" align="left">[<a href="libtextstyle_2.html#SEC4" title="Next chapter"> &gt;&gt; </a>]</td>
jpayne@68 168 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 169 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 170 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 171 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 172 <td valign="middle" align="left"> &nbsp; </td>
jpayne@68 173 <td valign="middle" align="left">[<a href="libtextstyle_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
jpayne@68 174 <td valign="middle" align="left">[<a href="libtextstyle_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
jpayne@68 175 <td valign="middle" align="left">[<a href="libtextstyle_5.html#SEC46" title="Index">Index</a>]</td>
jpayne@68 176 <td valign="middle" align="left">[<a href="libtextstyle_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
jpayne@68 177 </tr></table>
jpayne@68 178 <p>
jpayne@68 179 <font size="-1">
jpayne@68 180 This document was generated by <em>Bruno Haible</em> on <em>February, 21 2024</em> using <a href="https://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.
jpayne@68 181 </font>
jpayne@68 182 <br>
jpayne@68 183
jpayne@68 184 </p>
jpayne@68 185 </body>
jpayne@68 186 </html>