emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: `:export' attribute?: Re: Experimental public branch for inline special blocks
Date: Tue, 19 Mar 2024 21:54:12 +0700	[thread overview]
Message-ID: <utc8um$qq5$1@ciao.gmane.io> (raw)
In-Reply-To: <87r0g7qqcg.fsf@posteo.net>

On 19/03/2024 02:42, Juan Manuel Macías wrote:
> As I mentioned in a past email, these days I will be somewhat busy, but
> I will try to keep up to date with your comments. Although it may take a
> while to respond.

Would you mind against new thread as an umbrella for next bunch of 
topics? Current one becomes too large from my point of view.

For a while a couple of questions related to :export to think on.

I am afraid that :export will cause confusion with :exports for source 
code blocks. Its name differs by just "s" but possible values have 
nothing common.

Another issue is more general and should apply e.g. to HTML attributes 
as well. Consider

--- 8< ---
#+options: inline-special-block-aliases:(("kbd" :export "html*" 
:html-tag kbd))
@kbd{Default} and @kbd[:export "latex*"]{LaTeX}
--- >8 ---

It exports to

     <p>\nDefault and <kbd class="kbd">LaTeX</kbd></p>

I would expect that "html*" is inherited from the parent declaration and 
"latex*" does not override it, so

     <p>\nDefault and LaTeX</p>

On the other hand it should be possible to specify that declared earlier 
rules should be taken into consideration. E.g. "#" might stop further 
processing:

--- 8< ---
#+options: inline-special-block-aliases:(("kbd" :export "html*" 
:html-tag kbd))
@kbd{Default} and @kbd[:export "latex* #"]{LaTeX}
--- >8 ---

makes

     <p>\nDefault and <kbd class="kbd">LaTeX</kbd></p>

result valid.

In the meanwhile I have realized that there is no point in the list of 
parsed rules. You may consider code organized in a bit different way. I 
hope, just a single extra line in these helpers is required to support "#".

(defun org-export--parse-export-rule
     (spec)
   (and (string-match
 
"\\`\\([-_a-zA-Z0-9]*\\)\\(?:\\([/+*]\\)\\([=.]\\)?\\|\\([=.]\\)\\([/+*]\\)?\\)?\\'"
         spec)
        (let ((name (match-string 1 spec))
              (inherit (or (match-string 3 spec)
                           (match-string 4 spec)))
              (what (or (match-string 2 spec)
                        (match-string 5 spec))))
	 (cons
           (if (string-equal "" name) '@ (intern name))
           (cons (or (not inherit) (string-equal inherit "="))
                 (pcase (and what (string-to-char what))
                   ((or ?+ (pred null)) 'full)
                   (?* 'content)
                   (?/ nil)))))))
;; (org-export--parse-export-rule "html+=")

(defun org-export--backend-hierarchy (backend)
   "Result may be cached in INFO."
   (let ((hierarchy))
     (when (not (symbolp backend))
       (setq backend (org-export-backend-name backend)))
     (while backend
       (push backend hierarchy)
       (setq backend (org-export-backend-parent
                      (org-export-get-backend backend))))
     hierarchy))
;; (org-export--backend-hierarchy 'md)

(defun org-export--inline-special-block-export-decision
     (spec-list hierarchy &optional default-rule)
   "Returns (backend inherit . what).
so use `cddr' to get decision."
   (let ((decision '(@ t . full))
         (hierarchy (cons '@ hierarchy)))
     (while (and hierarchy spec-list)
       (let* ((rule (org-export--parse-export-rule (pop spec-list)))
              (tail (and rule (memq (car rule) hierarchy))))
         (if (not rule)
	    (message "invalid :export specification %S" (car spec-list)))
         (when (and tail
                    (or (not (cdr tail)) ; Current backend.
                        (cadr rule))) ; Inherits.
           (setq hierarchy (cdr tail))
           (setq decision rule))))
     (if (and default-rule (memq (car default-rule) hierarchy))
         default-rule
       decision)))

----

(ignore
  (pp
   (let ((rules (org-split-string "latex/ html./ html+= ascii+ *")))
     (mapcar (lambda (backend)
               (let ((hierarchy
                      (org-export--backend-hierarchy backend)))
                 (list backend
                       (cddr
                        (org-export--inline-special-block-export-decision
                         rules hierarchy)))))
             '(odt latex beamer html md ascii)))))

((odt content)
  (latex nil)
  (beamer nil)
  (html nil)
  (md full)
  (ascii full))




  reply	other threads:[~2024-03-19 14:55 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 20:34 Experimental public branch for inline special blocks Juan Manuel Macías
2024-03-02  8:29 ` Stefan Nobis
2024-03-02 10:57   ` Juan Manuel Macías
2024-03-03 20:29 ` Juan Manuel Macías
2024-03-10  2:08   ` `:export' attribute?: " Juan Manuel Macías
2024-03-10 13:54     ` Juan Manuel Macías
2024-03-11 10:27     ` Max Nikulin
2024-03-11 13:59       ` Juan Manuel Macías
2024-03-11 17:01         ` Max Nikulin
2024-03-11 20:19           ` Juan Manuel Macías
2024-03-12  8:32             ` Stefan Nobis
2024-03-12 13:45               ` Juan Manuel Macías
2024-03-12 16:20                 ` Max Nikulin
2024-03-12 17:41                   ` Juan Manuel Macías
2024-03-13 16:08                     ` Max Nikulin
2024-03-13 16:48                       ` Juan Manuel Macías
2024-03-13 17:16                         ` Juan Manuel Macías
2024-03-15  2:19                           ` Juan Manuel Macías
2024-03-15 10:52                             ` Max Nikulin
2024-03-15 13:10                               ` Juan Manuel Macías
2024-03-15 17:21                                 ` Max Nikulin
2024-03-15 14:00                               ` Ihor Radchenko
2024-03-15 11:11                                 ` Max Nikulin
2024-03-15 14:19                                   ` Ihor Radchenko
2024-03-15 16:26                               ` Juan Manuel Macías
2024-03-16 14:07                                 ` Max Nikulin
2024-03-18 19:42                                   ` Juan Manuel Macías
2024-03-19 14:54                                     ` Max Nikulin [this message]
2024-03-19 17:47                                       ` Juan Manuel Macías
2024-03-21 10:26                                       ` inline-special-block: export rules (was: `:export' attribute?: Re: Experimental public branch for inline special blocks) Juan Manuel Macías
2024-03-26 16:56                                         ` inline-special-block: export rules Max Nikulin
2024-03-04 17:13 ` naming: Re: Experimental public branch for inline special blocks Max Nikulin
2024-03-04 17:29   ` Ihor Radchenko
2024-03-04 17:49     ` Juan Manuel Macías
2024-03-05 10:53       ` Max Nikulin
2024-03-05 11:04         ` Ihor Radchenko
2024-03-05 15:16           ` Suhail Singh
2024-03-05 15:23             ` Suhail Singh
2024-03-05 15:16         ` Juan Manuel Macías
2024-03-06 10:42     ` Max Nikulin
2024-03-06 10:56       ` Ihor Radchenko
2024-03-07 10:34         ` Max Nikulin
2024-03-07 14:12           ` Ihor Radchenko
2024-03-08  5:26             ` Samuel Wales
2024-03-08 16:32               ` Max Nikulin
2024-03-08 16:41                 ` Ihor Radchenko
2024-03-04 18:07   ` Juan Manuel Macías
2024-03-04 22:17     ` Samuel Wales
2024-03-04 22:18       ` Samuel Wales
2024-03-05 16:47 ` smallcaps: " Max Nikulin
2024-03-05 17:28   ` Juan Manuel Macías
2024-03-06 10:55     ` Max Nikulin
2024-03-06 15:21       ` Juan Manuel Macías
2024-03-06 16:53 ` To avoid zero width space: " Max Nikulin
2024-03-06 18:27   ` Juan Manuel Macías
2024-03-06 21:13   ` Juan Manuel Macías
2024-03-07 10:57 ` false positives: " Max Nikulin
2024-03-07 11:06   ` Juan Manuel Macías
2024-03-07 11:18     ` Ihor Radchenko
2024-03-07 11:19       ` Juan Manuel Macías
2024-03-07 15:53       ` Juan Manuel Macías
2024-03-07 16:09         ` Ihor Radchenko
2024-03-07 16:57           ` Juan Manuel Macías
2024-03-07 18:21             ` Juan Manuel Macías
2024-03-08 13:58               ` Max Nikulin
2024-03-08 15:44                 ` Juan Manuel Macías
2024-03-08 16:04                   ` Max Nikulin
2024-03-08 16:15                   ` Ihor Radchenko
2024-03-08 18:44                     ` Juan Manuel Macías
2024-03-08 18:57                       ` Juan Manuel Macías
2024-03-09 11:10                         ` Max Nikulin
2024-03-09 11:48                           ` Juan Manuel Macías
2024-03-09 15:24                             ` Juan Manuel Macías
2024-03-10  7:11                               ` Max Nikulin
2024-04-09  8:52 ` Ihor Radchenko
2024-04-09 10:51   ` Max Nikulin
2024-04-09 14:05     ` Ihor Radchenko
2024-04-10 23:00       ` Juan Manuel Macías
2024-04-11 12:26         ` Ihor Radchenko
2024-04-11 13:47           ` Juan Manuel Macías
2024-04-14 15:59   ` Attributes on images (was:: Experimental public branch for inline special blocks) Rick Lupton
2024-04-14 19:26     ` Ihor Radchenko
2024-04-11 11:06 ` Experimental public branch for inline special blocks Max Nikulin

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.orgmode.org/

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

  git send-email \
    --in-reply-to='utc8um$qq5$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@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/org-mode.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).