summaryrefslogtreecommitdiffstats
path: root/lps_gen.py
diff options
context:
space:
mode:
authorrsiddharth <rsd@gnu.org>2017-10-25 01:20:38 +0000
committerrsiddharth <rsd@gnu.org>2017-10-25 01:20:38 +0000
commit64738c4359b526400019e3263fa4c07c39f02527 (patch)
tree8d231cfc2b6ef5148b2b8c1373b464b51378a8b8 /lps_gen.py
parenteb7732b5ef9e54c007eee2adf4ba57c7db857b20 (diff)
lps_gen.py: LPSRenderer: Add _process_video.
* lps_gen.py (LPSRenderer._process_video): New method.
Diffstat (limited to 'lps_gen.py')
-rw-r--r--lps_gen.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/lps_gen.py b/lps_gen.py
index 25d6adf..0c72f54 100644
--- a/lps_gen.py
+++ b/lps_gen.py
@@ -362,6 +362,24 @@ class LPSRenderer(Renderer):
self.last_session = 'st-from-ts'
+ def _process_video(self, text):
+ """Process the video text.
+
+ If it's a link, just extract the link and return it.
+
+ This method is meant to be called from the
+ :py:method:`.paragraph` method.
+ """
+ soup = BeautifulSoup(text, 'html.parser')
+ links = soup.find_all('a')
+
+ if len(links) == 0:
+ # no links found, so
+ return text
+
+ # link(s) found, return the first link's href.
+ return links[0]['href']
+
def link(self, link, title, text):
# Here, we catch speaker names that have to be autolinked and
# autolink them if there is an id available for the speaker.