|
106 | 106 | (if (plist-get input-mode :top-border-fn) |
107 | 107 | (-slice ret 0 (1- (length ret))) ret)))) |
108 | 108 |
|
109 | | -(defun format-table-trim-row (row begin-row end-row) |
110 | | - "Given the string ROW trim the string BEGIN-ROW from the beginning and END-ROW from the end." |
111 | | - (replace-regexp-in-string |
112 | | - (concat "^" (regexp-quote begin-row)) |
113 | | - "" |
114 | | - (replace-regexp-in-string |
115 | | - (concat (regexp-quote end-row) "$") |
116 | | - "" |
117 | | - row))) |
118 | | - |
119 | 109 | (defun format-table-get-col-widths (dashes input-mode) |
120 | 110 | "Using the line of all DASHES from the table and the INPUT-MODE, determine the widths of the columns and return them in a list." |
121 | | - (let* ((separator-begin-row (plist-get input-mode :separator-begin-row)) |
122 | | - (separator-end-row (plist-get input-mode :separator-end-row)) |
| 111 | + (let* ((separator-begin-row (regexp-quote (plist-get input-mode :separator-begin-row))) |
| 112 | + (separator-end-row (regexp-quote (plist-get input-mode :separator-end-row))) |
123 | 113 | (separator-col-separator (plist-get input-mode :separator-col-separator)) |
124 | | - (dashes (format-table-trim-row dashes separator-begin-row separator-end-row))) |
| 114 | + (dashes (string-trim dashes separator-begin-row separator-end-row))) |
125 | 115 | (-map #'length (split-string dashes |
126 | 116 | (regexp-quote separator-col-separator))))) |
127 | 117 |
|
|
130 | 120 | (let* ((begin-row (plist-get input-mode :begin-row)) |
131 | 121 | (end-row (plist-get input-mode :end-row)) |
132 | 122 | (col-separator (plist-get input-mode :col-separator)) |
133 | | - (row (format-table-trim-row row begin-row end-row)) |
| 123 | + (row (string-trim row begin-row end-row)) |
134 | 124 | split) |
135 | 125 | (reverse |
136 | 126 | (dolist (cur-width col-widths split) |
|
0 commit comments