Skip to content

Commit

Permalink
fix: Spaces causing many   being rendered in index files and l…
Browse files Browse the repository at this point in the history
…ists (#195)

* test: New baseline.
* chore: New package-lock.json 'lockfileVersion: 2'
  • Loading branch information
about-code committed Oct 14, 2021
1 parent f236097 commit 65d5290
Show file tree
Hide file tree
Showing 53 changed files with 1,822 additions and 248 deletions.
2 changes: 1 addition & 1 deletion lib/index/anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { getHtmlNodeInnerText, getNodeId, getNodeText } from "../ast/tools.js";
import { byGroupHeading, getIndex, group } from "../indexer.js";
import { getFileLinkUrl } from "../path/tools.js";

const brk = text(" \n");
const brk = text("\n");
const IDX_ANCHORS = Symbol("anchors");
const REGEXP_ANCHOR_REF = /<.* (id|name)="([^"]*)".*\/?>/;
const REGEXP_ANCHOR_CLASS = /<.* class="([^"]*)".*\/?>/;
Expand Down
2 changes: 1 addition & 1 deletion lib/index/terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { collator } from "../text/collator.js";
* @typedef {{ [term: string]: IndexOldEntry }} IndexOld
*/

const brk = text(" \n");
const brk = text("\n");

export const IDX_TERMS = Symbol("termsAsList");
export const IDX_TERMS_BY_ID = Symbol("termsById");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# [Book Index](#book-index)

## [Second Level~](#second-level)
## [Second Level~](#second-level)

[Glossary 2][1][Testing Index generation for glossaries file glob][2]

## [Third Level~](#third-level)
## [Third Level~](#third-level)

[Glossary 3][3][Second Level][4]

[1]: ../2nd/glossary2.md#second-level "Test: Mentioning term Third Level"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [Book Index](#book-index)

## [Term](#term)
## [Term](#term)

[Glossary][1][Term][2]

[1]: ./sub/glossary.md#term "GIVEN a term 'Term'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [Book Index](#book-index)

## [Term](#term)
## [Term](#term)

[Glossary][1][Term][2]

[1]: ../glossary.md#term "GIVEN a term 'Term'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [Book Index](#book-index)

## [Term](#term)
## [Term](#term)

[Glossary][1][FooClass][2]

[1]: ./glossary.md#term "...a term"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# [Book Index](#book-index)

## [In Glossary A and B](#in-glossary-a-and-b)
## [In Glossary A and B](#in-glossary-a-and-b)

[Glossary A][1][Glossary B][2][Shared set of terms][3]

## [Only in Glossary A](#only-in-glossary-a)
## [Only in Glossary A](#only-in-glossary-a)

[Glossary A][4][Disjunct set of terms][5]

## [Only in Glossary B](#only-in-glossary-b)
## [Only in Glossary B](#only-in-glossary-b)

[Glossary B][6][Disjunct set of terms][5]

[1]: ./glossary-a.md#in-glossary-a-and-b
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# [Book Index](#book-index)

## [Term](#term)
## [Term](#term)

[Glossary][1][Term][2][Section][3][./without-section-heading.md][4]

[1]: ./glossary.md#term "GIVEN a term 'Term'
Expand Down
12 changes: 6 additions & 6 deletions test/output-expected/config-indexFiles/154-deep-dir/index-a.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# [Index A](#index-a)

## [GlossaryA_Term1](#glossarya_term1)
## [GlossaryA_Term1](#glossarya_term1)

[Glossary A][1][Testing config indexFiles with multiple index files][2]

## [GlossaryA_Term2](#glossarya_term2)
## [GlossaryA_Term2](#glossarya_term2)

[Glossary A][3][Testing config indexFiles with multiple index files][2]

## [GlossaryABC_Term3](#glossaryabc_term3)
## [GlossaryABC_Term3](#glossaryabc_term3)

[Glossary A][4][Glossary B][5][Glossary C][6][Testing config indexFiles with multiple index files][2]

[1]: ./glossary-a.md#glossarya_term1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# [Index B](#index-b)

## [GlossaryABC_Term3](#glossaryabc_term3)
## [GlossaryABC_Term3](#glossaryabc_term3)

[Glossary A][1][Glossary B][2][Glossary C][3][Testing config indexFiles with multiple index files][4]

