Feature #20595
Hierarchical Numbering on headers
Status: | Resolved | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Text formatting | |||
Target version: | - | |||
Resolution: |
Description
Hello,
Numbering support on header is very useful feature to write the big wiki pages. I can't find this feature in redmine. :(
Following images is from https://www.openproject.org/help/user-guides/wiki/
I want to this. :)
History
#1
Updated by Toshi MARUYAMA over 6 years ago
- Category set to Text formatting
#2
Updated by Adnan Topçu over 6 years ago
- Status changed from New to Resolved
#3
Updated by Jürgen Depicker over 5 years ago
Hello, I don't consider this resolved, or am missing something to make it resolved. Can you please reopen this till it is implemented?
#4
Updated by Stéphane Champeau over 5 years ago
Hi,
this is my version of numberedheaders
{{css
/* https://www.w3.org/TR/CSS22/generate.html#scope */
/* counter(x): number x*/
/* counters(x,str), all counter with separator ( x.y.z.... )*/
/* Limit to .toc */
UL { counter-reset: item }
.toc LI { display: block }
.toc LI:before { content: counters(item, ".") " "; counter-increment: item }
/* .wiki { counter-reset: h1 h2 h3 h4 h5; } : works only in wiki page, not in html export as there is no more wiki class */
/* body { counter-reset: h1 h2 h3 h4 h5; } : works in html export but in wiki page add numbered number in project name */
/* The wiki must have the first h1. right afert the {{toc}} */
ul.toc + a + h1 { counter-reset: h1 h2 h3 h4 h5; } /*: works in wiki and html export. The wiki must be : .... {{toc}} h1. first numbered h1 ...... */
ul.toc ~ h1 { counter-reset: h2 h3 h4 h5; }
ul.toc ~ h1::before { counter-increment: h1; content: counter(h1) ". " ; }
ul.toc ~ h2 { counter-reset: h3 h4 h5; }
ul.toc ~ h2::before { counter-increment: h2; content: counter(h1) "." counter(h2) ". ";}
ul.toc ~ h3 { counter-reset: h4 h5; }
ul.toc ~ h3::before { counter-increment: h3; content: counter(h1) "." counter(h2) "." counter(h3) ". ";}
ul.toc ~ h4 { counter-reset: h5; }
ul.toc ~ h4::before { counter-increment: h4; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4,lower-latin) ". ";}
}}
{{toc}}
h1. first numbered
....
works in wiki and html export but breaks the pdf export with this error
Completed 500 Internal Server Error in 1032ms (ActiveRecord: 48.4ms) ActionView::Template::Error (undefined method `attrib' for #<Redmine::Export::PDF::ITCPDF:0xb37205e8>): 1: <%= raw wiki_page_to_pdf(@page, @project) %> lib/redmine/export/pdf.rb:95:in `RDMwriteFormattedCell' lib/redmine/export/pdf/wiki_pdf_helper.rb:79:in `write_wiki_page' lib/redmine/export/pdf/wiki_pdf_helper.rb:55:in `wiki_page_to_pdf' app/views/wiki/show.pdf.erb:1:in `_app_views_wiki_show_pdf_erb___751018598__644180978' lib/redmine/sudo_mode.rb:63:in `sudo_mode'
#5
Updated by Adnan Topçu about 5 years ago
Below is more complicated version. headers and items are together.
h1 { counter-reset: h1s; }
h2 { counter-reset: h2s; }
h2::before {
content: counter(h1s) ". ";
counter-increment: h1s;
}
h3 { counter-reset: h3s; }
h3::before {
content: counter(h1s) "." counter(h2s) ". ";
counter-increment: h2s;
}
h4 { counter-reset: h4s; }
h4::before {
content: counter(h1s) "." counter(h2s) "." counter(h3s) ". ";
counter-increment: h3s;
}
h5 { counter-reset: h5s; }
h5::before {
content: counter(h1s) "." counter(h2s) "." counter(h3s) "." counter(h4s) ". ";
counter-increment: h4s;
}
h6 { counter-reset: h6s; }
h6::before {
content: counter(h1s) "." counter(h2s) "." counter(h3s) "." counter(h4s) "." counter(h5s) ". ";
counter-increment: h5s;
}
h1 + ol, h1 + p + ol, h1 + ol li ol , h1 + p + ol li ol { counter-reset:section; list-style-type:none; padding-left: 0px; }
h1 + ol li, h1 + p + ol li, h1 + ol li ol li , h1 + p + ol li ol li { counter-increment:section;}
h1 + ol li:before, h1 + p + ol li:before, h1 + ol li ol li:before , h1 + p + ol li ol li:before { content: counters(section, '.') '. ';}
h2 + ol, h2 + p + ol, h2 + ol li ol , h2 + p + ol li ol { counter-reset:section; list-style-type:none; padding-left: 0px; }
h2 + ol li, h2 + p + ol li, h2 + ol li ol li , h2 + p + ol li ol li { counter-increment:section; }
h2 + ol li:before, h2 + p + ol li:before, h2 + ol li ol li:before , h2 + p + ol li ol li:before { content: counter(h1s) "." counters(section, '.') '. '; }
h3 + ol, h3 + p + ol, h3 + ol li ol , h3 + p + ol li ol { counter-reset:section; list-style-type:none; padding-left: 0px; }
h3 + ol li, h3 + p + ol li, h3 + ol li ol li , h3 + p + ol li ol li { counter-increment:section; }
h3 + ol li:before, h3 + p + ol li:before, h3 + ol li ol li:before , h3 + p + ol li ol li:before { content: counter(h1s) "." counter(h2s) "." counters(section, '.') '. '; }
h4 + ol, h4 + p + ol, h4 + ol li ol , h4 + p + ol li ol { counter-reset:section; list-style-type:none; padding-left: 0px; }
h4 + ol li, h4 + p + ol li, h4 + ol li ol li , h4 + p + ol li ol li { counter-increment:section; }
h4 + ol li:before, h4 + p + ol li:before, h4 + ol li ol li:before , h4 + p + ol li ol li:before { content: counter(h1s) "." counter(h2s) "." counter(h3s) "." counters(section, '.') '. '; }
h5 + ol, h5 + p + ol, h5 + ol li ol , h5 + p + ol li ol { counter-reset:section; list-style-type:none; padding-left: 0px; }
h5 + ol li, h5 + p + ol li, h5 + ol li ol li , h5 + p + ol li ol li { counter-increment:section; }
h5 + ol li:before, h5 + p + ol li:before, h5 + ol li ol li:before , h5 + p + ol li ol li:before { content: counter(h1s) "." counter(h2s) "." counter(h3s) "." counter(h4s) "." counters(section, '.') '. '; }
h6 + ol, h6 + p + ol, h6 + ol li ol , h6 + p + ol li ol { counter-reset:section; list-style-type:none; padding-left: 0px; }
h6 + ol li, h6 + p + ol li, h6 + ol li ol li , h6 + p + ol li ol li { counter-increment:section; }
h6 + ol li:before, h6 + p + ol li:before, h6 + ol li ol li:before , h6 + p + ol li ol li:before { content: counter(h1s) "." counter(h2s) "." counter(h3s) "." counter(h4s) "." counter(h5s) "." counters(section, '.') '. '; }
#6
Updated by Stéphane Champeau about 5 years ago
- File numbered headers with css from post 4.png added
- File numbered headers with css from post 5.png added
There are some differences, see screenshots.
Your version also break the pdf export as mine ...
#7
Updated by Toshi MARUYAMA almost 5 years ago
- Description updated (diff)