diff --git a/weasyprint/css/computed_values.py b/weasyprint/css/computed_values.py index c42c1b74..fa1898d4 100644 --- a/weasyprint/css/computed_values.py +++ b/weasyprint/css/computed_values.py @@ -412,7 +412,7 @@ def content(computer, name, values): """convenience function for """ elname = type(el).__name__ if elname == 'PageType': - return ('@page%s %s%s%s %s ' % ( + return ('@page%s %s%s%s %s ' % ( ' ' + el.name if el.name else '', ':' + el.side if el.side else '', ':blank' if el.blank else '', @@ -420,7 +420,7 @@ def content(computer, name, values): pseudo_type if pseudo_type else '' )).rstrip() elif elname == 'Element': - return '%s%s' % ( + return '%s%s' % ( el.tag, '::' + pseudo_type if pseudo_type else '' ) @@ -454,8 +454,8 @@ def content(computer, name, values): if href == '' or href == '#': raise ComputedContentError('Empty anchor name in %s' % (type_,)) if not href.startswith('#'): - raise ComputedContentError('No %s for external URI reference "%s"' - % (type_, href)) + raise ComputedContentError( + 'No %s for external URI reference "%s"' % (type_, href)) href = unquote(href[1:]) TARGET_COLLECTOR.collect_computed_target(href) return [href] + values[2:] @@ -480,7 +480,7 @@ def content(computer, name, values): return tuple( ('STRING', computer.element.get(value, '')) if type_ == 'attr' else ( - (type_ , parse_target_type(type_, value)) + (type_, parse_target_type(type_, value)) if type_ in target_checks else (type_, value) ) for type_, value in values) diff --git a/weasyprint/css/targets.py b/weasyprint/css/targets.py index 9a4bcc64..f3f586d1 100644 --- a/weasyprint/css/targets.py +++ b/weasyprint/css/targets.py @@ -109,10 +109,11 @@ class _TargetCollector(object): if already filled by a previous anchor-element: UPDTODATE else: PENDING, we must parse the whole thing again """ - item = self.items.get(anchor_name, + item = self.items.get( + anchor_name, TargetLookupItem(TARGET_STATE.UNDEFINED)) - LOGGER.debug('lookup_target', - anchor_name, TARGET_STATE.name(item.state)) + LOGGER.debug( + 'lookup_target', anchor_name, TARGET_STATE.name(item.state)) if item.state == TARGET_STATE.PENDING: if anchor_name not in self.existing_anchors: item.state = TARGET_STATE.UNDEFINED @@ -138,8 +139,8 @@ class _TargetCollector(object): """ item = self.items.get(anchor_name, None) if item: - LOGGER.debug('store_target?', - anchor_name, TARGET_STATE.name(item.state)) + LOGGER.debug( + 'store_target?', anchor_name, TARGET_STATE.name(item.state)) if item.state == TARGET_STATE.PENDING: LOGGER.debug(' -> update:', target_counter_values) # need A REAL DUPLICATE UNCONNECTED SEPARATE COPY!! @@ -148,8 +149,8 @@ class _TargetCollector(object): target_counter_values) item.target_box = target_box else: - LOGGER.debug(' -> duplicate anchor definition: %s' - % anchor_name) + LOGGER.debug( + ' -> duplicate anchor definition: %s' % anchor_name) else: LOGGER.debug(' -> achor %s not targetted' % anchor_name) diff --git a/weasyprint/formatting_structure/build.py b/weasyprint/formatting_structure/build.py index 0ae97921..d7c8dba6 100644 --- a/weasyprint/formatting_structure/build.py +++ b/weasyprint/formatting_structure/build.py @@ -307,7 +307,7 @@ def content_to_boxes(style, parent_box, quote_depth, counter_values, else: texts = [] break - elif type_ == 'target-text': + elif type_ == 'target-text': target_name, text_style = value lookup_target = TARGET_COLLECTOR.lookup_target( target_name, parent_box, parse_again)