-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved classes FrameSet(), Head() and Header() from html/construct.py …
…to html/tags/
- Loading branch information
1 parent
fac166e
commit 41439ce
Showing
11 changed files
with
129 additions
and
104 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Module for constructing <frameset> tag.""" | ||
|
||
from ...templates.html.tags import frameset_tag | ||
|
||
|
||
class FrameSet(object): | ||
"""Class for constructing <frameset> tag. | ||
Args: | ||
cols (str): Specifies the number and size of columns in a frameset. | ||
rows (str): Specifies the number and size of rows in a frameset. | ||
.. versionadded:: 0.2.0 | ||
""" | ||
def __init__(self, cols=None, rows=None): | ||
self.tag = 'frameset' | ||
self.values = {'cols': cols, 'rows': rows} | ||
|
||
def construct(self): | ||
"""Returns the constructed tag <frameset>.""" | ||
return frameset_tag.render(self.values) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Module for constructing <head> tag.""" | ||
|
||
from ...templates.html.tags import head_tag | ||
|
||
|
||
class Head(object): | ||
"""Class for constructing <head> tag. | ||
Args: | ||
text (str): Specifies the head text. (As in <head>{text}</head>) | ||
.. versionadded:: 0.3.0 | ||
""" | ||
def __init__(self, text=None): | ||
# TODO: Add the ability to validate which inner tags can go into the | ||
# <head> tag. | ||
self.tag = 'head' | ||
self.values = {'text': text} | ||
|
||
def construct(self): | ||
"""Returns the constructed tag <head>.""" | ||
return head_tag.render(self.values) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Module for constructing <header> tag.""" | ||
|
||
from ...templates.html.tags import header_tag | ||
|
||
|
||
class Header(object): | ||
"""Class for constructing the header tag. | ||
Args: | ||
text (str): Specifies the header text. (As in <header>{text}</header>) | ||
.. versionadded:: 0.3.0 | ||
""" | ||
def __init__(self, text=None): | ||
# TODO: Add support for inner tags. | ||
self.tag = 'header' | ||
self.values = {'text': text} | ||
|
||
def construct(self): | ||
"""Returns the constructed header tag <header></header>.""" | ||
return header_tag.render(self.values) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from ..fixtures import parametrize | ||
|
||
from korona.html.tags import FrameSet | ||
from korona.templates.html.tags import frameset_tag | ||
|
||
|
||
@parametrize('attributes', [ | ||
({'cols': '25%'}), | ||
({'rows': '50%'}) | ||
]) | ||
def test_construct_frameset_tag(attributes): | ||
"""Test for validating whether the frameset tag is constructed correctly or | ||
not. | ||
""" | ||
frameset = FrameSet(**attributes) | ||
assert frameset.construct() == frameset_tag.render(attributes) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from ..fixtures import parametrize | ||
|
||
from korona.html.tags import Head | ||
from korona.templates.html.tags import head_tag | ||
|
||
|
||
@parametrize('attributes', [ | ||
({'text': 'abcd'}) | ||
]) | ||
def test_construct_head_tag(attributes): | ||
"""Test for validating whether the head tag is constructed correctly or | ||
not. | ||
""" | ||
head = Head(**attributes) | ||
assert head.construct() == head_tag.render(attributes) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from ..fixtures import parametrize | ||
|
||
from korona.html.tags import Header | ||
from korona.templates.html.tags import header_tag | ||
|
||
|
||
@parametrize('attributes', [ | ||
({'text': 'abcd'}) | ||
]) | ||
def test_construct_header_tag(attributes): | ||
"""Test for validating whether the header tag is constructed correctly or | ||
not. | ||
""" | ||
header = Header(**attributes) | ||
assert header.construct() == header_tag.render(attributes) |
This file contains 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