1 /* Output stream that produces HTML output. 2 Copyright (C) 2006, 2019 Free Software Foundation, Inc. 3 Written by Bruno Haible <bruno@clisp.org>, 2006. 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 17 18 #ifndef _HTML_OSTREAM_H 19 #define _HTML_OSTREAM_H 20 21 #include "ostream.h" 22 23 24 struct html_ostream : struct ostream 25 { 26 methods: 27 28 /* Start a <span class="CLASSNAME"> element. The CLASSNAME is the name 29 of a CSS class. It can be chosen arbitrarily and customized through 30 an inline or external CSS. */ 31 void begin_span (html_ostream_t stream, const char *classname); 32 33 /* End a <span class="CLASSNAME"> element. 34 The begin_span / end_span calls must match properly. */ 35 void end_span (html_ostream_t stream, const char *classname); 36 37 /* Get/set the hyperlink attribute. */ 38 const char * get_hyperlink_ref (html_ostream_t stream); 39 void set_hyperlink_ref (html_ostream_t stream, const char *ref); 40 41 /* Like html_ostream_flush (first_arg, FLUSH_THIS_STREAM), except that it 42 leaves the destination with the current text style enabled, instead 43 of with the default text style. 44 After calling this function, you can output strings without newlines(!) 45 to the underlying stream, and they will be rendered like strings passed 46 to 'ostream_write_mem', 'ostream_write_str', or 'ostream_write_printf'. */ 47 void flush_to_current_style (html_ostream_t stream); 48 }; 49 50 51 #ifdef __cplusplus 52 extern "C" { 53 #endif 54 55 56 /* Create an output stream that takes input in the UTF-8 encoding and 57 writes it in HTML form on DESTINATION. 58 This stream produces a sequence of lines. The caller is responsible 59 for opening the <body><html> elements before and for closing them after 60 the use of this stream. 61 Note that the resulting stream must be closed before DESTINATION can be 62 closed. */ 63 extern html_ostream_t html_ostream_create (ostream_t destination); 64 65 66 #ifdef __cplusplus 67 } 68 #endif 69 70 #endif /* _HTML_OSTREAM_H */ 71