From mboxrd@z Thu Jan 1 00:00:00 1970
From: Kaushal Modi
Subject: Re: RFC: Proposal for an Org Special Block for ox-html
Date: Thu, 24 May 2018 14:28:06 -0400
Message-ID:
References:
<87o9h56jdl.fsf@gmail.com>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="000000000000cbd55d056cf7d038"
Return-path:
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38529)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1fLuyM-0007R1-CO
for emacs-orgmode@gnu.org; Thu, 24 May 2018 14:28:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1fLuyL-0001jC-7Z
for emacs-orgmode@gnu.org; Thu, 24 May 2018 14:28:22 -0400
Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]:42049)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
(Exim 4.71) (envelope-from )
id 1fLuyK-0001iP-TT
for emacs-orgmode@gnu.org; Thu, 24 May 2018 14:28:21 -0400
Received: by mail-wr0-x22a.google.com with SMTP id w10-v6so4834218wrk.9
for ; Thu, 24 May 2018 11:28:20 -0700 (PDT)
In-Reply-To:
List-Id: "General discussions about Org-mode."
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: "Emacs-orgmode"
To: emacs-org list
--000000000000cbd55d056cf7d038
Content-Type: text/plain; charset="UTF-8"
Hello Aaron,
On Thu, May 24, 2018 at 2:08 PM Kaushal Modi wrote:
> Expanding on your idea.. what if we had another Special block with name
> summary?
>
> #+begin_details
> #+begin_summary
> Open for details
>
> More summary.
> #+end_summary
> Many details here.
> #+end_details
>
>From quick testing, this works (doesn't support the div tags for HTML4).
The good part is that the "summary" Special Block is automatically handled
by ox-html.
((string= block-type "details")
;; Recognize Org Special blocks like:
;; #+begin_details
;; #+begin_summary
;; This is summary.
;; #+end_summary
;; Here are the details.
;; #+end_details
(let* ((is-open (member "open" (org-element-property :attr_html
special-block)))
(str1 (org-blackfriday-special-block special-block contents
nil))
;; Insert a new-line before the closing tag
;; for correct Markdown parsing for cases when the
;; Special Block content ends a code block. Without this
;; inserted newline, the Markdown converted content will
;; look like below, and Blackfriday won't parse it
;; correctly.
;; ```emacs-lisp
;; (message "a code block")
;; ```
;; A closing
tag is also added.. the opening
;; tag is later added in the `str2' var if summary is
;; present, else in `str3' var.
(str1 (replace-regexp-in-string "\\'" "\n
\\&"
str1))
;; Detect the summary closing tag "".
;; Also add the opening tag with "details" class
;; so that just as CSS rules can be set for summary
;; ("details summary"), they can be set for the details
;; portion following the too, using "details
;; .details".
(str2 (replace-regexp-in-string
"\\(\\(.\\|\n\\)*\\)"
"\\1"
str1)))
;; (message "[DBG details/summary]: is-open:%S `%s' `%s'" is-open
str1 str2)
(if is-open
(replace-regexp-in-string "\\`\\(" "\\1 open>" str2)
str2)))
Also, thinking about HTML4 support, as details and summary tags were added
in HTML5, the "support" would be simply to and the (string= block-type
"details") condition with org-html-html5-fancy or equivalent. So then for
HTML4, details and summary Special Blocks will simply be div tags.
--
Kaushal Modi
--000000000000cbd55d056cf7d038
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: base64
PGRpdiBkaXI9Imx0ciI+PGRpdj5IZWxsbyBBYXJvbiw8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2
PjxkaXYgY2xhc3M9ImdtYWlsX3F1b3RlIj48ZGl2IGRpcj0ibHRyIj5PbiBUaHUsIE1heSAyNCwg
MjAxOCBhdCAyOjA4IFBNIEthdXNoYWwgTW9kaSAmbHQ7PGEgaHJlZj0ibWFpbHRvOmthdXNoYWwu
bW9kaUBnbWFpbC5jb20iPmthdXNoYWwubW9kaUBnbWFpbC5jb208L2E+Jmd0OyB3cm90ZTo8YnI+
PC9kaXY+PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b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