howdy,

I use my drupal 6.13 site as a wiki, I have no use for summaries/teasers, etc...

I'm driving myself a little nuts here... I recently upgraded from TOC module from 2.2 -> 2.3, and started to notice strangeness with messages like so "A split summary was automatically created as site settings don't allow Table of Contents in summaries." and "Your summary was split from the body as site settings don't allow Table of Contents in summaries."

I then found this issues page = http://drupal.org/node/422144
I followed the suggestions from others there ^^^^^^^^^^^

Admin => Content Management => Post Settings => Length of trimmed posts: Unlimited
Admin => Site Configuration => Input formats => [Input Format Wiki] => Configure => TOC module selected ... => Configure => "Remove Table of Contents tags from teasers" is UNCHECKED, "Whether an automatic table of content should be added:" is "Do not automatically add a table of contents"

I kept seeing those messages anytime I would edit a node (that has Wiki input format w/TOC enabled), and make sure there was a <!--tableofcontents list: ul;minlevel: 1;maxlevel:5;--> section to call TOC... but I kept getting those messages "A split summary was automatically created as site settings don't allow Table of Contents in summaries." and "Your summary was split from the body as site settings don't allow Table of Contents in summaries."

Im under the impression I have teasers fully disabled? I don't have any desire to use teasers... so now that whenever I or any site user goes to edit a "wiki" node, #1 we see that there is now a summary/teaser, which requires us to manually each edit to click the button "Join Summary" which seems to disable the Teaser, and then #2 we have to add the TOC code <!--tableofcontents list: ul;minlevel: 1;maxlevel:5;--> again, and we notice some weird shit with there being TONs more data added to the node (I.e. the data is duplicated... I think this is happening once we click "split summary at cursor").

I then followed all steps @ http://drupal.org/project/tableofcontents and upgraded to TOC 3.1 (indeed I did remove the TOC directory before upgrading)... same story, I think a little different verbage now = EVERYTIME I add the TOC code <!--tableofcontents list: ul;minlevel: 1;maxlevel:5;-->, save the node, I get the message "The summary (teaser) was automatically split from the body as site settings does not allow table of contents in summaries. If you make any further changes, be sure to check the summary field to see if your changes apply there as well".
That then shows the Table of Contents when viewing the node normally, but once you goto edit it, I now again have a teaser/summary?? If I edit the node, "join summary", remove duplicate data, REMOVE any TOC code - i.e. <!--tableofcontents list: ul;minlevel: 1;maxlevel:5;--> - save it, I have NO PROBLEMS, I never see the summary/teaser again! but this solution does NOT allow me to use TOC! =(

what am I doing wrong? what is the proper way to completely disable teasers in my site, and make it so I can have a Table of Contents in my Wiki nodes like earlier TOC 2.2 usage? I really have no desire to see use summaries/teasers, nor see that message "The summary (teaser) was automatically split from the body as site settings does not allow table of contents in summaries. If you make any further changes, be sure to check the summary field to see if your changes apply there as well"... little help, purty please? =)

agentdcooper

CommentFileSizeAuthor
#25 Screen shot 2010-04-19 at 7.54.27 PM.png97.42 KBkentr

Comments

AlexisWilke’s picture

Agentdcooper,

So you played with this flag and it made no difference either way? (And I assume the Automatic feature was turned off)

'remove table of contents from teasers'

Thank you.
Alexis

agentdcooper’s picture

