def test_markup_for_a_long_block_with_mixed_flow_and_phrasing_content(self): div = Div() with div: Text('Lorem ipsum dolor sit amet, ') Strong('consectetur') Text(' adipiscing elit, ') with P(): Em('sed') Text(' do eiusmod tempor incididunt ut ') Strong('labore') Text(' et dolore magna aliqua.') self.assertEqual( dedent( """\ <div> Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipiscing elit, <p> <em>sed</em> do eiusmod tempor incididunt ut </p> <strong>labore</strong> et dolore magna aliqua. </div> """ ), div.markup(width=40) )
def test_markup_for_empty_body(self): div = Div() self.assertEqual( dedent( """\ <div> </div> """ ), div.markup(width=80) )
def test_markup(self): div = Div() with div: Div() self.assertEqual( dedent( """\ <div> <div> </div> </div> """ ), div.markup(width=80) )
def aughey(): with Directory('aughey'): with Page('Don McCaughey', name='index'): with Div(class_names=['banner']): Img(src='/aughey/handstand.jpg', alt='Don doing a handstand') Br() Span(class_names=['caption'], text='Coachella Festival, spring 2007')
def memory_match(): with Directory('memory_match'): with Page('Memory Match', name='index') as page: page.add_script( 'https://cdnjs.cloudflare.com/ajax/libs/cash/1.3.0/cash.min.js' ) page.add_script('memory_match.js') Div(id='memory_match')
def test_markup(self): body = Body() with body: Div() self.assertEqual( dedent( """\ <div> </div> """ ), body.markup(width=80) )
def test_markup(self): html = HTML() with html: with Head(): Title('Hello') with Body(): Div() self.assertEqual( dedent( """\ <title>Hello</title> <div> </div> """ ), html.markup(width=80) )
def home_page(): with Page('Don McCaughey', name='index'): with Div(class_names=['banner']): Img(src= '/banners/Don_and_Molly_Round_Hill_Lake_Tahoe_summer_2019.jpg', alt='Don and Molly atop Round Hill') Br() Span(text='Round Hill, Lake Tahoe, summer 2019', class_names=['lower-caption']) with Ul(class_names=['collection']): item('Sourcehut', 'https://git.sr.ht/~donmcc', 'donmcc', external=True) item('GitHub', 'https://github.com/donmccaughey', 'donmccaughey', favicon='/icons/github.png', external=True) item('Twitter', 'https://twitter.com/donmccaughey', '@donmccaughey', favicon='/icons/twitter.png', external=True) item('LinkedIn', 'https://www.linkedin.com/in/donmccaughey', 'donmccaughey', favicon='/icons/linkedin.png', external=True) item('Résumé', '/resume/Resume_of_Don_McCaughey.pdf', "Stuff I've done") item('Memory Match', '/memory_match/', 'A tile matching game') item('Random Words', '/random_words/', 'A handy word picker') item('macOS Packages', '/macos_packages/', 'Software installers', favicon='/macos_packages/package-32x32.png') item('Engineering Management', '/engineering_management/', 'Software is a team sport') item('Hashtables', '/hashtables/', 'Keys and values') item('Make', '/make/', 'The build tool') item('Shell', '/shell/', 'Unix glue') item('Science Fiction', '/science_fiction/', 'Reading for fun') item('Business Novels', '/business_novels/', 'Fictionalized learning')
def test_markup_when_first_child_is_comment(self): html = HTML() with html: with Head(): Title('Hello') with Body(): Comment('foobar') Div() self.assertEqual( dedent( """\ <title>Hello</title> <body> <!-- foobar --> <div> </div> """ ), html.markup(width=80) )