Created
February 16, 2012 02:06
-
-
Save alexras/1840952 to your computer and use it in GitHub Desktop.
Turn a Google Code table into HTML table rows, and convert any backticks in the table to <code> tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun google-code-table-to-html () | |
| (interactive) | |
| (save-restriction | |
| (narrow-to-region (region-beginning) (region-end)) | |
| (goto-char (region-beginning)) | |
| (while (re-search-forward "^||" nil t) | |
| (replace-match "<tr><td>")) | |
| (goto-char (region-beginning)) | |
| (while (re-search-forward "||$" nil t) | |
| (replace-match "</td></tr>")) | |
| (goto-char (region-beginning)) | |
| (while (re-search-forward "||" nil t) | |
| (replace-match "</td><td>")) | |
| (goto-char (region-beginning)) | |
| (while (re-search-forward "`\\(.*?\\)`" nil t) | |
| (replace-match (concat "<code>" (match-string 1) "</code>"))) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment