HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Tables of Contents: stipulating their list-numbering scheme

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#101801 (In Topic #19967)
Avatar

Well-settled

Greetings!

I'm currently engaged in styling the default look of my wiki pages and, right now, of their Table of Contents. What I'm having trouble with is configuring the numbering scheme for the TOC's list of headings with the Comcode Tag Assistant. So far, I've arrived at this:
 

But I'd really like to be able to generate either one of these schemes: 

list-scheme1

1
 a)
 b)
2


list-scheme2

1
1.1
1.2
2
2.1
2.1.1

Can anyone spell out to me exactly what variables to enter in the Tag Assistant list-configuration field, for each of these, please?

Also, is it possible to set a configuration that excludes the initial Heading 1 (page-title) item from the numbering-scheme, such that only the Heading 2 and Heading 3 levels are implicated (i.e. so the first Heading 2 in the list gets numbered as 1)?

Many thanks!
Back to the top
 
Posted
Rating:
#101802
Avatar

Testing this now, and finding some bugs. Nobody really bothered to try this functionality out before ;).

Bear with me…


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Important!
Posted
Rating:
#101804
Avatar

Automated fix message

Chris Graham said

Testing this now, and finding some bugs. Nobody really bothered to try this functionality out before ;).

Bear with me…
This issue has been filed on the tracker as issue #1524, with a fix.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Important!
 
Posted
Rating:
#101805
Avatar

Here is a usage example:

Code

[title]top[/title]

[contents base="2"]decimal,lower-alpha[/contents]

[title="2" number="decimal,lower-alpha"]foo[/title]

[title="3" number="decimal,lower-alpha"]bar[/title]

[title="2" number="decimal,lower-alpha"]foo[/title]

[title="3" number="decimal,lower-alpha"]bar[/title]

I didn't need to put the number setting on the title tags, but I wanted to illustrate how these could also be automatically numbered in-situ.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#101809
Avatar

Well-settled

Back to the top
 
Posted
Rating:
#101811
Avatar

Well-settled

Hi Chris,
 
Many thanks for looking into this! Your code example enlightens me considerably as regards controlling the list-style output via the page's HTML. And your hotfix is nicely generating the decimal,alpha list-style - although I'm still getting the Heading 1 (page-title) included in the numbering envelope (it's now listed as "a"). If there is a way of excluding it, how would the code need to be changed? And, to achieve the all-decimal style, am I right in guessing I'd be replacing decimal,alpha with decimal,decimal for defining Level 2 and decimal,decimal,decimal for Level 3?
 
My problem, then, seemed to be relating to the Tag Assistant "Contents" form. No matter what I was entering in either the Base or the Title Tag fields, the output stayed unchanged - i.e. as per my screenshot. I haven't yet tried inputting any changes via the Tag Assistant - though I notice your hotfix's inclusion of code examples in the base and contents-tag fields, which is thoroughly helpful to the likes of me!

 One thing about this particular wiki page strikes me as not what I'm used to seeing - namely, when I invoke "View page source" I see the entire page's text (plus formatting tags) included between the document head tags, in addition to between the body tags as expected (specifically, as the value of the "content" attribute within a "meta property" tag). How and why, I don't know. Would that have any bearing on my situation - like overriding the Tag Assistant, maybe?

I'll have a chance tomorrow to see how the Tag Assistant is performing since your fix and let you know my findings. In the meantime,

Thanks again and best regards,

Richard.
Back to the top
 
Posted
Rating:
#101812
Avatar

If there is a way of excluding it

My example excluded it, at least it did on my machine after finishing the hot fix.

Please show a reproduction case if you can't get it to work (i.e. a stripped down code example that doesn't work).

And, to achieve the all-decimal style, am I right in guessing I'd be replacing decimal,alpha with decimal,decimal for defining Level 2 and decimal,decimal,decimal for Level 3?

Yes.

the value of the "content" attribute within a "meta property" tag … why, I don't know

So semantic tools, like search engines, or Facebook links, have access to an isolated portion of the primary page content.

Would that have any bearing on my situation

No.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#101849
Avatar

Well-settled

Hi Chris,

Thanks for that, and apologies for the slight delay in replying.

I'm pleased to report success with getting the "Contents" form to set the base value and exclude the h1 screen_title from the TOC list, so the decimal,alpha list-style-type is now working just as desired. As for the other list-style-type, I'm still struggling in vain to discover how to configure it to automatically generate the desired composite decimal output for different levels. The necessary configuration seems to be somewhat complex,  Looking at the outputted source code for Wikipedia TOCs, which use that style, suggests each single list-item is individually defined as a nested class in its own right, stipulating first the level of the heading and secondly the id of the list-item, case by case. I simply don't know enough about the syntax required for configuring that output, and regrettably can't find any actual original HTML samples that I could copy or infer how to code my own rule.

Actually I'm no longer so bothered about generating this list-style-type in my own Wiki TOCs, since the decimal,alpha style I can now generate is entirely adequate to the structural specs of my Wiki pages generally. And, although I routinely prefix nested paragraphs with fully decimalized numbering in the case of technical articles, when it comes to generating  TOCs for these, there's a simple and satisfactory workaround: specify base=2, contents=none, none, none,(…etc) - the existing prefixes for all the paragraphs, of course, end up displaying in the TOC perfectly, in place of the decimal,alpha markers!.

Naturally I'd still be greatly interested to know how to encode the fully decimalized numbering, but, in terms of practical needs, I'm happy with the solutions I now have, and I'm thoroughly grateful for all your help, Chris, towards arriving at them.

Many thanks and best regards,

Richard.     
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: