From 221c70fe356a6f2249a1e45e0a91238ee640898a Mon Sep 17 00:00:00 2001 From: midichef <67946319+midichef@users.noreply.github.com> Date: Thu, 7 Dec 2023 03:04:39 -0800 Subject: [PATCH] [html] show table's sibling h1-h6 tags --- visidata/loaders/html.py | 1 + 1 file changed, 1 insertion(+) diff --git a/visidata/loaders/html.py b/visidata/loaders/html.py index 4293547ec..b1523e0b9 100644 --- a/visidata/loaders/html.py +++ b/visidata/loaders/html.py @@ -37,6 +37,7 @@ class HtmlTablesSheet(IndexSheet): Column('aria_label', getter=lambda col,row: row.html.attrib.get('aria-label')), Column('caption', getter=lambda col,row: row.html.xpath('normalize-space(./caption)') if row.html.xpath('./caption') else None, cache=True), Column('summary', getter=lambda col,row: row.html.attrib.get('summary')), + Column('heading', getter=lambda col,row: row.html.xpath('normalize-space(./preceding-sibling::*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6][1])') or None, cache=True), ] def iterload(self): lxml = vd.importExternal('lxml')