## [GlossaryB_Term1](#glossaryb_term1)
## [GlossaryB_Term1](#glossaryb_term1)

[Glossary B][5][Testing config indexFiles with multiple index files][4]

## [GlossaryB_Term2](#glossaryb_term2)
## [GlossaryB_Term2](#glossaryb_term2)

[Glossary B][6][Testing config indexFiles with multiple index files][4]

[1]: ../glossary-a.md#glossaryabc_term3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# [Index C](#index-c)

## [GlossaryABC_Term3](#glossaryabc_term3)
## [GlossaryABC_Term3](#glossaryabc_term3)

[Glossary A][1][Glossary B][2][Glossary C][3][Testing config indexFiles with multiple index files][4]

## [GlossaryC_Term1](#glossaryc_term1)
## [GlossaryC_Term1](#glossaryc_term1)

[Glossary C][5][Testing config indexFiles with multiple index files][4]

## [GlossaryC_Term2](#glossaryc_term2)
## [GlossaryC_Term2](#glossaryc_term2)

[Glossary C][6][Testing config indexFiles with multiple index files][4]

[1]: ../../glossary-a.md#glossaryabc_term3
Expand Down
12 changes: 6 additions & 6 deletions test/output-expected/config-indexFiles/flat-dir/index-a.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# [Index A](#index-a)

## [GlossaryA_Term1](#glossarya_term1)
## [GlossaryA_Term1](#glossarya_term1)

[Glossary A][1][Testing config indexFiles with multiple index files][2]

## [GlossaryA_Term2](#glossarya_term2)
## [GlossaryA_Term2](#glossarya_term2)

[Glossary A][3][Testing config indexFiles with multiple index files][2]

## [GlossaryAB_Term3](#glossaryab_term3)
## [GlossaryAB_Term3](#glossaryab_term3)

[Glossary A][4][Glossary B][5][Testing config indexFiles with multiple index files][2]

[1]: ./glossary-a.md#glossarya_term1
Expand Down
12 changes: 6 additions & 6 deletions test/output-expected/config-indexFiles/flat-dir/index-b.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# [Index B](#index-b)

## [GlossaryAB_Term3](#glossaryab_term3)
## [GlossaryAB_Term3](#glossaryab_term3)

[Glossary A][1][Glossary B][2][Testing config indexFiles with multiple index files][3]

## [GlossaryB_Term1](#glossaryb_term1)
## [GlossaryB_Term1](#glossaryb_term1)

[Glossary B][4][Testing config indexFiles with multiple index files][3]

## [GlossaryB_Term2](#glossaryb_term2)
## [GlossaryB_Term2](#glossaryb_term2)

[Glossary B][5][Testing config indexFiles with multiple index files][3]

[1]: ./glossary-a.md#glossaryab_term3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# [Book Index](#book-index)

## [Term1](#term1)
## [Term1](#term1)

[Glossary][1][Document][2]<sub> [1 ][3][2 ][4][3 ][5][4 ][6][5 ][7][6 ][8][7 ][9][8 ][10][9 ][11]</sub>

## [Term2](#term2)
## [Term2](#term2)

[Glossary][12][Document][2]<sub> [1 ][4][2 ][5][3 ][6][4 ][7][5 ][8][6 ][9][7 ][10][8 ][11]</sub>

[1]: ./glossary.md#term1 "Term1 description."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# [Figures](#figures)

## [Testing option generateFiles.listOfFigures](#testing-option-generatefileslistoffigures)

## [Testing option generateFiles.listOfFigures](#testing-option-generatefileslistoffigures)

1. [Figure 1 depth 1][1]
2. [Figure 2 depth 2][2]
3. [Figure 3 depth 3][3]
Expand All @@ -11,7 +11,7 @@
6. [Figure 6 depth 2][6]
7. [Figure 7 depth 3][7]
8. [Figure 8 depth 6][8]
9. [Figure 9 depth 2][9]
9. [Figure 9 depth 2][9]


[1]: ./document-figures.md#figure-1-depth-1 "Figure 1 depth 1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# [Book Index](#book-index)

## [Term1](#term1)
## [Term1](#term1)

[Glossary][1][Document][2]<sub> [1 ][3][2 ][4][3 ][5][4 ][6][5 ][7][6 ][8][7 ][9][8 ][10]</sub>

