WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit 9fe746f

Browse files
committed
Separate name elements with underscores to improve readability
1 parent caf8984 commit 9fe746f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

audit-cli/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,17 @@ This command helps writers:
186186

187187
**Output Format:**
188188

189-
Extracted files are named: `{heading}-{first-step-title}-{hash}.rst`
189+
Extracted files are named: `{heading}_{first-step-title}_{hash}.rst`
190190

191191
The filename includes:
192192
- **Heading**: The section heading above the procedure
193193
- **First step title**: The title of the first step (for readability)
194194
- **Hash**: A short 6-character hash of the content (for uniqueness)
195195

196196
Examples:
197-
- `before-you-begin-pull-the-mongodb-docker-image-e8eeec.rst`
198-
- `install-mongodb-community-edition-download-the-tarball-44c437.rst`
199-
- `configuration-create-the-data-and-log-directories-f1d35b.rst`
197+
- `before-you-begin_pull-the-mongodb-docker-image_e8eeec.rst`
198+
- `install-mongodb-community-edition_download-the-tarball_44c437.rst`
199+
- `configuration_create-the-data-and-log-directories_f1d35b.rst`
200200

201201
**Verbose Output:**
202202

audit-cli/commands/extract/procedures/parser.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ func generateVariations(procedure rst.Procedure, sourceFile string, selectionFil
107107

108108
// generateOutputFilename generates the output filename for a procedure.
109109
//
110-
// Format: {heading}-{first-step-title}-{hash}.rst
111-
// Example: "before-you-begin-pull-the-mongodb-docker-image-a1b2c3.rst"
110+
// Format: {heading}_{first-step-title}_{hash}.rst
111+
// Example: "before-you-begin_pull-the-mongodb-docker-image_a1b2c3.rst"
112112
//
113113
// The hash is a short (6 character) hash of the procedure content to ensure uniqueness.
114114
func generateOutputFilename(sourceFile string, procedure rst.Procedure, variationName string) string {
@@ -129,10 +129,10 @@ func generateOutputFilename(sourceFile string, procedure rst.Procedure, variatio
129129
// If the procedure has steps, use the first step title to make the filename descriptive
130130
if len(procedure.Steps) > 0 && procedure.Steps[0].Title != "" {
131131
firstStepTitle := sanitizeFilename(procedure.Steps[0].Title)
132-
return fmt.Sprintf("%s-%s-%s.rst", title, firstStepTitle, shortHash)
132+
return fmt.Sprintf("%s_%s_%s.rst", title, firstStepTitle, shortHash)
133133
}
134134

135-
return fmt.Sprintf("%s-%s.rst", title, shortHash)
135+
return fmt.Sprintf("%s_%s.rst", title, shortHash)
136136
}
137137

138138
// computeContentHash generates a hash of the procedure's content for uniqueness.

audit-cli/commands/extract/procedures/procedures_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ func TestGenerateOutputFilename(t *testing.T) {
253253
}
254254

255255
// Verify filename contains a hash (6 characters before .rst)
256-
parts := strings.Split(v.OutputFile, "-")
256+
parts := strings.Split(v.OutputFile, "_")
257257
if len(parts) < 2 {
258258
t.Errorf("Filename should contain at least heading and hash: %s", v.OutputFile)
259259
}
@@ -311,8 +311,8 @@ func TestContentHash(t *testing.T) {
311311
filename := variations[0].OutputFile
312312
// Remove .rst extension
313313
nameWithoutExt := strings.TrimSuffix(filename, ".rst")
314-
// Get last part after last hyphen (the hash)
315-
parts := strings.Split(nameWithoutExt, "-")
314+
// Get last part after last underscore (the hash)
315+
parts := strings.Split(nameWithoutExt, "_")
316316
hash := parts[len(parts)-1]
317317
hashes = append(hashes, hash)
318318
}

0 commit comments

Comments
 (0)