Compare commits

..

2 Commits

Author SHA1 Message Date
bbbeae6fe9 center tables <th>s #12 2017-01-26 12:24:09 +11:00
271c7c619a fix bug: remove hard-coded color in CSS 2017-01-26 11:47:18 +11:00
4 changed files with 13 additions and 12 deletions

View File

@ -9,7 +9,6 @@ body {
font-family: "Open Sans", sans-serif; font-family: "Open Sans", sans-serif;
background-color: var(--background); background-color: var(--background);
font-size: 15px; font-size: 15px;
color: #333;
} }
blockquote { blockquote {

View File

@ -7,7 +7,6 @@ import os.path
class MLPDevListener(sublime_plugin.EventListener): class MLPDevListener(sublime_plugin.EventListener):
def on_post_save(self, view): def on_post_save(self, view):
# return
if not (os.path.dirname(__file__) in view.file_name() and if not (os.path.dirname(__file__) in view.file_name() and
view.file_name().endswith('.py')): view.file_name().endswith('.py')):
return return

View File

@ -29,7 +29,17 @@ def pre_table(s_table):
text += '|\n' text += '|\n'
for j, cell in enumerate(row): for j, cell in enumerate(row):
text += '| ' + ''.join(str(node) for node in cell.contents) \ text += '| '
if cell.name == 'th':
title = ' ' * ((cols_width[j] - len(cell.text)) // 2) \
+ ''.join(str(node) for node in cell.contents) \
+ ' ' * int(round((cols_width[j] - len(cell.text)) / 2 ) + 1)
# + 1 because of the added space before the closing | of each cell
if cols_width[j] + 1 != len(title):
title += ' '
text += title
else:
text += ''.join(str(node) for node in cell.contents) \
+ ' ' * (cols_width[j] - len(cell.text) + 1) + ' ' * (cols_width[j] - len(cell.text) + 1)
text += '|\n' text += '|\n'
text += '</pre></code>' text += '</pre></code>'
@ -40,7 +50,3 @@ def pre_tables(html):
for table in soup.find_all('table'): for table in soup.find_all('table'):
table.replace_with(BeautifulSoup(pre_table(table), 'html.parser')) table.replace_with(BeautifulSoup(pre_table(table), 'html.parser'))
return str(soup) return str(soup)
if __name__ == "__main__":
# CSW: ignore
print(pre_tables(html))

View File

@ -8,7 +8,6 @@ if you is moods.curious:
print('then do it!') print('then do it!')
``` ```
<kbd>ctrl+\`</kbd> or *View → Show Console* and paste `import this`! <kbd>ctrl+\`</kbd> or *View → Show Console* and paste `import this`!
> Perfect programmers do NOT need comments. > Perfect programmers do NOT need comments.
@ -27,8 +26,6 @@ if you is moods.curious:
[Sublime Text Logo](https://upload.wikimedia.org/wikipedia/en/4/4c/Sublime_Text_Logo.png) [Sublime Text Logo](https://upload.wikimedia.org/wikipedia/en/4/4c/Sublime_Text_Logo.png)
Some plugin I just *need*: Some plugin I just *need*:
- [PackageResourceReviewer](https://packagecontrol.io/packages/PackageResourceViewer) - [PackageResourceReviewer](https://packagecontrol.io/packages/PackageResourceViewer)