thanks much for the reply alexis! to answer your question, YES =(

I gave this a shot... viewed a page that I created with older version of TOC and was working perfectly, (remove table of contents from teasers = set to CHECKED) - upon clicking edit, and making adding a single character to the body, and saving my page - I get the message "The summary (teaser) was automatically split from the body as site settings does not allow table of contents in summaries. If you make any further changes, be sure to check the summary field to see if your changes apply there as well."

going back into EDIT on this page, sure enough there is now a teaser there, even though my site shouldnt even be using them...
so I revert back to the original version prior to my edit (I have revision module!), and again that message comes up = "The summary (teaser) was automatically split from the body as site settings does not allow table of contents in summaries. If you make any further changes, be sure to check the summary field to see if your changes apply there as well"! so even reverting back, it is modifying my reverts to now use a teaser (I have 2 seperate areas to edit the content on the EDIT page now - the teaser, and main content area... and a "join summary" button that seems to remove the teaser, only until I save it, and it comes back again).

UNCHECKING 'remove table of contents from teasers' and going thru the same process, the SAME THING happens! I think this may be a bug?

I love the changes, and the progress of the TOC module - but this is something that I can fix right? am I doing something wrong? everything worked with the older version of TOC (maybe I should revert? which I'd rather stay up-to-date honestly).

any other suggestions someone could throw my way?

AlexisWilke’s picture

The code that adds the [toc] node in the teaser is triggered if the following is TRUE.

My guess would be that the name ('tableofcontents_remove_teaser_' . $node->format) is somehow wrong (i.e. $node->format is not what we would expect, or something of the sort.)

if (variable_get('tableofcontents_remove_teaser_' . $node->format, TRUE)) { ... }

This is the flag named "Remove Table of Contents tags from teasers" in the interface.

Thank you.
Alexis

agentdcooper’s picture

AlexisWilke, again thanks for the help mate! I'm just not sure what u are suggesting here? What would be the way forward, in hopes of dropping support (the usage AT ALL) of teasers... so I can make 100% sure that this teaser will not get created/added even tho I have them disabled?

thanks for all help! I look forward to licking this!

AlexisWilke’s picture

Agentdcooper,

What I mean is that if the flag 'remove table of contents from teasers' is set to FALSE (i.e. not checked) then there is no way the code can do anything to your teaser since it does not call the very function that does the work.

So if you're saying that it does anyway, I'm not too sure what's going on with your system. Other than maybe the flag is not saved in the database (in which case, when you go back to your setup, the flag should be selected [checked] again.)

One other thing could be that you change the setup for Filter A and are using Filter B in your test node?

Thank you.
Alexis

agentdcooper’s picture

I will give your suggestions a go - thanks for the help! I'll report back my results

agentdcooper’s picture

Status: Active » Closed (fixed)

turns out I was confusing content type with input format!! I only set ONE input format with 'remove table of contents from teasers' as FASLE... my test node was being edited with the OTHER input format, hence my problem. all is good, sorry to even open this. thanks so much for the help - this is my own idiocy =)

kentr’s picture

Wasn't sure if this should be in a separate issue. Different question about the same thing.

I do want summaries, but don't want users to have do deal with the split summary when editing. Seems like it would be possible to eliminate the split summary when the filter is in automatic mode. Any ideas what code I would modify to get rid of the summary splitting, and would you consider it for inclusion?

kentr’s picture

Status: Closed (fixed) » Active
AlexisWilke’s picture

You already have a flag, named:

  Remove Table of Contents tags from teasers

which when unchecked makes the handling of the teaser disappear.

I don't think we need more than that.

See: tableofcontents/tableofcontents.module line 128

Thank you.
Alexis Wilke

kentr’s picture

Yeah, I've been tracing through that code for much of the day, and I haven't quite understood the process.

It sounds like you're suggesting unchecking the "Remove the TOC from the teaser" flag. But unchecking it results in the TOC appearing in the teaser.

So, I do want to remove the TOC from the teaser. But as far as I can see, checking that setting also triggers the split summaries (the extra summary text at the top of the "Body" field during editing).

The split summaries are a UI mess and add unnecessary complexity to the editing process. It's also counter-intuitive, because the split summary is not specifically requested by the user (I'd call it "unexpected behavior" inconsistent with the Drupal standard behavior).

BTW, I am aware that I can eliminate the split summary by setting the "Post settings" as described above, but I want automated summaries - just not injected as extra text into the post edit form...

I can't figure out where exactly in the code the extra summary text is getting added to the node body.

AlexisWilke’s picture

Kent,

Okay, got it 8-)

That's a Core feature, not a tableofcontents editor feature.

So even if you were to provide a patch, it would not work in this very module. Now I could put the patch along the module for people to install if they wish to do so.

Anyway...

modules/node/node.modules line 1530 (in v6.14) says: node/%/edit calls node_page_edit() in node.pages.inc

/**
 * Menu callback; presents the node editing form, or redirects to delete confirmation.
 */
function node_page_edit($node) {
  drupal_set_title(check_plain($node->title));
  return drupal_get_form($node->type .'_node_form', $node);
}

And that makes me think, we may be able to short cut the showing of the teaser using the hook_form() callback. Then make sure the teaser gets added on the node_validate() or wherever we need to do that...

This could actually be a module by itself instead of being part of the table of contents module since others may benefit from the feature without the need/requirement to use the table of contents.

Thank you.
Alexis Wilke

AlexisWilke’s picture

Another idea...

Since you're interested in the automatic teaser only, we should DELETE the teaser on Edit. How to do that, not too sure, but I would think that whenever you catch the node form, you can delete the teaser value. Then the editor will not show a teaser and the Save will re-generate a new teaser as required (with the new text, the [toc hidden:1], etc.)

Does that sound like a good solution to you?

Thank you.
Alexis Wilke

kentr’s picture

Alexis,

Thanks for your help on this. Right now I'm having trouble getting an automatic table of contents at all, so I've been unable to test this theory.

