Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 856143 Details for
Bug 1058371
RFE: Support embedding of videos and custom captions
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch
0001-Embedding-support-link-caption-and-video-tags.patch (text/plain), 4.51 KB, created by
Vadim Rutkovsky
on 2014-01-27 16:34:12 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Vadim Rutkovsky
Created:
2014-01-27 16:34:12 UTC
Size:
4.51 KB
patch
obsolete
>From 785a8311e3c4af8b172034f7223f50c6db840f4c Mon Sep 17 00:00:00 2001 >From: Vadim Rutkovsky <vrutkovs@redhat.com> >Date: Mon, 27 Jan 2014 17:27:04 +0100 >Subject: [PATCH] Embedding: support link caption and video tags > >--- > behave/formatter/html.py | 36 ++++++++++++++++++++++++++++++------ > behave/formatter/json.py | 2 +- > behave/runner.py | 4 ++-- > 3 files changed, 33 insertions(+), 9 deletions(-) > >diff --git a/behave/formatter/html.py b/behave/formatter/html.py >index f93cc70..a58d95b 100644 >--- a/behave/formatter/html.py >+++ b/behave/formatter/html.py >@@ -217,10 +217,11 @@ class HTMLFormatter(Formatter): > if hasattr(self, 'embed_in_this_step') and self.embed_in_this_step: > self._doEmbed(self.last_step_embed_span, > self.embed_mime_type, >- self.embed_data) >+ self.embed_data, >+ self.embed_caption) > self.embed_in_this_step = None > >- def _doEmbed(self, span, mime_type, data): >+ def _doEmbed(self, span, mime_type, data, caption): > self.embed_id += 1 > > link = ET.SubElement(span, 'a') >@@ -230,8 +231,28 @@ class HTMLFormatter(Formatter): > "(embd.style.display == 'none' ? 'block' : 'none');" + > "return false") > >+ if 'video/' in mime_type: >+ if not caption: >+ caption = u'Video' >+ link.text = unicode(caption) >+ >+ embed = ET.SubElement(span, 'video', >+ {'id': 'embed_%s' % self.embed_id, >+ 'style': 'display: none', >+ 'width': '320', >+ 'controls': '', >+ }) >+ embed.tail = u' ' >+ embed_source = ET.SubElement(embed, 'source', >+ { >+ 'src': u'data:%s;base64,%s' % (mime_type, base64.b64encode(data)), >+ 'type': '%s; codecs="vp8 vorbis"' % mime_type >+ }) >+ > if 'image/' in mime_type: >- link.text = u'Screenshot' >+ if not caption: >+ caption = u'Screenshot' >+ link.text = unicode(caption) > > embed = ET.SubElement(span, 'img', > {'id': 'embed_%s' % self.embed_id, >@@ -241,7 +262,9 @@ class HTMLFormatter(Formatter): > embed.tail = u' ' > > if 'text/' in mime_type: >- link.text = u'Data' >+ if not caption: >+ caption = u'Data' >+ link.text = unicode(caption) > > def valid_XML_char_ordinal(i): > return ( # conditions ordered by presumed frequency >@@ -260,15 +283,16 @@ class HTMLFormatter(Formatter): > embed.text = cleaned_data > embed.tail = u' ' > >- def embedding(self, mime_type, data): >+ def embedding(self, mime_type, data, caption=None): > if self.last_step.status == 'untested': > # Embed called during step execution > self.embed_in_this_step = True > self.embed_mime_type = mime_type > self.embed_data = data >+ self.embed_caption = caption > else: > # Embed called in after_* >- self._doEmbed(self.last_step_embed_span, mime_type, data) >+ self._doEmbed(self.last_step_embed_span, mime_type, data, caption) > > def close(self): > if not hasattr(self, "all_features"): >diff --git a/behave/formatter/json.py b/behave/formatter/json.py >index 8e8e913..29b8653 100644 >--- a/behave/formatter/json.py >+++ b/behave/formatter/json.py >@@ -170,7 +170,7 @@ class JSONFormatter(Formatter): > result_element['error_message'] = error_message > self._step_index += 1 > >- def embedding(self, mime_type, data): >+ def embedding(self, mime_type, data, caption=None): > step = self.current_feature_element['steps'][-1] > step['embeddings'].append({ > 'mime_type': mime_type, >diff --git a/behave/runner.py b/behave/runner.py >index 97a6a04..e42653f 100644 >--- a/behave/runner.py >+++ b/behave/runner.py >@@ -254,10 +254,10 @@ class Context(object): > return True > return False > >- def embed(self, mime_type, data): >+ def embed(self, mime_type, data, caption=None): > for formatter in self._runner.formatters: > if hasattr(formatter, 'embedding'): >- formatter.embedding(mime_type, data) >+ formatter.embedding(mime_type, data, caption) > > def execute_steps(self, steps_text): > '''The steps identified in the "steps" text string will be parsed and >-- >1.8.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1058371
: 856143