dokufreaks / plugin-include

A DokuWiki plugin for including other wiki pages into the current one.
http://www.dokuwiki.org/plugin:include
GNU General Public License v2.0
62 stars 54 forks source link

Include page section headers display as lower level headlines when below other headers #74

Open eltrkbrd opened 13 years ago

eltrkbrd commented 13 years ago

I'm using DokuWiki release rc2011-05-08 "Rincewind RC2" with the latest version of this plugin (dokufreaks-plugin-include-2011-01-01-2-g5534e4e).

When including a section of another page, DokuWiki always renders the included section as a lower level headline unless it's embedded at the very top of the page (not below any other headers).

For example, if I edit a page and type {{section>wiki:dokuwiki#read_more}} under an H1 or H2 level headline, it inserts the current header and section into the page but only as a lower level headline.

If however, I edit the page and type {{section>wiki:dokuwiki#read_more}} at the very top of the page (with all other headers below it), DokuWiki then correctly renders the page section as an H1 level headline.

Is it possible to simply include the page section and header on the same level as whatever headers it's embedded above or below?

This behavior is important because it also effects how the TOC menu on the DokuWiki page is organized.

Awesome plugin by the way!

Thanks in Advance.

michitux commented 13 years ago

Yes, this is possible using the noindent flag or setting the doindent configuration option to false.

eltrkbrd commented 13 years ago

Thanks for your response.

I tried using the noindent flag as you suggested but it didn't work.

What is the dokuwiki syntax to specify the doindent flag as false?

Also, I didn't see the "noindent" flag as an option at the doku>plugin:include page

Here is my code:

====== Headline ======

{{section>wiki:dokuwiki#read_more&noindent}}

eltrkbrd commented 13 years ago

This bug also affects the latest Dokuwiki Release 2011-05-25 "Rincewind". noindent and nodoindent flags don't work but oddly enough, the noindent flag actually indents an extra tab space; weird...

I also cleared the /data/cache after installing the include plugin as recommended per doku>plugin:include

Awesome plugin however, it would be even better if I could figure this minor bug out though...

Thanks again

michitux commented 13 years ago

I'm not sure your example is suited to see the problem. Here the noindent flag works as expected. When you specify the noindent flag that does not mean that the heading of the section you are including will become a top heading. It means that the heading/indention won't be touched and be like it is on the original page. In your example the noindent flag does shouldn't show any effect as the level on the wiki:syntax page is already the same as on the page on which the include flag is.

On the other hand if the section you are including is originally on a lower level the noindent flag could actually cause an additional indent because it means that the original level will be taken instead of just one level below the current one.

Try this example:

===== Headline ===== {{section>wiki:dokuwiki#read_more}} {{section>wiki:dokuwiki#read_more&noindent}} {{section>wiki:syntax#Headline Level 5}} {{section>wiki:syntax#Headline Level 5&noindent}}

Here I get as heading levels of the included pages:

which is exactly what I expect.

But I think I've maybe misunderstood or not read correctly understood your initial request: You want a feature that you get not the level below the current one but the same level?

eltrkbrd commented 13 years ago

OK, thanks for clarifying with those examples. Now I understand that the behavior I thought was a bug is in fact a feature! :)

To be honest, I wasn't aware of how the syntax for the noindent flag worked (there is no documentation regarding its existence or usage on the doku>plugin:include page.

In answer to your last question, yes, it would be great to have a feature where the section is inserted on the same level instead of below the current one.

How difficult would it be to modify the include plugin to include a page as a Same Level Headline? By using a flag like sameheadline for example?

Then it seems all bases would be covered: default (no flag) - include section as a lower level headline (in other words, indent below current headline level) noindent (flag) - include section at same level as original section headline level sameheadline (proposed flag) - include page at same level headline (inherited from the current page headline level it's being inserted under)

Thanks again!

P.S. There's a typo in your above example, corrected as follows: h3 (one below Headline) h2 (original level) ^h3 (one below Headline) h5 (original level)

zioth commented 13 years ago

I've figured out how to do this (and added a comment to the plug-in page). You can't make an included section header appear as a level 1 header, but you can make it appear as level 2 or lower:

====== My Page ====== === My low-level section === ====== ====== {{section>wiki:dokuwiki#read_more}}

In the above example, the first header in the included section will be a level 2 header. The blank header above it won't be rendered, and won't take up any space in the page, but it will trick the plugin into doing what you want.