mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Minor cleanup
This commit is contained in:
@ -3731,6 +3731,7 @@ FMT_END_NAMESPACE
|
|||||||
|
|
||||||
**Example**::
|
**Example**::
|
||||||
|
|
||||||
|
#define FMT_STRING_ALIAS 1
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
// A compile-time error because 'd' is an invalid specifier for strings.
|
// A compile-time error because 'd' is an invalid specifier for strings.
|
||||||
std::string s = format(fmt("{:d}"), "foo");
|
std::string s = format(fmt("{:d}"), "foo");
|
||||||
|
@ -113,8 +113,9 @@ class Translator(nodes.NodeVisitor):
|
|||||||
for i, entry in enumerate(row):
|
for i, entry in enumerate(row):
|
||||||
text = entry[0][0] if len(entry) > 0 else ''
|
text = entry[0][0] if len(entry) > 0 else ''
|
||||||
if i != 0:
|
if i != 0:
|
||||||
self.write(' ')
|
self.write('|')
|
||||||
self.write('{:{}}'.format(text, widths[i]))
|
self.write('{:{}}'.format(text, widths[i]))
|
||||||
|
self.write('\n')
|
||||||
|
|
||||||
def visit_table(self, node):
|
def visit_table(self, node):
|
||||||
table = node.children[0]
|
table = node.children[0]
|
||||||
@ -122,14 +123,13 @@ class Translator(nodes.NodeVisitor):
|
|||||||
thead = table[-2]
|
thead = table[-2]
|
||||||
tbody = table[-1]
|
tbody = table[-1]
|
||||||
widths = [int(cs['colwidth']) for cs in colspecs]
|
widths = [int(cs['colwidth']) for cs in colspecs]
|
||||||
sep = ' '.join(['-' * w for w in widths])
|
sep = '|'.join(['-' * w for w in widths]) + '\n'
|
||||||
self.write(sep)
|
self.write('\n\n')
|
||||||
self.write_row(thead[0], widths)
|
self.write_row(thead[0], widths)
|
||||||
self.write(sep)
|
self.write(sep)
|
||||||
for row in tbody:
|
for row in tbody:
|
||||||
self.write_row(row, widths)
|
self.write_row(row, widths)
|
||||||
self.write(sep)
|
raise nodes.SkipChildren
|
||||||
raise nodes.StopTraversal
|
|
||||||
|
|
||||||
def depart_table(self, node):
|
def depart_table(self, node):
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user