unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ag Ibragimov <agzam.ibragimov@gmail.com>
To: emacs-devel@gnu.org
Subject: ASCII Tables with row and colspans
Date: Thu, 12 Oct 2023 16:05:08 -0500	[thread overview]
Message-ID: <m2o7h3a6wr.fsf@gmail.com> (raw)


I've driven myself into a self-imposed headache. I need to render an HTML table (Elisp representation of it, result of libxml-parse) in ASCII. Org-mode tables are notorious for their lack of support for spanned columns or rows. Yay, table.el can do it, it's nice for inserting a table and modifying the content interactively. However, it's not really suitable for filling out a table programmatically. There's a `table-insert-sequence` command in table.el that allows you to insert text into a selected cell while automatically adjusting the table, but it's agonizingly slow to call as a function. Sadly, table.el doesn't seem to have a function that could "adjust the table" the way how `org-ctrl-c-ctrl-c` does in org-mode (which, again, doesn't support spans).

Like if I have something like this (that's a parsed example from the Wiktionary):

'(table
    ((style . "background-color:#F0F0F0;width:100%")
     (class . "inflection-table"))
    (tbody
     nil
     (tr
      nil
      (th ((colspan . "2") (style . "background-color:#e2e4c0;")) "infinitive") " "
      (td ((colspan . "6") (style . "text-align:center;")) "conocer"))
     (tr
      nil (th ((colspan . "2") (style . "background-color:#e2e4c0;")) "gerundive") " "
      (td
       ((colspan . "6") (style . "text-align:center;"))
       (span
        ((class . "Latn") (lang . "ast"))
        (a ((href . "/wiki/conociendo#Asturian")
            (title . "conociendo"))
           "conociendo")) " "))
     (tr...)
     (tr...)
     (tr...)
     (tr...)))

What's fast and easy way to render it in ASCII?



             reply	other threads:[~2023-10-12 21:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 21:05 Ag Ibragimov [this message]
2023-10-13 12:02 ` ASCII Tables with row and colspans Ihor Radchenko
2023-10-19  2:13   ` Ag Ibragimov
2023-10-19  3:21     ` Emanuel Berg
2023-10-19  6:46 ` Visuwesh
2023-11-03 10:20 ` Jean Louis
2023-11-03 16:09   ` Emanuel Berg
2023-11-03 19:12     ` [External] : " Drew Adams
2023-11-03 19:27       ` Emanuel Berg
2023-11-04 15:17         ` Eric S Fraga
2023-11-05 15:53           ` Emanuel Berg
2023-11-08  6:13     ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2o7h3a6wr.fsf@gmail.com \
    --to=agzam.ibragimov@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).