mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-04 16:07:57 +03:00
Replace footnotes by footnote-calls
This commit is contained in:
parent
75e343591d
commit
20fdc45ccc
@ -519,6 +519,8 @@ var { font-style: italic; }
|
||||
video { object-fit: contain; }
|
||||
xmp { display: block; font-family: monospace; margin-bottom: 1em; margin-top: 1em; /* unicode-bidi: isolate; */ white-space: pre; }
|
||||
|
||||
::footnote-call { content: counter(footnote); vertical-align: baseline; font-size: 100%; line-height: inherit; font-variant-position: super; }
|
||||
|
||||
@page {
|
||||
/* `size: auto` (the initial) is A4 portrait */
|
||||
margin: 75px;
|
||||
|
@ -137,7 +137,7 @@ def element_to_box(element, style_for, get_image_from_uri, base_url,
|
||||
{}, # counter_values: name -> stacked/scoped values
|
||||
[set()] # counter_scopes: element tree depths -> counter names
|
||||
)
|
||||
_quote_depth, counter_values, counter_scopes = state
|
||||
quote_depth, counter_values, counter_scopes = state
|
||||
|
||||
update_counters(state, style)
|
||||
|
||||
@ -213,6 +213,13 @@ def element_to_box(element, style_for, get_image_from_uri, base_url,
|
||||
if style['list_style_position'] == 'outside':
|
||||
box.children.append(boxes.TextBox.anonymous_from(box, ''))
|
||||
|
||||
if style['float'] == 'footnote':
|
||||
style = style_for(element, 'footnote-call')
|
||||
box = make_box(f'{element.tag}::footnote-call', style, [], element)
|
||||
box.children = content_to_boxes(
|
||||
style, box, quote_depth, counter_values, get_image_from_uri,
|
||||
target_collector, counter_style)
|
||||
|
||||
# Specific handling for the element. (eg. replaced element)
|
||||
return html.handle_element(element, box, get_image_from_uri, base_url)
|
||||
|
||||
|
@ -245,8 +245,6 @@ def _out_of_flow_layout(context, box, index, child, new_children,
|
||||
if result:
|
||||
new_children, resume_at = result
|
||||
stop = True
|
||||
elif child.is_footnote():
|
||||
pass
|
||||
elif child.is_running():
|
||||
running_name = child.style['position'][1]
|
||||
page = context.current_page
|
||||
|
@ -581,9 +581,6 @@ def _out_of_flow_layout(context, box, containing_block, index, child,
|
||||
box.style['direction'] == 'rtl')):
|
||||
old_child.translate(dx=dx)
|
||||
|
||||
elif child.is_footnote():
|
||||
pass
|
||||
|
||||
elif child.is_running():
|
||||
running_name = child.style['position'][1]
|
||||
page = context.current_page
|
||||
|
Loading…
Reference in New Issue
Block a user