* Exporting narrowed subtrees to HTML
@ 2010-06-29 16:34 Bernt Hansen
2010-06-29 17:09 ` Rainer Stengele
2010-07-01 3:20 ` Exporting narrowed subtrees to HTML Matt Lundin
0 siblings, 2 replies; 8+ messages in thread
From: Bernt Hansen @ 2010-06-29 16:34 UTC (permalink / raw)
To: emacs-orgmode
Hi everyone,
I think this has been discussed before and maybe there already exists a
solution to this that I'm unaware of.
I am working in a deeply nested org file and have narrowed to subtree
for the part of the file I'm working on which happens to start at
heading level 5.
I want to export this narrowed subtree to HTML but the first HTML
heading level matches the file instead of starting from heading
level 2. This makes the resulting HTML output not as pretty as it could
be.
Example:
,----[ narrowed to subtree org-file ]
| ***** Level 5 - Interesting stuff - narrow to subtree here
| #+TITLE: test.org
| #+AUTHOR: Bernt Hansen
| #+EMAIL: bernt@norang.ca
| #+DATE: 2010-06-29 Tue
| #+DESCRIPTION:
| #+KEYWORDS:
| #+LANGUAGE: en
| #+OPTIONS: H:10 num:nil toc:nil \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
| #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
| #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
| #+EXPORT_SELECT_TAGS: export
| #+EXPORT_EXCLUDE_TAGS: noexport
| #+LINK_UP:
| #+LINK_HOME:
| #+XSLT:
| ****** Level 6
| ****** Another Level 6
| ******* Level 7
| ******** Level 8
| ******* Level Again
|
`----
Exporting to HTML and only looking at the body part gives this
,----[ body of HTML output ]
| <body>
| <div id="content">
|
| <h1 class="title">test.org</h1>
|
|
| <div id="outline-container-1" class="outline-6">
| <h6 id="sec-1">Level 5 - Interesting stuff - narrow to subtree here </h6>
| <div class="outline-text-6" id="text-1">
|
|
| </div>
|
| <div id="outline-container-1_1" class="outline-7">
| <h7 id="sec-1_1">Level 6 </h7>
| <div class="outline-text-7" id="text-1_1">
|
| </div>
|
| </div>
|
| <div id="outline-container-1_2" class="outline-7">
| <h7 id="sec-1_2">Another Level 6 </h7>
| <div class="outline-text-7" id="text-1_2">
|
|
| </div>
|
| <div id="outline-container-1_2_1" class="outline-8">
| <h8 id="sec-1_2_1">Level 7 </h8>
| <div class="outline-text-8" id="text-1_2_1">
|
|
| </div>
|
| <div id="outline-container-1_2_1_1" class="outline-9">
| <h9 id="sec-1_2_1_1">Level 8 </h9>
| <div class="outline-text-9" id="text-1_2_1_1">
|
| </div>
| </div>
|
| </div>
|
| <div id="outline-container-1_2_2" class="outline-8">
| <h8 id="sec-1_2_2">Level Again </h8>
| <div class="outline-text-8" id="text-1_2_2">
|
|
| </div>
| </div>
| </div>
| </div>
| <div id="postamble">
| <p class="author"> Author: Bernt Hansen
| </p>
| <p class="date"> Date: 2010-06-29 Tue</p>
| <p class="creator">HTML generated by org-mode 6.36trans in emacs 22</p>
| </div>
| </div>
| </body>
`----
So the filename is <h1> and the first headline is <h6>. It looks much
better in the output if the filename is <h1> and the first headline is
<h2>
Is there a way to achieve this now with custom settings?
Thanks,
Bernt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Exporting narrowed subtrees to HTML
2010-06-29 16:34 Exporting narrowed subtrees to HTML Bernt Hansen
@ 2010-06-29 17:09 ` Rainer Stengele
2010-06-29 18:06 ` [PATCH] HTML export: Start the first exported headline at heading level 2 Bernt Hansen
2010-07-01 3:20 ` Exporting narrowed subtrees to HTML Matt Lundin
1 sibling, 1 reply; 8+ messages in thread
From: Rainer Stengele @ 2010-06-29 17:09 UTC (permalink / raw)
To: Bernt Hansen; +Cc: emacs-orgmode
Hi also,
+1
I am also struggling with that problem for a long time and am very
interested in a solution.
At the moment I am copying the subtree to a new temporary org file and
demote the heading level to get the more pretty output.
Looking forward to find a better idea.
Rainer
Am 29.06.2010 18:34, schrieb Bernt Hansen:
> Hi everyone,
>
> I think this has been discussed before and maybe there already exists a
> solution to this that I'm unaware of.
>
> I am working in a deeply nested org file and have narrowed to subtree
> for the part of the file I'm working on which happens to start at
> heading level 5.
>
> I want to export this narrowed subtree to HTML but the first HTML
> heading level matches the file instead of starting from heading
> level 2. This makes the resulting HTML output not as pretty as it could
> be.
>
> Example:
>
> ,----[ narrowed to subtree org-file ]
> | ***** Level 5 - Interesting stuff - narrow to subtree here
> | #+TITLE: test.org
> | #+AUTHOR: Bernt Hansen
> | #+EMAIL: bernt@norang.ca
> | #+DATE: 2010-06-29 Tue
> | #+DESCRIPTION:
> | #+KEYWORDS:
> | #+LANGUAGE: en
> | #+OPTIONS: H:10 num:nil toc:nil \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
> | #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
> | #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
> | #+EXPORT_SELECT_TAGS: export
> | #+EXPORT_EXCLUDE_TAGS: noexport
> | #+LINK_UP:
> | #+LINK_HOME:
> | #+XSLT:
> | ****** Level 6
> | ****** Another Level 6
> | ******* Level 7
> | ******** Level 8
> | ******* Level Again
> |
> `----
>
> Exporting to HTML and only looking at the body part gives this
>
> ,----[ body of HTML output ]
> | <body>
> | <div id="content">
> |
> | <h1 class="title">test.org</h1>
> |
> |
> | <div id="outline-container-1" class="outline-6">
> | <h6 id="sec-1">Level 5 - Interesting stuff - narrow to subtree here </h6>
> | <div class="outline-text-6" id="text-1">
> |
> |
> | </div>
> |
> | <div id="outline-container-1_1" class="outline-7">
> | <h7 id="sec-1_1">Level 6 </h7>
> | <div class="outline-text-7" id="text-1_1">
> |
> | </div>
> |
> | </div>
> |
> | <div id="outline-container-1_2" class="outline-7">
> | <h7 id="sec-1_2">Another Level 6 </h7>
> | <div class="outline-text-7" id="text-1_2">
> |
> |
> | </div>
> |
> | <div id="outline-container-1_2_1" class="outline-8">
> | <h8 id="sec-1_2_1">Level 7 </h8>
> | <div class="outline-text-8" id="text-1_2_1">
> |
> |
> | </div>
> |
> | <div id="outline-container-1_2_1_1" class="outline-9">
> | <h9 id="sec-1_2_1_1">Level 8 </h9>
> | <div class="outline-text-9" id="text-1_2_1_1">
> |
> | </div>
> | </div>
> |
> | </div>
> |
> | <div id="outline-container-1_2_2" class="outline-8">
> | <h8 id="sec-1_2_2">Level Again </h8>
> | <div class="outline-text-8" id="text-1_2_2">
> |
> |
> | </div>
> | </div>
> | </div>
> | </div>
> | <div id="postamble">
> | <p class="author"> Author: Bernt Hansen
> | </p>
> | <p class="date"> Date: 2010-06-29 Tue</p>
> | <p class="creator">HTML generated by org-mode 6.36trans in emacs 22</p>
> | </div>
> | </div>
> | </body>
> `----
>
> So the filename is <h1> and the first headline is <h6>. It looks much
> better in the output if the filename is <h1> and the first headline is
> <h2>
>
> Is there a way to achieve this now with custom settings?
>
> Thanks,
> Bernt
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] HTML export: Start the first exported headline at heading level 2
2010-06-29 17:09 ` Rainer Stengele
@ 2010-06-29 18:06 ` Bernt Hansen
0 siblings, 0 replies; 8+ messages in thread
From: Bernt Hansen @ 2010-06-29 18:06 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Bernt Hansen
* lisp/org-exp.el (org-export):
* lisp/org-html.el (org-export-html-toplevel-to-export):
(org-html-level-start):
Adjust exported heading levels so the first heading is <h2>.
This allows narrow to subtree to be used when exporting part
of a file so you get reasonable heading levels in the resulting
HTML.
---
This patch seems to fix this issue so that the first export heading is <h2> in HTML.
So far this has had very limited tested. Please report back if you have any problems
with it.
This patch is available at git://git.norang.ca/org-mode.git html-export
-Bernt
lisp/org-exp.el | 1 +
lisp/org-html.el | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 54afdac..7a04cce 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -848,6 +848,7 @@ value of `org-export-run-in-background'."
(interactive "P")
(let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background))
subtree-p
+ org-export-html-toplevel-to-export
(help "[t] insert the export option template
\[v] limit export to visible part of outline tree
\[1] only export the current subtree
diff --git a/lisp/org-html.el b/lisp/org-html.el
index 4a6ded4..ef71305 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -253,6 +253,12 @@ document title."
:group 'org-export-html
:type 'string)
+(defvar org-export-html-toplevel-to-export nil
+ "The first heading level found to export. For full file export
+this will normally be level 1 but when you narrow to subtree this
+matches the first heading level we find to export. This controls
+the heading levels in the resulting HTML export.")
+
(defcustom org-export-html-link-org-files-as-html t
"Non-nil means make file links to `file.org' point to `file.html'.
When org-mode is exporting an org-mode file to HTML, links to
@@ -2232,7 +2238,9 @@ When TITLE is nil, just close all open levels."
(aset org-levels-open (1- level) t)
(setq snumber (org-section-number level)
snu (replace-regexp-in-string "\\." "_" snumber))
- (setq level (+ level org-export-html-toplevel-hlevel -1))
+ (unless org-export-html-toplevel-to-export
+ (setq org-export-html-toplevel-to-export level))
+ (setq level (+ (- level org-export-html-toplevel-to-export) org-export-html-toplevel-hlevel))
(if (and org-export-with-section-numbers (not body-only))
(setq title (concat
(format "<span class=\"section-number-%d\">%s</span>"
--
1.7.1.575.gf526
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: Exporting narrowed subtrees to HTML
2010-06-29 16:34 Exporting narrowed subtrees to HTML Bernt Hansen
2010-06-29 17:09 ` Rainer Stengele
@ 2010-07-01 3:20 ` Matt Lundin
2010-07-01 7:07 ` Bernt Hansen
1 sibling, 1 reply; 8+ messages in thread
From: Matt Lundin @ 2010-07-01 3:20 UTC (permalink / raw)
To: Bernt Hansen; +Cc: emacs-orgmode
Hi Bernt,
Bernt Hansen <bernt@norang.ca> writes:
>
> I am working in a deeply nested org file and have narrowed to subtree
> for the part of the file I'm working on which happens to start at
> heading level 5.
>
> I want to export this narrowed subtree to HTML but the first HTML
> heading level matches the file instead of starting from heading
> level 2. This makes the resulting HTML output not as pretty as it could
> be.
If you select the subtree with C-c @ (outline-mark-subtree), it should
export properly:
--8<---------------cut here---------------start------------->8---
<h1 class="title">Level 5 - Interesting stuff - narrow to subtree here</h1>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1">Level 6 </h2>
<div class="outline-text-2" id="text-1">
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2">Another Level 6 </h2>
<div class="outline-text-2" id="text-2">
</div>
<!-- ...and so on... -->
--8<---------------cut here---------------end--------------->8---
Best,
Matt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Exporting narrowed subtrees to HTML
2010-07-01 3:20 ` Exporting narrowed subtrees to HTML Matt Lundin
@ 2010-07-01 7:07 ` Bernt Hansen
2010-07-01 7:26 ` Carsten Dominik
0 siblings, 1 reply; 8+ messages in thread
From: Bernt Hansen @ 2010-07-01 7:07 UTC (permalink / raw)
To: Matt Lundin; +Cc: emacs-orgmode
Matt Lundin <mdl@imapmail.org> writes:
> Hi Bernt,
>
> Bernt Hansen <bernt@norang.ca> writes:
>>
>> I am working in a deeply nested org file and have narrowed to subtree
>> for the part of the file I'm working on which happens to start at
>> heading level 5.
>>
>> I want to export this narrowed subtree to HTML but the first HTML
>> heading level matches the file instead of starting from heading
>> level 2. This makes the resulting HTML output not as pretty as it could
>> be.
>
> If you select the subtree with C-c @ (outline-mark-subtree), it should
> export properly:
Cool! I didn't know about that. It only seems to work if transient
mark mode is enabled (but I have that on already).
I posted a patch for exporting a narrowed to subtree HTML export but it
gives slightly different results from selecting the tree with C-c @ --
the title (<h1>) is the name of the org-file similar to exporting the
entire document.
Thanks for pointing this out -- I'll probably start using C-c @ in the
future.
Regards,
Bernt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: Exporting narrowed subtrees to HTML
2010-07-01 7:07 ` Bernt Hansen
@ 2010-07-01 7:26 ` Carsten Dominik
2010-07-01 7:29 ` Bernt Hansen
0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2010-07-01 7:26 UTC (permalink / raw)
To: Bernt Hansen; +Cc: Matt Lundin, emacs-orgmode
On Jul 1, 2010, at 9:07 AM, Bernt Hansen wrote:
> Matt Lundin <mdl@imapmail.org> writes:
>
>> Hi Bernt,
>>
>> Bernt Hansen <bernt@norang.ca> writes:
>>>
>>> I am working in a deeply nested org file and have narrowed to
>>> subtree
>>> for the part of the file I'm working on which happens to start at
>>> heading level 5.
>>>
>>> I want to export this narrowed subtree to HTML but the first HTML
>>> heading level matches the file instead of starting from heading
>>> level 2. This makes the resulting HTML output not as pretty as it
>>> could
>>> be.
>>
>> If you select the subtree with C-c @ (outline-mark-subtree), it
>> should
>> export properly:
>
> Cool! I didn't know about that. It only seems to work if transient
> mark mode is enabled (but I have that on already).
>
> I posted a patch for exporting a narrowed to subtree HTML export but
> it
> gives slightly different results from selecting the tree with C-c @ --
> the title (<h1>) is the name of the org-file similar to exporting the
> entire document.
The tree uses the first headline as the title of the exported file, and
its children become the top-level sectioning structure. I think this is
the best behavior, and unless you push more I will reject yesterdays
patch.
OK?
- Carsten
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: Exporting narrowed subtrees to HTML
2010-07-01 7:26 ` Carsten Dominik
@ 2010-07-01 7:29 ` Bernt Hansen
2010-07-01 8:12 ` Rainer Stengele
0 siblings, 1 reply; 8+ messages in thread
From: Bernt Hansen @ 2010-07-01 7:29 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Matt Lundin, emacs-orgmode
Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Jul 1, 2010, at 9:07 AM, Bernt Hansen wrote:
>
>> I posted a patch for exporting a narrowed to subtree HTML export but
>> it
>> gives slightly different results from selecting the tree with C-c @ --
>> the title (<h1>) is the name of the org-file similar to exporting the
>> entire document.
>
> The tree uses the first headline as the title of the exported file, and
> its children become the top-level sectioning structure. I think this is
> the best behavior, and unless you push more I will reject yesterdays
> patch.
> OK?
That's okay with me :)
Regards,
Bernt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Exporting narrowed subtrees to HTML
2010-07-01 7:29 ` Bernt Hansen
@ 2010-07-01 8:12 ` Rainer Stengele
0 siblings, 0 replies; 8+ messages in thread
From: Rainer Stengele @ 2010-07-01 8:12 UTC (permalink / raw)
Cc: emacs-orgmode
Am 01.07.2010 09:29, schrieb Bernt Hansen:
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> On Jul 1, 2010, at 9:07 AM, Bernt Hansen wrote:
>>
>>> I posted a patch for exporting a narrowed to subtree HTML export but
>>> it
>>> gives slightly different results from selecting the tree with C-c @ --
>>> the title (<h1>) is the name of the org-file similar to exporting the
>>> entire document.
>>
>> The tree uses the first headline as the title of the exported file, and
>> its children become the top-level sectioning structure. I think this is
>> the best behavior, and unless you push more I will reject yesterdays
>> patch.
>> OK?
>
> That's okay with me :)
>
> Regards,
> Bernt
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
Excellent! Didn't know about that too.
Thanks!
Rainer
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-07-01 8:12 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-29 16:34 Exporting narrowed subtrees to HTML Bernt Hansen
2010-06-29 17:09 ` Rainer Stengele
2010-06-29 18:06 ` [PATCH] HTML export: Start the first exported headline at heading level 2 Bernt Hansen
2010-07-01 3:20 ` Exporting narrowed subtrees to HTML Matt Lundin
2010-07-01 7:07 ` Bernt Hansen
2010-07-01 7:26 ` Carsten Dominik
2010-07-01 7:29 ` Bernt Hansen
2010-07-01 8:12 ` Rainer Stengele
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.