Skip to content

Commit

Permalink
Added an example for constructing <embed> tag
Browse files Browse the repository at this point in the history
  • Loading branch information
bharadwajyarlagadda committed Sep 2, 2016
1 parent 9453e27 commit afe8f16
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,32 @@ Korona can build <dt> tag.
assert dt_tag1 == '<dt>abc</dt>'
assert dt_tag1 == dt_tag2
<embed>
-------

Korona supports some of the embed tag attributes like:

- ``height``
- ``src``
- ``type``
- ``width``

Korona can build <embed> tag.

.. code-block:: python
from korona.html.construct import Embed
attributes = {'src': 'helloworld.swf', 'height': '200', 'width': '100'}
# You can pass in the attributes in the form of a dictionary.
embed1 = Embed(**attributes)
# You can also pass in the attributes as args.
embed2 = Embed(src='helloworld.swf', height='200', width='100')
embed_tag1 = embed1.construct()
embed_tag2 = embed2.construct()
assert embed_tag1 == '<embed src="helloworld.swf" width="100" height="200" >'
assert embed_tag1 == embed_tag2

0 comments on commit afe8f16

Please sign in to comment.