-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix links in fields doc #3539
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e2818fa
fix: Fix links in fields doc
simster7 bcc7bb2
build
simster7 2c51e9f
test
simster7 ec0ed85
test
simster7 cdb9625
done
simster7 e95bbad
done
simster7 5965fab
t
simster7 ec8a693
done done
simster7 4af5fa0
Merge branch 'master' into mkdocs
simster7 e31554f
Merge branch 'master' into mkdocs
simster7 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !fields | ||
|
||
package main | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// +build fields | ||
|
||
package main | ||
|
||
func generateDocs() { | ||
panic("hack package was built with 'fields' tag; doc generation code was not included") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package main | ||
|
||
import ( | ||
"io/ioutil" | ||
"regexp" | ||
) | ||
|
||
const ( | ||
newHeader = `<summary>Examples with this field (click to open)</summary> | ||
<br> | ||
<ul>` | ||
newHeaderAlt = `<summary>Examples (click to open)</summary> | ||
<br> | ||
<ul>` | ||
newLink = ` <li> <a href="$2">$1</a>` | ||
newDetails = `</ul> | ||
</details>` | ||
) | ||
|
||
var ( | ||
headerRegex = regexp.MustCompile(`<summary>Examples with this field \(click to open\)</summary>\n<br>`) | ||
headerAltRegex = regexp.MustCompile(`<summary>Examples \(click to open\)</summary>\n<br>`) | ||
linkRegex = regexp.MustCompile(`- \[\x60(.+?)\x60\]\((.+?)\)`) | ||
detailsRegex = regexp.MustCompile(`</details>`) | ||
) | ||
|
||
func parseExamples() { | ||
file, err := ioutil.ReadFile("site/fields/index.html") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
file = headerRegex.ReplaceAll(file, []byte(newHeader)) | ||
file = headerAltRegex.ReplaceAll(file, []byte(newHeaderAlt)) | ||
file = linkRegex.ReplaceAll(file, []byte(newLink)) | ||
file = detailsRegex.ReplaceAll(file, []byte(newDetails)) | ||
|
||
err = ioutil.WriteFile("site/fields/index.html", file, 0644) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file imports
"github.com/argoproj/argo/cmd/argo/commands"
, so it will in effect build the entire codebase into the binary. This takes a lot of time and it will require generating static files, which takes even longer. Since this is unnecessary for the script in this PR, don't include this file when we're building for this purpose.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this. Can I ask we just fix the docs?