MCPcopy Create free account
hub / github.com/apache/cloudberry / print_html_text

Function print_html_text

src/fe_utils/print.c:1879–1965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1877
1878
1879static void
1880print_html_text(const printTableContent *cont, FILE *fout)
1881{
1882 bool opt_tuples_only = cont->opt->tuples_only;
1883 unsigned short opt_border = cont->opt->border;
1884 const char *opt_table_attr = cont->opt->tableAttr;
1885 unsigned int i;
1886 const char *const *ptr;
1887
1888 if (cancel_pressed)
1889 return;
1890
1891 if (cont->opt->start_table)
1892 {
1893 fprintf(fout, "<table border=\"%d\"", opt_border);
1894 if (opt_table_attr)
1895 fprintf(fout, " %s", opt_table_attr);
1896 fputs(">\n", fout);
1897
1898 /* print title */
1899 if (!opt_tuples_only && cont->title)
1900 {
1901 fputs(" <caption>", fout);
1902 html_escaped_print(cont->title, fout);
1903 fputs("</caption>\n", fout);
1904 }
1905
1906 /* print headers */
1907 if (!opt_tuples_only)
1908 {
1909 fputs(" <tr>\n", fout);
1910 for (ptr = cont->headers; *ptr; ptr++)
1911 {
1912 fputs(" <th align=\"center\">", fout);
1913 html_escaped_print(*ptr, fout);
1914 fputs("</th>\n", fout);
1915 }
1916 fputs(" </tr>\n", fout);
1917 }
1918 }
1919
1920 /* print cells */
1921 for (i = 0, ptr = cont->cells; *ptr; i++, ptr++)
1922 {
1923 if (i % cont->ncolumns == 0)
1924 {
1925 if (cancel_pressed)
1926 break;
1927 fputs(" <tr valign=\"top\">\n", fout);
1928 }
1929
1930 fprintf(fout, " <td align=\"%s\">", cont->aligns[(i) % cont->ncolumns] == 'r' ? "right" : "left");
1931 /* is string only whitespace? */
1932 if ((*ptr)[strspn(*ptr, " \t")] == '\0')
1933 fputs("&nbsp; ", fout);
1934 else
1935 html_escaped_print(*ptr, fout);
1936

Callers 1

printTableFunction · 0.85

Calls 2

html_escaped_printFunction · 0.85
footers_with_defaultFunction · 0.85

Tested by

no test coverage detected