## [Term2](#term2)
## [Term2](#term2)

[Glossary][11][Document][2]<sub> [1 ][3][2 ][4][3 ][5][4 ][6][5 ][7][6 ][8][7 ][9][8 ][10]</sub>

[1]: ./glossary.md#term1 "Term1 description."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# [Figures](#figures)

## [Testing option generateFiles.listOfFigures](#testing-option-generatefileslistoffigures)
1. [Figure 1 depth 1][1]
### [Heading 2 Depth 2](#heading-2-depth-2)

## [Testing option generateFiles.listOfFigures](#testing-option-generatefileslistoffigures)

1. [Figure 1 depth 1][1]

### [Heading 2 Depth 2](#heading-2-depth-2)

1. [Figure 2 depth 2][2]
2. [Figure 3 depth 3][3]
3. [Figure 4 depth 4][4]
4. [Figure 5 depth 3][5]
### [Heading 6 Depth 2](#heading-6-depth-2)
4. [Figure 5 depth 3][5]

### [Heading 6 Depth 2](#heading-6-depth-2)

1. [Figure 6 depth 2][6]
2. [Figure 7 depth 3][7]
3. [Figure 8 depth 6][8]
4. [Figure 9 depth 2][9]
4. [Figure 9 depth 2][9]


[1]: ./document-figures.md#figure-1-depth-1 "Figure 1 depth 1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# [Book Index](#book-index)

## [Term1](#term1)
## [Term1](#term1)

[Glossary][1][Document][2][Heading 2 Depth 2][3]<sub> [1 ][4][2 ][5][3 ][6]</sub> ○ [Heading 6 Depth 2][7]<sub> [1 ][8][2 ][9][3 ][10]</sub> ○ [Term1][11]

## [Term2](#term2)
## [Term2](#term2)

[Glossary][12][Heading 2 Depth 2][3]<sub> [1 ][4][2 ][5][3 ][6]</sub> ○ [Heading 6 Depth 2][7]<sub> [1 ][8][2 ][9][3 ][10]</sub> ○ [Term2][13]

[1]: ./glossary.md#term1 "Term1 description."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# [Figures](#figures)

## [Document with Figure](#document-with-figure)
1. [Figure 1 depth 1][1]
### [Heading 2 Depth 2](#heading-2-depth-2)
1. [Figure 2 depth 2][2]
#### [Heading 3 Depth 3](#heading-3-depth-3)
1. [Figure 3 depth 3][3]
##### [Heading 4 Depth 4](#heading-4-depth-4)
1. [Figure 4 depth 4][4]
#### [Heading 5 Depth 3](#heading-5-depth-3)
1. [Figure 5 depth 3][5]
### [Heading 6 Depth 2](#heading-6-depth-2)
1. [Figure 6 depth 2][6]
#### [Heading 7 Depth 3](#heading-7-depth-3)
1. [Figure 7 depth 3][7]
###### [Heading 8 Depth 6](#heading-8-depth-6)
1. [Figure 8 depth 6][8]
###### [Heading 9 Depth 2](#heading-9-depth-2)
1. [Figure 9 depth 2][9]

## [Document with Figure](#document-with-figure)

1. [Figure 1 depth 1][1]

### [Heading 2 Depth 2](#heading-2-depth-2)

1. [Figure 2 depth 2][2]

#### [Heading 3 Depth 3](#heading-3-depth-3)

1. [Figure 3 depth 3][3]

##### [Heading 4 Depth 4](#heading-4-depth-4)

1. [Figure 4 depth 4][4]

#### [Heading 5 Depth 3](#heading-5-depth-3)

1. [Figure 5 depth 3][5]

### [Heading 6 Depth 2](#heading-6-depth-2)

1. [Figure 6 depth 2][6]

#### [Heading 7 Depth 3](#heading-7-depth-3)

1. [Figure 7 depth 3][7]

###### [Heading 8 Depth 6](#heading-8-depth-6)

1. [Figure 8 depth 6][8]

###### [Heading 9 Depth 2](#heading-9-depth-2)

1. [Figure 9 depth 2][9]


[1]: ./document-figures.md#figure-1-depth-1 "Figure 1 depth 1"
Expand Down

0 comments on commit 65d5290

Please sign in to comment.