emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Allow more export options to be controlled per-subtree
@ 2017-09-28 17:28 Kaushal Modi
  2017-09-28 18:40 ` Kaushal Modi
  2017-09-28 18:47 ` Nicolas Goaziou
  0 siblings, 2 replies; 9+ messages in thread
From: Kaushal Modi @ 2017-09-28 17:28 UTC (permalink / raw)
  To: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 2935 bytes --]

Hello,

I see that many export options like org-export-with-emphasize,
org-export-with-sub-superscripts cannot be set on per-subtree basis using
properties.

In ox.el, I see:

(defconst org-export-options-alist
  '((:title "TITLE" nil nil parse)
    (:date "DATE" nil nil parse)
    (:author "AUTHOR" nil user-full-name parse)
    (:email "EMAIL" nil user-mail-address t)
    (:language "LANGUAGE" nil org-export-default-language t)
    (:select-tags "SELECT_TAGS" nil org-export-select-tags split)
    (:exclude-tags "EXCLUDE_TAGS" nil org-export-exclude-tags split)
    (:creator "CREATOR" nil org-export-creator-string)
    (:headline-levels nil "H" org-export-headline-levels)
    (:preserve-breaks nil "\\n" org-export-preserve-breaks)
    (:section-numbers nil "num" org-export-with-section-numbers)
    (:time-stamp-file nil "timestamp" org-export-time-stamp-file)
    (:with-archived-trees nil "arch" org-export-with-archived-trees)
    (:with-author nil "author" org-export-with-author)
    (:with-broken-links nil "broken-links" org-export-with-broken-links)
    (:with-clocks nil "c" org-export-with-clocks)
    (:with-creator nil "creator" org-export-with-creator)
    (:with-date nil "date" org-export-with-date)
    (:with-drawers nil "d" org-export-with-drawers)
    (:with-email nil "email" org-export-with-email)
    (:with-emphasize nil "*" org-export-with-emphasize)
    (:with-entities nil "e" org-export-with-entities)
    (:with-fixed-width nil ":" org-export-with-fixed-width)
    (:with-footnotes nil "f" org-export-with-footnotes)
    (:with-inlinetasks nil "inline" org-export-with-inlinetasks)
    (:with-latex nil "tex" org-export-with-latex)
    (:with-planning nil "p" org-export-with-planning)
    (:with-priority nil "pri" org-export-with-priority)
    (:with-properties nil "prop" org-export-with-properties)
    (:with-smart-quotes nil "'" org-export-with-smart-quotes)
    (:with-special-strings nil "-" org-export-with-special-strings)
    (:with-statistics-cookies nil "stat" org-export-with-statistics-cookies)
    (:with-sub-superscript nil "^" org-export-with-sub-superscripts)
    (:with-toc nil "toc" org-export-with-toc)
    (:with-tables nil "|" org-export-with-tables)
    (:with-tags nil "tags" org-export-with-tags)
    (:with-tasks nil "tasks" org-export-with-tasks)
    (:with-timestamps nil "<" org-export-with-timestamps)
    (:with-title nil "title" org-export-with-title)
    (:with-todo-keywords nil "todo" org-export-with-todo-keywords))


I believe that can be fixed by doing:

    (:with-emphasize "WITH_EMPHASIZE" "*" org-export-with-emphasize)

.. and so on, and then one can have

:EXPORT_WITH_EMPHASIZE: t

or

:EXPORT_WITH_EMPHASIZE:

in the subtree property.

Is there a reason why this support wasn't added in the first place?
(Or does a method already exist to allow me to do the above?)

I can work on a patch if it's OK to enable this functionality.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 4321 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Allow more export options to be controlled per-subtree
  2017-09-28 17:28 Allow more export options to be controlled per-subtree Kaushal Modi
@ 2017-09-28 18:40 ` Kaushal Modi
  2017-09-28 18:47 ` Nicolas Goaziou
  1 sibling, 0 replies; 9+ messages in thread
From: Kaushal Modi @ 2017-09-28 18:40 UTC (permalink / raw)
  To: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]

On Thu, Sep 28, 2017 at 1:28 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:

> .. and so on, and then one can have
>
> :EXPORT_WITH_EMPHASIZE: t
>
> or
>
> :EXPORT_WITH_EMPHASIZE:
>
> in the subtree property.
>
> Is there a reason why this support wasn't added in the first place?
> (Or does a method already exist to allow me to do the above?)
>
> I can work on a patch if it's OK to enable this functionality.
>

From a quick testing, this works:

diff --git a/lisp/ox.el b/lisp/ox.el
index 4d3d7afb9d6..473608e82b2 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -119,7 +119,7 @@
     (:with-date nil "date" org-export-with-date)
     (:with-drawers nil "d" org-export-with-drawers)
     (:with-email nil "email" org-export-with-email)
