Merge pull request #28543 from timstclair/toc

Fix mungedocs TOC generation for duplicate headers
This commit is contained in:
Erick Fejta 2016-07-07 17:24:34 -07:00 committed by GitHub
commit b7ca663423
5 changed files with 53 additions and 44 deletions

View File

@ -4,80 +4,82 @@
- [Downloads](#downloads)
- [Highlights](#highlights)
- [Known Issues and Important Steps before Upgrading](#known-issues-and-important-steps-before-upgrading)
- [kubernetes Core Known Issues](#kubernetes-core-known-issues)
- [Docker runtime Known Issues](#docker-runtime-known-issues)
- [Rkt runtime Known Issues](#rkt-runtime-known-issues)
- [Provider-specific Notes](#provider-specific-notes)
- [Previous Releases Included in v1.3.0](#previous-releases-included-in-v130)
- [v1.3.0-beta.3](#v130-beta3)
- [Downloads](#downloads)
- [Downloads](#downloads-1)
- [Changelog since v1.3.0-beta.2](#changelog-since-v130-beta2)
- [Action Required](#action-required)
- [Other notable changes](#other-notable-changes)
- [v1.2.5](#v125)
- [Downloads](#downloads)
- [Downloads](#downloads-2)
- [Changes since v1.2.4](#changes-since-v124)
- [Other notable changes](#other-notable-changes)
- [Other notable changes](#other-notable-changes-1)
- [v1.3.0-beta.2](#v130-beta2)
- [Downloads](#downloads)
- [Downloads](#downloads-3)
- [Changes since v1.3.0-beta.1](#changes-since-v130-beta1)
- [Experimental Features](#experimental-features)
- [Other notable changes](#other-notable-changes)
- [Other notable changes](#other-notable-changes-2)
- [v1.3.0-beta.1](#v130-beta1)
- [Downloads](#downloads)
- [Downloads](#downloads-4)
- [Changes since v1.3.0-alpha.5](#changes-since-v130-alpha5)
- [Action Required](#action-required)
- [Other notable changes](#other-notable-changes)
- [Action Required](#action-required-1)
- [Other notable changes](#other-notable-changes-3)
- [v1.3.0-alpha.5](#v130-alpha5)
- [Downloads](#downloads)
- [Downloads](#downloads-5)
- [Changes since v1.3.0-alpha.4](#changes-since-v130-alpha4)
- [Action Required](#action-required)
- [Other notable changes](#other-notable-changes)
- [Action Required](#action-required-2)
- [Other notable changes](#other-notable-changes-4)
- [v1.3.0-alpha.4](#v130-alpha4)
- [Downloads](#downloads)
- [Downloads](#downloads-6)
- [Changes since v1.3.0-alpha.3](#changes-since-v130-alpha3)
- [Action Required](#action-required)
- [Other notable changes](#other-notable-changes)
- [Action Required](#action-required-3)
- [Other notable changes](#other-notable-changes-5)
- [v1.2.4](#v124)
- [Downloads](#downloads)
- [Downloads](#downloads-7)
- [Changes since v1.2.3](#changes-since-v123)
- [Other notable changes](#other-notable-changes)
- [Other notable changes](#other-notable-changes-6)
- [v1.3.0-alpha.3](#v130-alpha3)
- [Downloads](#downloads)
- [Downloads](#downloads-8)
- [Changes since v1.3.0-alpha.2](#changes-since-v130-alpha2)
- [Action Required](#action-required)
- [Other notable changes](#other-notable-changes)
- [Action Required](#action-required-4)
- [Other notable changes](#other-notable-changes-7)
- [v1.2.3](#v123)
- [Downloads](#downloads)
- [Downloads](#downloads-9)
- [Changes since v1.2.2](#changes-since-v122)
- [Action Required](#action-required)
- [Other notable changes](#other-notable-changes)
- [Action Required](#action-required-5)
- [Other notable changes](#other-notable-changes-8)
- [v1.3.0-alpha.2](#v130-alpha2)
- [Downloads](#downloads)
- [Downloads](#downloads-10)
- [Changes since v1.3.0-alpha.1](#changes-since-v130-alpha1)
- [Other notable changes](#other-notable-changes)
- [Other notable changes](#other-notable-changes-9)
- [v1.2.2](#v122)
- [Downloads](#downloads)
- [Downloads](#downloads-11)
- [Changes since v1.2.1](#changes-since-v121)
- [Other notable changes](#other-notable-changes)
- [Other notable changes](#other-notable-changes-10)
- [v1.2.1](#v121)
- [Downloads](#downloads)
- [Downloads](#downloads-12)
- [Changes since v1.2.0](#changes-since-v120)
- [Action Required](#action-required)
- [Other notable changes](#other-notable-changes)
- [Other notable changes](#other-notable-changes-11)
- [v1.3.0-alpha.1](#v130-alpha1)
- [Downloads](#downloads)
- [Changes since v1.2.0](#changes-since-v120)
- [Action Required](#action-required)
- [Other notable changes](#other-notable-changes)
- [Downloads](#downloads-13)
- [Changes since v1.2.0](#changes-since-v120-1)
- [Action Required](#action-required-6)
- [Other notable changes](#other-notable-changes-12)
- [v1.2.0](#v120)
- [Downloads](#downloads)
- [Downloads](#downloads-14)
- [Changes since v1.1.1](#changes-since-v111)
- [Major Themes](#major-themes)
- [Other notable improvements](#other-notable-improvements)
- [Experimental Features](#experimental-features)
- [Action required](#action-required)
- [Experimental Features](#experimental-features-1)
- [Action required](#action-required-7)
- [Known Issues](#known-issues)
- [Docker Known Issues](#docker-known-issues)
- [1.9.1](#191)
- [Provider-specific Notes](#provider-specific-notes)
- [Provider-specific Notes](#provider-specific-notes-1)
- [Various](#various)
- [AWS](#aws)
- [GCE](#gce)
@ -121,7 +123,7 @@ binary | sha1 hash | md5 hash
* Display line number on JSON errors
* Add flag -t as shorthand for --tty
* Resources
* Improved node stability by *optionally* evicting pods upon memory pressure - [Design Doc](https://github.com/kubernetes/kubernetes/blob/release-1.3/docs/proposals/kubelet-eviction.md)
* Improved node stability by *optionally* evicting pods upon memory pressure - [Design Doc](https://github.com/kubernetes/kubernetes/blob/release-1.3/docs/proposals/kubelet-eviction.md)
* **alpha**: NVIDIA GPU support ([#24836](https://github.com/kubernetes/kubernetes/pull/24836), [@therc](https://github.com/therc))
* Adding loadBalancer services and nodeports services to quota system
@ -137,7 +139,7 @@ All prior versions of docker will not be supported.
- This issue can be resolved by restarting docker daemon
- CORS works only in insecure mode ([#24086](https://github.com/kubernetes/kubernetes/issues/24086))
- Persistent volume claims gets added incorrectly after being deleted under stress. Happens very infrequently. ([#26082](https://github.com/kubernetes/kubernetes/issues/26082))
#### Docker runtime Known Issues
- Kernel crash with Aufs storage driver on Debian Jessie ([#27885](https://github.com/kubernetes/kubernetes/issues/27885))

View File

@ -51,6 +51,7 @@ func updateTOC(filePath string, mlines mungeLines) (mungeLines, error) {
func buildTOC(mlines mungeLines) mungeLines {
var out mungeLines
bookmarks := map[string]int{}
for _, mline := range mlines {
if mline.preformatted || !mline.header {
@ -69,6 +70,12 @@ func buildTOC(mlines mungeLines) mungeLines {
bookmark := strings.Replace(strings.ToLower(heading), " ", "-", -1)
// remove symbols (except for -) in bookmarks
bookmark = r.ReplaceAllString(bookmark, "")
// Incremental counter for duplicate bookmarks
next := bookmarks[bookmark]
bookmarks[bookmark] = next + 1
if next > 0 {
bookmark = fmt.Sprintf("%s-%d", bookmark, next)
}
tocLine := fmt.Sprintf("%s- [%s](#%s)", indent, heading, bookmark)
out = append(out, newMungeLine(tocLine))
}

View File

@ -48,7 +48,7 @@ found at [API Conventions](api-conventions.md).
- [Edit defaults.go](#edit-defaultsgo)
- [Edit conversion.go](#edit-conversiongo)
- [Changing the internal structures](#changing-the-internal-structures)
- [Edit types.go](#edit-typesgo)
- [Edit types.go](#edit-typesgo-1)
- [Edit validation.go](#edit-validationgo)
- [Edit version conversions](#edit-version-conversions)
- [Generate protobuf objects](#generate-protobuf-objects)

View File

@ -46,7 +46,7 @@ Documentation for other releases can be found at
- [Too complex for now: nvidia-docker](#too-complex-for-now-nvidia-docker)
- [Implementation plan](#implementation-plan)
- [V0](#v0)
- [Scheduling](#scheduling)
- [Scheduling](#scheduling-1)
- [Runtime](#runtime)
- [Other](#other)
- [Future work](#future-work)

View File

@ -45,13 +45,13 @@ Use this overview of the `kubectl` command line interface to help you start runn
- [Resource types](#resource-types)
- [Output options](#output-options)
- [Formatting output](#formatting-output)
- [Syntax](#syntax)
- [Syntax](#syntax-1)
- [Example](#example)
- [Custom columns](#custom-columns)
- [Examples](#examples)
- [Sorting list objects](#sorting-list-objects)
- [Syntax](#syntax)
- [Example](#example)
- [Syntax](#syntax-2)
- [Example](#example-1)
- [Examples: Common operations](#examples-common-operations)
- [Next steps](#next-steps)