Ejemplo n.º 1
0
	def testHangingComment(self):
		hangingComment = '''
def bla(): #a
           #b
'''
		self.assertEqual(reindent(hangingComment + ' pass'), hangingComment + '    pass')
Ejemplo n.º 2
0
	def method(self):
		self.assertEqual(reindent(before), after)
Ejemplo n.º 3
0
	def testReindent(self):
		self.assertEqual(reindent(''), '')
Ejemplo n.º 4
0
#
# XMLResume
# https://github.com/ashenm/xmlresume
# Generate and prettify resume.html
#
# Ashen Gunaratne
# [email protected]
#

from lxml import etree
from bs4 import BeautifulSoup
from reindent import reindent
from os.path import join
from sys import argv

# resume theme
theme = dict(enumerate(argv)).get(1, 'default.xsl')

# translate resume
xsl = etree.XSLT(etree.parse(source=join('themes', theme)))
document = str(xsl(etree.parse(source='resume.xml')))

# prettify html
soup = BeautifulSoup(markup=document, features='lxml')

# write prettified output
with open(file='resume.html', mode='w', encoding='utf_8') as file:
    file.write(reindent(markup=soup.prettify(encoding=None, formatter='html')))

# vim: set expandtab shiftwidth=2: