File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 {% assign id_parts = h2_content | split: '"' %}
3030 {% assign heading_id = id_parts[0] %}
3131
32- {% comment %} Extract the text after the closing anchor tag {% endcomment %}
33- {% if h2_content contains '</ a> ' %}
32+ {% comment %} Extract text before a trailing anchor or after a leading anchor {% endcomment %}
33+ {% assign h2_opening = heading_id | append: '"> ' %}
34+ {% assign h2_before_anchor = h2_content | split: '< a ' | first | remove_first: h2_opening | strip_html | strip %}
35+ {% if h2_before_anchor != "" %}
36+ {% assign heading_text = h2_before_anchor | truncate: 80, "" %}
37+ {% elsif h2_content contains '</ a > ' %}
3438 {% assign after_anchor_parts = h2_content | split: '</ a> ' %}
3539 {% assign heading_text = after_anchor_parts[1] | strip_html | strip | truncate: 80, "" %}
3640 {% else %}
5862 {% assign h3_id_parts = h3_content | split: '"' %}
5963 {% assign h3_id = h3_id_parts[0] %}
6064
61- {% if h3_content contains '</ a > ' %}
65+ {% assign h3_opening = h3_id | append: '"> ' %}
66+ {% assign h3_before_anchor = h3_content | split: '< a ' | first | remove_first: h3_opening | strip_html | strip %}
67+ {% if h3_before_anchor != "" %}
68+ {% assign h3_text = h3_before_anchor | truncate: 60, "" %}
69+ {% elsif h3_content contains '</ a > ' %}
6270 {% assign h3_after_anchor = h3_content | split: '</ a > ' %}
6371 {% assign h3_text = h3_after_anchor[1] | strip_html | strip | truncate: 60, "" %}
6472 {% else %}
You can’t perform that action at this time.
0 commit comments