make the . after section number optional

This commit is contained in:
Le Tan 2020-12-26 15:23:32 +08:00
parent 40a3df305b
commit 2600d12fc2
3 changed files with 12 additions and 7 deletions

@ -1 +1 @@
Subproject commit 47347580cbcd460ebbbc8358e37b409530edaa2f Subproject commit 96f56ccd3ca6c5037183690cb36b41f716fc0367

View File

@ -22,27 +22,27 @@
#vx-content.vx-section-number h2::before { #vx-content.vx-section-number h2::before {
counter-increment: section1; counter-increment: section1;
content: counter(section1) ". "; content: counter(section1) " ";
} }
#vx-content.vx-section-number h3::before { #vx-content.vx-section-number h3::before {
counter-increment: section2; counter-increment: section2;
content: counter(section1) "." counter(section2) ". "; content: counter(section1) "." counter(section2) " ";
} }
#vx-content.vx-section-number h4::before { #vx-content.vx-section-number h4::before {
counter-increment: section3; counter-increment: section3;
content: counter(section1) "." counter(section2) "." counter(section3) ". "; content: counter(section1) "." counter(section2) "." counter(section3) " ";
} }
#vx-content.vx-section-number h5::before { #vx-content.vx-section-number h5::before {
counter-increment: section4; counter-increment: section4;
content: counter(section1) "." counter(section2) "." counter(section3) "." counter(section4) ". "; content: counter(section1) "." counter(section2) "." counter(section3) "." counter(section4) " ";
} }
#vx-content.vx-section-number h6::before { #vx-content.vx-section-number h6::before {
counter-increment: section5; counter-increment: section5;
content: counter(section1) "." counter(section2) "." counter(section3) "." counter(section4) "." counter(section5) ". "; content: counter(section1) "." counter(section2) "." counter(section3) "." counter(section4) "." counter(section5) " ";
} }
#vx-content.vx-constrain-image-width img { #vx-content.vx-constrain-image-width img {

View File

@ -1100,9 +1100,14 @@ static void increaseSectionNumber(QVector<int> &p_sectionNumber, int p_level, in
static QString joinSectionNumberStr(const QVector<int> &p_sectionNumber) static QString joinSectionNumberStr(const QVector<int> &p_sectionNumber)
{ {
QString res; QString res;
// TODO: make it configurable? 1.1 or 1.1.?
for (auto sec : p_sectionNumber) { for (auto sec : p_sectionNumber) {
if (sec != 0) { if (sec != 0) {
res = res + QString::number(sec) + '.'; if (res.isEmpty()) {
res = QString::number(sec);
} else {
res += '.' + QString::number(sec);
}
} else if (res.isEmpty()) { } else if (res.isEmpty()) {
continue; continue;
} else { } else {