1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-19 04:20:24 +01:00

Sync website with README

This commit is contained in:
Jan Larres
2014-10-01 12:38:42 +13:00
parent c2f468e098
commit 4729c6df95
4 changed files with 96 additions and 96 deletions

33
update_from_readme.py Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python
# This script is originally from the YouCompleteMe project.
from bs4 import BeautifulSoup
from markdown import markdown
import fileinput
markdown_lines = list(fileinput.input())
# Delete the header
del markdown_lines[:2]
markdown_source = ''.join(markdown_lines)
with open('index.html', 'r+') as content_file:
content = content_file.read()
new_contents = markdown(unicode(markdown_source, 'utf-8'),
extensions=['fenced_code'])
new_tags = BeautifulSoup(new_contents, 'html5lib')
# soup = BeautifulSoup(content, "html5lib")
# Use the normal html parser so it doesn't add html/body tags
# around our fragment
soup = BeautifulSoup(content, "html.parser")
elem = soup.find(id="markdown-output")
elem.clear()
for new_elem in new_tags.body.contents:
elem.append(new_elem)
content_file.seek(0)
content_file.truncate()
content_file.write(str(soup))