Closed (fixed)
Project:
Table of Contents
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2010 at 01:27 UTC
Updated:
23 Oct 2012 at 03:44 UTC
Jump to comment: Most recent file
Comments
Comment #1
Vc Developer commentedSubscribe
Comment #2
AlexisWilke commentedI do not intend to do the upgrade. But if someone wants to do it, I'll gladly give him/her access. 8-)
Thank you.
Alexis
Comment #3
aren cambre commentedAre there alternatives to this module?
Comment #4
AlexisWilke commentedNot that I know of. Although there are modules to support wiki's and it could be that one of them includes a table of contents.
Comment #5
binford2k commentedsubscribe
Comment #6
bigdave commentedsubscribe
Comment #7
mhaudenschild commentedsubscribe
Comment #8
AlexisWilke commentedComment #9
WorldFallz commentedway back i worked on the code for v2 of this module-- i'm happy to comaintain it. However, i can't make any firm commitment on the d7 version-- i've only just begun converting my modules.
Comment #10
AlexisWilke commentedWorldFallz,
The code has changed quite a bit since then... 8-)
If you think you can create a version and post a tarball here, then we can have others test that first. Then if it works well, have you become a co-maintainer and check the code in.
Thank you.
Alexis
Comment #11
WorldFallz commentedsounds good-- I should have time to give it shot this weekend.
Comment #12
thomasvdv commentedsubscribe
Comment #13
mo6Subscribe. I can help porting this module to D7.
Comment #14
AlexisWilke commentedGeorge,
You may want to contact WorldFallZ directly to see whether he's done some work on this so far.
Once one of you has a version that runs on D7, post a tarball or zip file here so others can test.
Thank you.
Alexis
Comment #15
stclaird commentedsubscribe
Comment #16
xenyo commentedSubscribe +
Comment #17
dooug commentedSubscribe. Thanks for the good work!
Comment #18
SanDiego commentedsubscribe
Comment #19
d.olaresko commentedI ported TOC module to drupal7. please check it. (patch for release version)
Comment #20
d.olaresko commentedCorrected patch attached. Works for branch 6.x-3.x.
git clone --branch 6.x-3.x http://git.drupal.org/project/tableofcontents.git
Comment #21
shadowmihai commentedsubscribe
Comment #22
d.olaresko commentedNew patch. Fixes
Comment #23
mrsinguyen commentedsubscribe
Comment #24
dwhutton commentedsubscribe
Comment #25
bensnyder commentedsubscribe
Comment #26
silurius commentedSubscribe
Comment #27
webankit commentedI tried to apply it to git head version but failed both20&22...
Comment #28
AlexisWilke commentedDid you do the following as stated in #20?
git clone --branch 6.x-3.x http://git.drupal.org/project/tableofcontents.git
Comment #29
webankit commentedi tried doing patch -po< patch_filename earlier
but was succesful when i did git apply
Comment #30
webankit commentedRecoverable fatal error: Object of class stdClass could not be converted to string in tableofcontents_filter_tips() (line 59 of /home2/unitinga/public_html/spicmacay/demo/sites/all/modules/tableofcontents/tableofcontents.module).
Comment #31
webankit commented@dolar4ik: plz look into #30
Comment #32
d.olaresko commented@ babbar.ankit: I`m not a maintainer. When I have a free time I will look on it but you need to ask maintainer to fix this problem I think
Comment #33
JohnnyX commentedA Drupal 7 release would be great!
Subscribe
Comment #34
tobias commented+1
Comment #35
webankit commentedResolved #30 ...
plz test
Comment #36
DnaX commentedOn node display (with [toc]):
Notice: Trying to get property of non-object in _tableofcontents_replace_toc() (linea 667 di /home/web/santmart/public_html/sites/all/modules/tableofcontents/tableofcontents.pages.inc).
No TOC displayed.
Comment #37
marcoka commentedsubscribe
Comment #38
marcoka commentedi chose to autogenerate the TOC, i get:
* Notice: Use of undefined constant filter_toc - assumed 'filter_toc' in tableofcontents_filter_FILTER_tips() (line 58 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.module).
* Notice: Use of undefined constant filter_toc - assumed 'filter_toc' in tableofcontents_filter_FILTER_tips() (line 58 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.module).
also i could not fully apply the patch with "patch -p1 < patch.patch" it got some problems with both info files and on 295 in the tableofcontents.module. corrected that manually.
no toc is beeing displayed
if i try to use the block:
Notice: Trying to get property of non-object in _tableofcontents_replace_toc() (line 668 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.pages.inc).
Comment #39
chapatt commentedI got basically the same result as #38. I can't wait for a working version. I'm trying to migrate to D7 and use this for wikis. Thanks!
Comment #40
dwalker51 commented+1
Comment #41
Jean Gionet commented+1 subscribe
is it still possible to apply any of these patches to make it work with D7? If so, what are the exact steps/order to do so?
I've tried every possible combination and haven't been able to apply any of these patches.
thanks
Comment #42
AlexisWilke commented#35 should be after the latest changes as viewable here:
http://drupalcode.org/project/tableofcontents.git/commit/b9b8d9b
Comment #43
Jean Gionet commentedno luck :(
ran this first:
git clone --branch 6.x-3.x http://git.drupal.org/project/tableofcontents.gitthen:
Comment #44
mdm commentedI've rolled up the previous patches and applied them to the most recent code from the 6.x-3.x branch. I've also made a few tweaks to fix the above "Trying to get property of non-object" error, and I've refactored the _tableofcontents_replace_toc function because function parameters with default values should always go at the end of the parameter list. Otherwise, you have to specify the value every time you call it anyways and it defeats the purpose of having a default.
***PLEASE NOTE THIS PATCH STILL DOES NOT MAKE TABLE OF CONTENTS WORK ON DRUPAL 7.***
But the problem I'm running into now is that I don't understand the way part of the module works. In my case, I'm getting to line 765 of tableofcontents.pages.inc ok, then _tableofcontents_headers is called. In that function we have this on line 276 (all line numbers are post-included-patch):
No value ever gets put in this array, and when we return to _tableofcontents_replace_toc we get to line 780 which says:
So since we never did anything with that $toc->headers array, it's empty here, count() returns 0, and _tableofcontents_replace_toc returns a blank string. What is that array supposed to have in it and why are we checking it?
Comment #45
AlexisWilke commentedThe $toc->header is the list of HTML headers found in your page (H1, H2, ... H6). If none are found, we just cannot generate a table of contents.
There are many reasons why this would happen. Verify that the $text is indeed the content of your page and that there are some headers and that the headers present in your text are accepted (i.e. you may only access H3 and H4 and not have any of those in your text.)
Thank you.
Alexis
Comment #46
mdm commentedThanks Alexis.
Following your explanation, I set my text filter to Full HTML and started getting error messages: one about a non-existent array index "render element" in theme.inc line 824, and one about array to string conversion in tableofcontents.pages.inc line 839. To solve the first problem, I wrapped $output in an array when passing it to theme() on line 1028 of toc.pages.inc:
theme() expects $variables to be an array, and we were passing a string to it, which made from problems later on. To solve the second problem, I changed theme_tableofcontents_toc_text in toc.pages.inc to:
Since we're passing in $variables from theme(), this returns an array and was the cause of the illegal array to string conversion. After doing this, I've got a working TOC on my Drupal 7.2 site. I've attached a patch against the latest 6.x-3.x branch, hope it works for everyone else too!
Comment #47
marcoka commentedapplied patch
patch -p1 < tableofcontents-d7-upgrade-902564-45.patch
Result
Recoverable fatal error: Object of class stdClass could not be converted to string in _tableofcontents_replace_toc() (line 682 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.pages.inc).
i foxed that somehow....you do
if (variable_get('tableofcontents_hide_table_' . $format, FALSE)) {
and $format is an object.
after fixing that it does not really work. enabled in the text format, chose create auto TOC on top...nothing
Comment #48
webankit commentedOn saving content if body is empty
Notice: Undefined property: stdClass::$body in tableofcontents_node_presave() (line 176 of sites/all/modules/tableofcontents/tableofcontents.module).
Notice: Undefined property: stdClass::$body in _tableofcontents_hide_in_teaser() (line 409 of sites/all/modules/tableofcontents/tableofcontents.admin.inc).
Comment #49
AlexisWilke commentedI just did an update of the 6.x version to support the target attributes in links.
It would be easier for the people offering a potential D7 version to offer a .tar.gz or .zip instead of patches...
Thank you.
Alexis Wilke
Comment #50
Jean Gionet commentedyes please! Can somebody ZIP/TAR.GZ a completely patched/working D7 version! thxs
Comment #51
mdm commentedThis tarball is the 6.x-3.x codebase with patches #22, #35, #44, and #46 applied. The problem mentioned in #47 should be fixed here too. I've also changed the function signature of _tableofcontents_process to:
and removed the default $filter value from the function signature of _tableofcontents_replace_toc. All calls to _tableofcontents_process should reflect these changes. The reason I've done this is explained in #44. This module works for me on 7.2, it might not work for you. I propose that a 7.x branch should be created in the git repository so we can import what we've got so far and continue work on it there. Then an actual 7.x dev snapshot can be put up on the project's main page so it's more readily apparent that work is being done on a 7.x version. Just my $0.02.
Comment #52
marcoka commentedi downloaded the module, replaced the old one.
still: Recoverable fatal error: Object of class stdClass could not be converted to string in _tableofcontents_replace_toc() (line 682 of /var/www/WORKSPACE_DRUPAL/drupalwiki7/sites/all/modules/tableofcontents/tableofcontents.pages.inc).
anyone tested it on a complete clean install and can report? i will try that one on a completely clean install this weekend.
Comment #53
Jean Gionet commentedThxs for the file and patches!
I just installed it on my 7.2 install and didn't get any errors. I enabled the module and adjusted my Text formats to apply this filter, however it doesn't seem to be working/loading. Also, I don't see any option to ADD a ToC to a page/node manually.
Comment #54
AlexisWilke commentedmdm,
Would you like to become the D7 maintainer?
So far, I've seen many people saying it wasn't working for them so I don't see the point in creating a D7 version. I'll do it only if enough people say it works for them because I do not plan in maintaining D7 myself.
Thank you.
Alexis
Comment #55
fpahl commentedsubscribe
Comment #56
marcoka commentedtested on a clean drupal 7.2, no errors but no display too:
tag depth has ben set to 2
tags do not work
http://screensnapr.com/v/3uFLhb.png
without tags and auto add
http://screensnapr.com/v/JZAN2D.png
Comment #57
marcoka commentedreturned again after some debugging.
@mdm, i bet you use the BLOCK, because the block works. But the normal TOC also gibes the ability to add a TOC on the bottom/top of a node automatically, WITHOUT a block.
I think your port is not complete and only for the block, could that be?
http://screensnapr.com/v/REZ0KY.png
Comment #58
mdm commented@AlexisWilke sure, I'd love to maintain a D7 version of TOC :)
@e-anima I haven't specifically set TOC to use a block, but it's calling TOC's block functions and creating one at the top of my nodes. In fact, when I configure my Full HTML text filter at /admin/config/content/formats/full_html, the Table of Contents checkbox isn't checked...however my TOCs are being generated using that filter...so that seems odd to me...
Comment #59
marcoka commented@mdn, you did not check the "TOC" checkbox in the filter settings?
Comment #60
mdm commented@e-anima correct, however the TOCs are still working on nodes that contain [toc] tags, so something's not right. Here's my testing set-up:
Relevant portion of /admin/config/content/formats/full_html: http://i.imgur.com/wSssv.png
TOC block from a node page: http://i.imgur.com/0XUQp.png
Here's the TOC tag from that node:
Unless I'm completely misunderstanding the filter configuration (a distinct possibility!), I shouldn't have any TOCs appearing while that checkbox is unchecked, but there it is.
Comment #61
AlexisWilke commentedmdm,
There are 3 possibilities for the table of contents to appear:
(1) The block as mentioned
(2) The filter as shown in one of your images (although in your case it isn't set.)
(3) The node type (Administer » Content management » Content type)
I guess you have (3) active because otherwise the [toc] would not be transformed.
Option (3) is good if you want to make sure you don't get the [toc] transformed in teasers (i.e. (3) has the possibility to detect whether the node is shown as a page or as a teaser.)
From what I understand, also, (1) still has problems and can generate double numbering. I'd like to fix that at some point...
Thank you.
Alexis Wilke
Comment #62
AlexisWilke commentedmdm,
You should have access to git and the necessary options in the project to add a new release.
The default instructions are really good, go to the project page and see under "Git instructions". You will have to create the D7 branch first. Let me know if you need some help with getting started.
Thank you.
Alexis Wilke
P.S. one more thing... as a maintainer, you should add the "Contact" feature in your user account so people can contact you directly if needed (i.e. security issues, etc.)
Comment #63
mdm commented@AlexisWilke Thanks. I've created a 7.x-1.x branch in git and committed the code from the tarball I posted here. I tried posting a dev snapshot release, but I couldn't figure out how to attach the tar.gz/zip files.
I'm still working on getting the TOC to work through text filters and content types, if anyone else has any patches against 7.x-1.x, they're very welcome! :)
Comment #64
AlexisWilke commentedmdm,
At the bottom of the project page, you have an Administer Releases. When you click on that link, a page appears with 7.x-1.x-dev at the top and you have two checkboxes. The "Show snapshot release" flag is the one that will display the 7.x-1.x-dev version on the front page (it is already visible in the releases page, but that's quite hidden...)
Thank you.
Alexis
Comment #65
marcoka commentedthe toc block is not working correctly too,
http://screensnapr.com/v/Lu5KAc.png
see screenshot, the first h1 tag is not in the toc, the second is.
"Install" is missing
Comment #66
AlexisWilke commentede-anima,
By default the toc starts with H2 and goes up to H4.
You can change the defaults in the settings.
Thank you.
Alexis
Comment #67
marcoka commentedactivated numbering in the TOC block:
http://screensnapr.com/v/8BbyOv.png
its seems that the output is not a field its the whole array itself. "array"
Comment #68
AlexisWilke commentede-anima,
Yeah... that looks like a bug in the block display code.
Would you mind to open a new issue for that problem as this issue was about getting an actual version 7.x out the door.
Thank you.
Alexis Wilke
Comment #70
AlexisWilke commentedmdm,
There are issues being posted in regard to 7.x not working right. As the maintainer of that version, you need to take care of them.
It is possible for me to add you to a list of people emailed whenever a new issue is posted. If you see it's for 7.x, then you can take care of it. For this purpose, I'd need an email address. You can use my user contact form to give me the email address you'd like me to use.
TOC v7.x issues
Thank you.
Alexis Wilke
Comment #71
larowlanAlexis, @mdm, I'm interested in putting some time into the 7.x branch - please contact me using my contact form or on irc @larowlan
Comment #72
AlexisWilke commentedHi larowlan, mdm is the one in charge of D7.