Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Commit

Permalink
Extract height and width of hyperlinks. Fixes #44.
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Aug 24, 2014
1 parent 56e0267 commit c969040
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions storytracker/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,18 @@ def get_hyperlinks(self, force=False):
except ValueError:
pass
# Create the Hyperlink object
location = a.location
alocation = a.location
asize = a.size
hyperlink_obj = Hyperlink(
a.get_attribute("href"),
a.text,
i,
images=image_obj_list,
x=location['x'],
y=location['y'],
cell=self.get_cell(location['x'], location['y']),
width=asize['width'],
height=asize['height'],
x=alocation['x'],
y=alocation['y'],
cell=self.get_cell(alocation['x'], alocation['y']),
font_size=a.value_of_css_property("font-size"),
)
# Add to the link list
Expand Down Expand Up @@ -314,6 +317,8 @@ def write_hyperlinks_csv_to_file(self, file):
"url_string",
"url_index",
"url_is_story",
"url_width",
"url_height",
"url_x",
"url_y",
"url_cell",
Expand Down Expand Up @@ -406,14 +411,18 @@ class Hyperlink(UnicodeMixin):
A hyperlink extracted from an archived URL.
"""
def __init__(
self, href, string, index, images=[], x=None, y=None,
self, href, string, index, images=[],
x=None, y=None,
width=None, height=None,
cell=None, font_size=None
):
self.href = href
self.string = string
self.index = index
self.domain = urlparse(href).netloc
self.images = images
self.width = width
self.height = height
self.x = x
self.y = y
self.cell = cell
Expand Down Expand Up @@ -454,6 +463,8 @@ def __csv__(self):
self.string or '',
self.index,
self.is_story,
self.width,
self.height,
self.x,
self.y,
self.cell,
Expand Down

0 comments on commit c969040

Please sign in to comment.