My thought on deleting the teaser from the body during editing is that it would be problematic when the user actually wants a split teaser, combined with automated TOC mode, combined with "Remove TOC from teaser" flag.

If I recall correctly, the appearance of the teaser in the node edit form began when I set the TOC "Remove from teaser" flag, so I was under the impression that something in the module was triggering the core function. From my memory of looking at the code and the results, I'm guessing this is so that [toc hidden:1] can be explicitly placed in the teaser only. Did I understand this correctly? So if I am getting this right, I was hoping that somehow the triggering of the core function could be prevented when TOC is in automatic mode.

I know that there's also the problem that if the [toc] tag is too high in the body, then it will be processed by the input filters during the core automated teaser generation. To solve this, I thought of post-processing the teaser during the display phase with the hook_nodeapi() to remove the rendered TOC code.

I know it's not great programming practice to add the TOC then remove it immediately, but given the limitations of hook_filter(), there's no good way to keep it from getting into the teaser in the first place. The performance hit is somewhat offset by the core caching for input filters. I think performance can be improved a little more by page caching.

AlexisWilke’s picture

The "Remove TOC from teaser" indeed forces the generation of a teaser and sticks the [toc hidden:1] in there. The problem with D6 is that you do NOT know whether you are filtering a teaser or a plain node (or a block, or a term description, or whatever else you'd have a chance to filter.)

One solution I used is to create a CCK field called Teaser and use that as the teaser (which means you want to use the views if you want lists with teasers.) That works great, I do it for one of my websites:

  http://new.m2osw.com/news

On that page you see the regular teaser on the left and the CCK teaser on the right (in the LATEST NEWS box.) As you can see they are not the same. The LATEST NEWS box uses a shorter version that fits well in the box. The regular teaser is "much" bigger.

So if we had an option to remove the regular teaser on Edit, then re-generate it, and you add a CCK field named Teaser, you'd be there. The only "problem" is that the teaser box will always appear (although you can put it in a group and hide it by default.) Now that teaser should not be affected by the [toc] system so it should all be perfect... 8-)

Does that sound like a solution?
Alexis

TheGuardian’s picture

I actually want teasers for my blog entries promoted to the main page, but I have no interest in their use on regular pages.

What I was seeing is that when it is saving and throwing up the "split from the body" message, all of my content was completely deleted. All that existed afterward was the teaser, period.

Needless to say, this is not a graceful failure mode, and it created a great deal of yelling at the screen and whatnot.

Following some of the recommendations on this thread and elsewhere, I think the problem is rectified, but my blood pressure may never recover. I would recommend some further documentation note regarding this teaser issue.

Thanks for the great module!

AlexisWilke’s picture

My sorry for your blood pressure and especially the poor screen & monitor.

So... does it mean you did not lose anything?

The problem is in Drupal Core. It does NOT tell you whether you are filtering a body, a teaser, a block, a view, a whatnot. I guess it makes sense, but on the other hand, it prevents you from managing special cases properly. If you have a solution, I'll be glad to look into it.

Thank you.
Alexis

kentr’s picture

How about doing the filtering in hook_nodeapi() instead of hook_filter()? Then the code would know it's processing a teaser, I think. Looks like that might be how http://drupal.org/project/htmLawed lets you forgo filtering in the teaser.

Anyway, I think I'm going to do something like filter out the code at the theme level to get around this.

AlexisWilke’s picture

The filters are used for everything you can imagine. There are nodes, blocks, whatnot module that has a buffer that needs to be filtered. For instance, I have my MO References module that let you put a static website in your Drupal site (i.e. your Doxygen documentation. The static pages will be filtered to make sure they are safe. If you wrote those pages, you may use your Full HTML, otherwise you probably want something a bit safer.

This being said, maybe we could have both methods working. After all, you probably rarely want to create a TOC for a block. 8-)

I'll have a quick look at that htmlLawed module to see whether it would be easy to implement something similar. And they may have a solution to that Teaser issue that works inside filters...

Thank you.
Alexis

aren cambre’s picture

Subscribe. Also running into this problem.

EDIT: Disregard. Found where I can shut this off entirely.

AlexisWilke’s picture

I'm waiting for a patch... 8-)

Although, I don't think one is necessary, using the hook_nodeapi() could be a solution and there could be a global flag that let you choose the hook to use.

AlexisWilke’s picture

Version: 6.x-3.1 » 6.x-3.x-dev

Okay, I implemented something in hook_nodeapi() as mentioned here. This is part of the 3.x-dev for now. And it may be a bit complicated to setup, but it works (more or less... it won't work in Views, Insert Node, etc. because the nodeapi function is not always called in all of those cases.)

If anyone has the time to test this, I'd appreciate some feedback.

Important note:

Make sure you either don't turn on the auto-toc feature or make use of [vtoc]. Also, the idea is to remove the auto-teaser generation. Do so by deselecting the "Remove Table of Contents tags from teasers" checkbox.

Thank you.
Alexis Wilke

kentr’s picture

StatusFileSize
new97.42 KB

Thanks so much for this work.

Make sure you either don't turn on the auto-toc feature or make use of [vtoc]. Also, the idea is to remove the auto-teaser generation. Do so by deselecting the "Remove Table of Contents tags from teasers" checkbox.

Perhaps I misunderstood. I only get the TOC when I select "If no [toc...], automatically add one..." in the input filter configuration.

If I set that option to "Do not automatically add...", I don't get a TOC.

Edit: On the content type settings, it's set to "No table of contents", and "Remove table of contents from the teaser" is deselected.

Screenshot attached of settings that don't work.

My content contains eight (8) <h2> tags, so by my estimation it should pass the threshold for automatic generation.

AlexisWilke’s picture

kentr,

In your case, you want to change the selection to "If no [toc ...], automatically add one". That way you'll get a toc automatically. And since you did not select the "Remove table of contents from teaser", it won't automatically add a [toc hidden;] in the teaser.

Plus, if you don't use the teaser, you should be fine!

If you'd rather, you can define the table of content in the node type. But that can be cumbersome for pre-existing websites...

Let me know if changing your Input format is enough.

Thank you.
Alexis

s4j4n’s picture

Thanks for a wonderful module. TOC is really great.

I was wondering why this extra text would always show up in my WYSIWYG (I'm using TinyMCE) right above a [toc hidden:1] tag on any subsequent edits of content for a page. Then I read this post and learned it's called a teaser.

Perhaps by default you could have teasers turned off and just have a check box that says - Create Teasers.

If you check it Teasers are created - otherwise no teasers are created.

This would really make things much more simple.

The "Remove Table of Contents tags from teasers" description is quite confusing to me. Sounds like if I in fact check that box it should remove the extra stuff - where in fact you want to check it to remove the teaser from your node so you don't have to see it in your wysiwyg.

Curious... those of you who have teasers turned on... you don't mind having the teaser show up in your wysiwyg? Unless you have a way to hide it, isn't that kinda horrible for your end users? If you hide it some how... how do you hide it in the wysiwyg?

Just to be clear, with Teasers on (i.e. "Remove Table of Contents tags from teasers" is checked) - I enter this new content:

<p>Here's some text...</p>
<h1>Heading 1</h1>
<p>Lorem ipsum dolor sit amet.</p>
<h1>Heading 2</h1>
<p>Lorem ipsum dolor sit amet.</p>

And when I edit that content a subsequent time you will see HTML like so in the WYSIWYG:

<p>Here's some text...</p>
<h1>Heading 1</h1>
<p>Lorem ipsum dolor sit amet.</p>
<h1>Heading 2</h1>
<p>Lorem ipsum dolor sit amet.</p>
<div>[toc hidden:1]</div><!--break-->
<p>Here's some text...</p>
<h1>Heading 1</h1>
<p>Lorem ipsum dolor sit amet.</p>
<h1>Heading 2</h1>
<p>Lorem ipsum dolor sit amet.</p>

I copied that from the source view, but the wysiwyg view reflected and showed the same ... albeit styled.

AlexisWilke’s picture

Although this module may create a teaser for you, the fact that there is an explicit teaser or not is not dependent on the Table of Contents module.

If you create a new story (i.e. "promote to front page" is turned on) then going to:

  http://www.example.com/node

will show the teaser of that new story. No matter whether you have this module or not, nor whether you created an explicit teaser.

The problem is that at the point the module is asked to transform the [toc] tag, the module has no clue whether it is working on the full page or just the teaser. This is because the module uses a filter and filters are not kept informed of anything more than the text they have to transform. This makes sense since it could be used for the body, the teaser, a block, an email, etc.

The one way I partially solved the problem (with an idea from someone else) is by applying the filter on the node content when the node is being displayed (i.e. node_view() call being altered) but there are other problems with that method. In any event, that allows you to know when the teaser is being created and skip that case without having to create a [toc hidden:1;] entry.

Although a [toc] tag is certainly only necessary in a node body, it could be useful in a CCK field. I started to work on Drupal 7 a little bit, and I hope there is a better solution in that next version...

In regard to the WYSIWYG view of the teaser, note that the teaser can be completely different from the start of the rest of your node. The FCKeditor shows a red line where the <!--break--> appears.

Thank you.
Alexis