ardumont / org2jekyll

Blogging with org-mode and jekyll without alien yaml headers.
GNU General Public License v2.0
71 stars 19 forks source link

Respect org-mode option regarding toc generation #38

Closed yefeiyu closed 4 years ago

yefeiyu commented 8 years ago

1, I open the toc:nil to toc:t in #+OPTIONS: H:2 num:t tags:nil toc:t timestamps:t. 2, org2jekyll-publish 3, The result of the file **.html 's head is wrong . Please help me fix it, thank you

<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1. wanna</a></li>
<li><a href="#sec-2">2. but</a></li>
</ul>
</div>
</div>

---
layout: post
title: abdc
date: 2016-04-29
categories: 
-
tags: 
-
author: yefeiyu
excerpt: 

---

<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> wanna</h2>
<div class="outline-text-2" id="text-1">
<p>
I want to use `toc:t`<br >
</p>
</div>
</div>

<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> but</h2>
<div class="outline-text-2" id="text-2">
<p>
&#x2026;<br >
</p>
</div>
</div>
ardumont commented 8 years ago

Good catch. Indeed. It might be because the toc generation is done after the org-publish step.

Hummm. This may also mean that the yaml header generation should take place after the toc generation... If those assertions are correct, the implementation should change as well.

Hint: Using org-publish-after-publishing-hook to trigger the yaml header generation? This could simplify the current implementation which manipulates an org-mode buffer copy to add the yaml and then publishes the org-mode file.

yefeiyu commented 8 years ago

I am depressed for what I couldn't find the hook of org-publish-after-..., and didn't know how to use them. Will You fix it in some day?

ardumont commented 8 years ago

Yes, i intend to. I tagged it as a bug for that purpose.

The hint (hook) was for me as a reminder and as a possible implementation improvment. But this is all theoretical for now.

Cheers, On Sun, May 1, 2016, 3:03 PM yefeiyu notifications@github.com wrote:

I am depressed for what I couldn't find the hook of org-publish-after-..., and didn't know how to use them. Will You fix it in some day?

— You are receiving this because you commented.

Reply to this email directly or view it on GitHub https://github.com/ardumont/org2jekyll/issues/38#issuecomment-216040765

ardumont commented 8 years ago

Also, I found the emacs' doc about hooks quite good to explain what those are. Also they present some examples on how to use them.

The doc on my emacs about the hook i mentioned:

org-publish-after-publishing-hook is a variable defined in `ox-publish.el'.
Its value is nil

  This variable may be risky if used as a file-local variable.

Documentation:
Hook run each time a file is published.
Every function in this hook will be called with two arguments:
the name of the original file and the name of the file
produced.
ardumont commented 8 years ago

When shall we soluted this bug? :-)

@yefeiyu I think #29 and this one are the same.

The fact that org-toc works tends to validate the hypothesis about the generation time. org-toc does generate the toc in org-mode, so prior to any publishing step.

As for the time to fix it... Right now, i just don't have any. And this is not, a priori, a small fix.

Any help is appreciated though.

Cheers,

ardumont commented 4 years ago

I finally fixed that behavior. And having the toc generated alongside the post (without any external tool) is awesome.

So thanks for the report.

ardumont commented 4 years ago

This got released in 0.2.2.

Thanks to your report, we now should be even more able to respect the user's org-mode setup options.

As it's been open for long, i don't really expect feedback on this one. So I'll just close it.

Feel free to reopen though if the issue remains.

Cheers,