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