• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*=============================================================================
2  Copyright (c) 2017 Daniel James
3  
4  Use, modification and distribution is subject to the Boost Software
5  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6  http://www.boost.org/LICENSE_1_0.txt)
7  =============================================================================*/
8  
9  #include "html_printer.hpp"
10  #include "utils.hpp"
11  
12  namespace quickbook
13  {
14      namespace detail
15      {
open_tag(html_printer & printer,quickbook::string_view name)16          void open_tag(html_printer& printer, quickbook::string_view name)
17          {
18              tag_start(printer, name);
19              tag_end(printer);
20          }
21  
close_tag(html_printer & printer,quickbook::string_view name)22          void close_tag(html_printer& printer, quickbook::string_view name)
23          {
24              printer.html += "</";
25              printer.html.append(name.begin(), name.end());
26              printer.html += ">";
27          }
28  
tag_start(html_printer & printer,quickbook::string_view name)29          void tag_start(html_printer& printer, quickbook::string_view name)
30          {
31              printer.html += "<";
32              printer.html.append(name.begin(), name.end());
33          }
34  
tag_end(html_printer & printer)35          void tag_end(html_printer& printer) { printer.html += ">"; }
36  
tag_end_self_close(html_printer & printer)37          void tag_end_self_close(html_printer& printer) { printer.html += "/>"; }
38  
tag_attribute(html_printer & printer,quickbook::string_view name,quickbook::string_view value)39          void tag_attribute(
40              html_printer& printer,
41              quickbook::string_view name,
42              quickbook::string_view value)
43          {
44              printer.html += " ";
45              printer.html.append(name.begin(), name.end());
46              printer.html += "=\"";
47              printer.html.append(encode_string(value));
48              printer.html += "\"";
49          }
50      }
51  }
52