From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: RFC: Proposal for an Org Special Block for ox-html
Date: Fri, 25 May 2018 12:38:39 -0400 [thread overview]
Message-ID: <CAFyQvY3r=GzOkuqmjmG_VA6rnZyvLxS2NvyOD3ft=r2JaGdNPA@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY01j1VjNMfH6B_VU4tFa63W=Bcq1ynwe+5Paiijm_d5_Q@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1704 bytes --]
Hi Aaron,
I really appreciate your feedback. That helped fine-tune my implementation
of details/summary.
I now moved that code to the ox-blackfriday library when I have this in
org-blackfriday-special-block:
It's basically QOL code:
1. Wraps the "details" portion in "<p class="details"> .. </p>".
2. Accepts only ":open t" as a "true condition" to keep the details widget
open by default. Detecting that inserts just "open" in the "details"
element. So ":open nil" or ":open foo" would not result in inserting any
open attr at all.
The modified contents and attr-str in the below snippet are later used as:
(format "<%s%s>\n%s\n</%s>"
block-type attr-str contents block-type)
((string= block-type "details")
(setq contents
(let* ((str1 (concat contents "\n</p>"))
(str2 (replace-regexp-in-string
"<summary>\\(?:.\\|\n\\)*</summary>"
"\\&\n<p class=\"details\">"
str1))
(has-summary (not (string= str1 str2))))
(unless has-summary
(setq str2 (concat "<p class=\"details\">" str1)))
str2))
;; Insert the "open" attribute only if user has ":open t" in
;; "#+attr_html".
(when (org-string-nw-p attr-str)
(when (string-match "\\(?1:open\\(?2:=\"\\(?3:t\\)\"\\)\\)"
attr-str)
(if (match-string 3 attr-str) ;if attr-str contains `open="t"'
(setq attr-str (replace-match "" nil nil attr-str 2))
(setq attr-str (replace-match "" nil nil attr-str 1))))))
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 2702 bytes --]
next prev parent reply other threads:[~2018-05-25 16:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 13:40 RFC: Proposal for an Org Special Block for ox-html Kaushal Modi
2018-05-24 17:41 ` Aaron Ecay
2018-05-24 18:08 ` Kaushal Modi
2018-05-24 18:28 ` Kaushal Modi
2018-05-24 18:36 ` Aaron Ecay
2018-05-24 18:47 ` Kaushal Modi
2018-05-24 19:08 ` Aaron Ecay
2018-05-24 19:25 ` Kaushal Modi
2018-05-25 14:19 ` Aaron Ecay
2018-05-25 15:09 ` Kaushal Modi
2018-05-25 16:38 ` Kaushal Modi [this message]
2018-05-27 16:21 ` Aaron Ecay
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='CAFyQvY3r=GzOkuqmjmG_VA6rnZyvLxS2NvyOD3ft=r2JaGdNPA@mail.gmail.com' \
--to=kaushal.modi@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).