@@ -142,8 +142,10 @@ def _pipe_line_with_colons(colwidths, colaligns):
142142 alignment (as in `pipe` output format)."""
143143 if not colaligns : # e.g. printing an empty data frame (github issue #15)
144144 colaligns = ["" ] * len (colwidths )
145- segments = [_pipe_segment_with_colons (a , w ) for a , w in zip (colaligns , colwidths )]
146- return "|" + "|" .join (segments ) + "|"
145+ segments = "|" .join (
146+ _pipe_segment_with_colons (a , w ) for a , w in zip (colaligns , colwidths )
147+ )
148+ return f"|{ segments } |"
147149
148150
149151def _grid_segment_with_colons (colwidth , align ):
@@ -165,8 +167,10 @@ def _grid_line_with_colons(colwidths, colaligns):
165167 in a grid table."""
166168 if not colaligns :
167169 colaligns = ["" ] * len (colwidths )
168- segments = [_grid_segment_with_colons (w , a ) for a , w in zip (colaligns , colwidths )]
169- return "+" + "+" .join (segments ) + "+"
170+ segments = "+" .join (
171+ _grid_segment_with_colons (w , a ) for a , w in zip (colaligns , colwidths )
172+ )
173+ return f"+{ segments } +"
170174
171175
172176def _mediawiki_row_with_attrs (separator , cell_values , colwidths , colaligns ):
@@ -188,8 +192,8 @@ def _mediawiki_row_with_attrs(separator, cell_values, colwidths, colaligns):
188192def _textile_row_with_attrs (cell_values , colwidths , colaligns ):
189193 cell_values [0 ] += " "
190194 alignment = {"left" : "<." , "right" : ">." , "center" : "=." , "decimal" : ">." }
191- values = (alignment .get (a , "" ) + v for a , v in zip (colaligns , cell_values ))
192- return "|" + "|" . join ( values ) + " |"
195+ values = "|" . join (alignment .get (a , "" ) + v for a , v in zip (colaligns , cell_values ))
196+ return f"| { values } |"
193197
194198
195199def _html_begin_table_without_header (colwidths_ignore , colaligns_ignore ):
@@ -258,10 +262,10 @@ def make_header_line(is_header, colwidths, colaligns):
258262 asciidoc_alignments = zip (
259263 colwidths , [alignment [colalign ] for colalign in colaligns ]
260264 )
261- asciidoc_column_specifiers = [
265+ asciidoc_column_specifiers = "," . join (
262266 f"{ width :d} { align } " for width , align in asciidoc_alignments
263- ]
264- header_list = ['cols="' + ( "," . join ( asciidoc_column_specifiers )) + ' "' ]
267+ )
268+ header_list = [f 'cols="{ asciidoc_column_specifiers } "' ]
265269
266270 # generate the list of options (currently only "header")
267271 options_list = []
@@ -270,7 +274,8 @@ def make_header_line(is_header, colwidths, colaligns):
270274 options_list .append ("header" )
271275
272276 if options_list :
273- header_list += ['options="' + "," .join (options_list ) + '"' ]
277+ options_list = "," .join (options_list )
278+ header_list .append (f'options="{ options_list } "' )
274279
275280 # generate the list of entries in the table header field
276281
0 commit comments