@@ -172,7 +172,7 @@ Arguments are the list of values ROW, the list of MAX-COL-WIDTHS, and delimiter
172172information in OUTPUT-MODE. Optionally use PAD-FN to pad each column value,
173173otherwise values will be padded to the right with spaces."
174174 (let ((pad-fn (or pad-fn #'format-table-pad-right )))
175- (concat
175+ (list
176176 (plist-get output-mode :begin-row )
177177 (string-join
178178 (-zip-with pad-fn row max-col-widths)
@@ -186,12 +186,13 @@ otherwise values will be padded to the right with spaces."
186186
187187(defun format-table-render-separator-row (max-col-widths output-mode )
188188 " Given the list of MAX-COL-WIDTHS and delimiter information in OUTPUT-MODE, render a row which separates the header row from the rest of the rows."
189- (concat (plist-get output-mode :separator-begin-row )
190- (string-join
191- (-map #'format-table-generate-dash-string max-col-widths)
192- (plist-get output-mode :separator-col-separator ))
193- (plist-get output-mode :separator-end-row )
194- hard-newline))
189+ (list
190+ (plist-get output-mode :separator-begin-row )
191+ (string-join
192+ (-map #'format-table-generate-dash-string max-col-widths)
193+ (plist-get output-mode :separator-col-separator ))
194+ (plist-get output-mode :separator-end-row )
195+ hard-newline))
195196
196197(defun format-table-render-json (table )
197198 " Render the TABLE of values as a json string."
@@ -204,17 +205,16 @@ otherwise values will be padded to the right with spaces."
204205(defun format-table-render-table (table output-mode )
205206 " Given the TABLE of values and delimiter information in OUTPUT-MODE, re-render the table as a string."
206207 (if (equal output-mode 'json )
207- (format-table-render-json table)
208+ (list ( format-table-render-json table) )
208209 (let ((top-border-fn (plist-get output-mode :top-border-fn ))
209210 (bottom-border-fn (plist-get output-mode :bottom-border-fn ))
210211 (header-pad-fn (plist-get output-mode :header-pad-fn ))
211212 (max-col-widths (plist-get table :max-col-widths )))
212- (concat
213+ (append
213214 (if top-border-fn (funcall top-border-fn max-col-widths output-mode))
214215 (format-table-render-row (plist-get table :header ) max-col-widths output-mode header-pad-fn)
215216 (format-table-render-separator-row max-col-widths output-mode)
216- (string-join
217- (--map (format-table-render-row it max-col-widths output-mode) (plist-get table :body )))
217+ (apply #'append (--map (format-table-render-row it max-col-widths output-mode) (plist-get table :body )))
218218 (if bottom-border-fn (funcall bottom-border-fn max-col-widths output-mode))))))
219219
220220(defun format-table-render-row-count (count output-mode )
@@ -266,9 +266,11 @@ otherwise values will be padded to the right with spaces."
266266 (table (format-table-cleanup-and-parse str input-mode)))
267267 (if (not table)
268268 str
269- (concat
270- (format-table-render-table table output-mode)
271- (format-table-render-row-count (plist-get table :row-count ) output-mode)))))
269+ (string-join
270+ (append
271+ (format-table-render-table table output-mode)
272+ (list
273+ (format-table-render-row-count (plist-get table :row-count ) output-mode)))))))
272274
273275(provide 'format-table )
274276; ;; format-table.el ends here
0 commit comments