-    (:with-emphasize nil "*" org-export-with-emphasize)
+    (:with-emphasize "EXPORT_WITH_EMPHASIZE" "*" org-export-with-emphasize)
     (:with-entities nil "e" org-export-with-entities)
     (:with-fixed-width nil ":" org-export-with-fixed-width)
     (:with-footnotes nil "f" org-export-with-footnotes)
@@ -2924,7 +2924,7 @@ returned by the function."
       ?\s)))))
         ;; ... emphasis...
         ((bold italic strike-through underline)
- (and (not (plist-get info :with-emphasize))
+ (and (not (org-string-nw-p (plist-get info :with-emphasize)))
       (let ((marker (cl-case (org-element-type datum)
       (bold "*")
       (italic "/")

I can have the same done for all options in a final patch.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2744 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: Allow more export options to be controlled per-subtree
  2017-09-28 17:28 Allow more export options to be controlled per-subtree Kaushal Modi
  2017-09-28 18:40 ` Kaushal Modi
@ 2017-09-28 18:47 ` Nicolas Goaziou
  2017-09-28 18:59   ` Kaushal Modi
  1 sibling, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2017-09-28 18:47 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Hello,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> I see that many export options like org-export-with-emphasize,
> org-export-with-sub-superscripts cannot be set on per-subtree basis using
> properties.

[...]

> I believe that can be fixed by doing:
>
>     (:with-emphasize "WITH_EMPHASIZE" "*" org-export-with-emphasize)
>
> .. and so on, and then one can have
>
> :EXPORT_WITH_EMPHASIZE: t
>
> or
>
> :EXPORT_WITH_EMPHASIZE:
>
> in the subtree property.
>
> Is there a reason why this support wasn't added in the first place?
> (Or does a method already exist to allow me to do the above?)

Besides the fact that it is not available, is there any incentive to do
so? AFAIC this variable could not exist.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Allow more export options to be controlled per-subtree
  2017-09-28 18:47 ` Nicolas Goaziou
@ 2017-09-28 18:59   ` Kaushal Modi
  2017-09-28 19:19     ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Kaushal Modi @ 2017-09-28 18:59 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Amos Bird, emacs-org list

[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]

On Thu, Sep 28, 2017 at 2:47 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Besides the fact that it is not available, is there any incentive to do
> so?


While talking to Amos (now CC'ed on this email) off-list on Gitter chat
regarding the ox-hugo package, he had this test case[1] where he sets
"#+OPTIONS:
*:nil" to prevent the interpretation of Org emphasis chars in that table,
which exports to this Markdown[2], and finally this[3].

Now, we can have a single Org file with multiple sub-trees and each
sub-tree exports to a separate Markdown file. It would not be practical to
globally set "#+OPTIONS: *:nil".

With this proposal implemented, if cases like the Org table linked above
exist, we can disable emphasis interpretation localized only to that single
subtree.

This proposal will basically allow each Org sub-tree to get all the export
options the whole Org file gets; making sub-tree export a more prime
feature.


> AFAIC this variable could not exist.
>

I didn't understand that.

[1]:
https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/test/site/content-org/single-posts/export-without-emphasize.org
[2]:
https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/test/site/content/posts/export-without-emphasize.md
[3]: https://ox-hugo.netlify.com/test/posts/export-without-emphasize/

-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2716 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Allow more export options to be controlled per-subtree
  2017-09-28 18:59   ` Kaushal Modi
@ 2017-09-28 19:19     ` Nicolas Goaziou
  2017-09-28 19:25       ` Kaushal Modi
  2017-09-30  4:59       ` Kaushal Modi
  0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2017-09-28 19:19 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Amos Bird, emacs-org list

Kaushal Modi <kaushal.modi@gmail.com> writes:

> On Thu, Sep 28, 2017 at 2:47 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
>
>> Besides the fact that it is not available, is there any incentive to do
>> so?
>
>
> While talking to Amos (now CC'ed on this email) off-list on Gitter chat
> regarding the ox-hugo package, he had this test case[1] where he sets
> "#+OPTIONS:
> *:nil" to prevent the interpretation of Org emphasis chars in that table,
> which exports to this Markdown[2], and finally this[3].

I already answered to this problem. Use \star instead of *. It seems
sub-optimal to prevent any emphasis markup because of a single
problematic character.

>> AFAIC this variable could not exist.
>>
>
> I didn't understand that.

I mean this variable doesn't solve any problem. If one doesn't want Org
syntax to interfere with their contents in any way, then Org mode may
not be the appropriate major mode for the task.

Therefore, I said that, AFAIC, this variable could as well go away. From
my point of view, making it more prominent is counter-productive. 

In the same category, there is `org-export-with-tables'.

By the way, it is already possible to prevent emphasis in a subtree
export:

    * Subtree
    :PROPERTIES:
    :EXPORT_OPTIONS: *:nil
    :END:


Regards,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Allow more export options to be controlled per-subtree
  2017-09-28 19:19     ` Nicolas Goaziou
@ 2017-09-28 19:25       ` Kaushal Modi
  2017-09-30  4:59       ` Kaushal Modi
  1 sibling, 0 replies; 9+ messages in thread
From: Kaushal Modi @ 2017-09-28 19:25 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Amos Bird, emacs-org list

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]

On Thu, Sep 28, 2017 at 3:19 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> I already answered to this problem. Use \star instead of *. It seems
> sub-optimal to prevent any emphasis markup because of a single
> problematic character.
>

OK.


> I mean this variable doesn't solve any problem. If one doesn't want Org
> syntax to interfere with their contents in any way, then Org mode may
> not be the appropriate major mode for the task.
>

I haven't personally needs to set this variable to nil, so I sort of agree
with you.

Therefore, I said that, AFAIC, this variable could as well go away. From
> my point of view, making it more prominent is counter-productive.
>
> In the same category, there is `org-export-with-tables'.
>

Haven't used this one either.


> By the way, it is already possible to prevent emphasis in a subtree
> export:
>
>     * Subtree
>     :PROPERTIES:
>     :EXPORT_OPTIONS: *:nil
>     :END:
>

I didn't know that. This solves all the problems. Thanks.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1911 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Allow more export options to be controlled per-subtree
  2017-09-28 19:19     ` Nicolas Goaziou
  2017-09-28 19:25       ` Kaushal Modi
@ 2017-09-30  4:59       ` Kaushal Modi
  2017-09-30  5:44         ` Amos Bird
  1 sibling, 1 reply; 9+ messages in thread
From: Kaushal Modi @ 2017-09-30  4:59 UTC (permalink / raw)
  To: Amos Bird; +Cc: emacs-org list, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

Hi Amos,

Regarding your question in the other thread, did you try the below
suggestion?

On Thu, Sep 28, 2017, 3:19 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

>
> By the way, it is already possible to prevent emphasis in a subtree
> export:
>
>     * Subtree
>     :PROPERTIES:
>     :EXPORT_OPTIONS: *:nil
>     :END:
>
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 797 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Allow more export options to be controlled per-subtree
  2017-09-30  4:59       ` Kaushal Modi
@ 2017-09-30  5:44         ` Amos Bird
  2017-09-30 12:13           ` Kaushal Modi
  0 siblings, 1 reply; 9+ messages in thread
From: Amos Bird @ 2017-09-30  5:44 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 564 bytes --]

#+OPTIONS: latex:t toc:nil H:3

Hi Kaushal,

I did, it only works if I export the subtree instead of the whole buffer.

Regards,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> Hi Amos,
>
> Regarding your question in the other thread, did you try the below
> suggestion?
>
> On Thu, Sep 28, 2017, 3:19 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
>
>>
>> By the way, it is already possible to prevent emphasis in a subtree
>> export:
>>
>>     * Subtree
>>     :PROPERTIES:
>>     :EXPORT_OPTIONS: *:nil
>>     :END:
>>


--
Amos Bird
amosbird@gmail.com

[-- Attachment #2.1: Type: text/html, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Allow more export options to be controlled per-subtree
  2017-09-30  5:44         ` Amos Bird
@ 2017-09-30 12:13           ` Kaushal Modi
  0 siblings, 0 replies; 9+ messages in thread
From: Kaushal Modi @ 2017-09-30 12:13 UTC (permalink / raw)
  To: Amos Bird; +Cc: emacs-org list, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

On Sat, Sep 30, 2017, 1:44 AM Amos Bird <amosbird@gmail.com> wrote:

> Hi Kaushal,
>
> I did, it only works if I export the subtree instead of the whole buffer.
>
Yes, then I misunderstood. I thought you were trying to export just the
subtree. The EXPORT_* subtree properties apply only when you are exporting
that subtree.

Then it looks like, wrapping the table cell content in ~ is the only way.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 830 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-09-30 12:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-28 17:28 Allow more export options to be controlled per-subtree Kaushal Modi
2017-09-28 18:40 ` Kaushal Modi
2017-09-28 18:47 ` Nicolas Goaziou
2017-09-28 18:59   ` Kaushal Modi
2017-09-28 19:19     ` Nicolas Goaziou
2017-09-28 19:25       ` Kaushal Modi
2017-09-30  4:59       ` Kaushal Modi
2017-09-30  5:44         ` Amos Bird
2017-09-30 12:13           ` Kaushal Modi

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).