-
Notifications
You must be signed in to change notification settings - Fork 158
Don't enforce unique filenames for documentation extensions #863
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
Don't enforce unique filenames for documentation extensions #863
Conversation
Since documentation extensions' filenames have no impact on the URL of any pages, there's no need to enforce unique filenames for them. DocC currently uses only the filename / last path component of articles to determine if there is a duplicate article. This change excludes doc extensions from that check to allow documentation extensions to have the same filename. rdar://117174884
Checks that doc extensions with the same filename do not produce a warning and DocC no longer drops the content from one of the files.
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.
LGTM
// Separate articles that look like documentation extension files from other articles, so that the documentation extension files can be matched up with a symbol. | ||
// At this point we consider all articles with an H1 containing link "documentation extension" - some links might not resolve in the final documentation hierarchy | ||
// and we will emit warnings for those later on when we finalize the bundle discovery phase. | ||
if result.value.title?.child(at: 0) is AnyLink { |
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.
From what I can tell, isDocumentationExtension ((analyzed as? Article)?.title?.child(at: 0) is AnyLink
) should be equivalent to result.value.title?.child(at: 0) is AnyLink
, so this change hopefully improves readability, but I'd appreciate an extra pair of eyes to be sure I'm not missing something.
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.
Yep - we check a few lines above that if let article = analyzed as? Article
, so we know that the analyzed node is an Article, and also therefore a Semantic. SemanticResult
is just a simple struct holding the article as value
and a couple other values. So we know that result.value
is just article
which is just analyzed as? Article
.
The rest of the expression is the same, so yea your simplification is good I think 👍
@swift-ci Please test |
…g#863) * Allow documentation extensions to have the same name Since documentation extensions' filenames have no impact on the URL of any pages, there's no need to enforce unique filenames for them. DocC currently uses only the filename / last path component of articles to determine if there is a duplicate article. This change excludes doc extensions from that check to allow documentation extensions to have the same filename. rdar://117174884 * Add test to ensure doc extensions can have the same filename Checks that doc extensions with the same filename do not produce a warning and DocC no longer drops the content from one of the files.
) * Allow documentation extensions to have the same name Since documentation extensions' filenames have no impact on the URL of any pages, there's no need to enforce unique filenames for them. DocC currently uses only the filename / last path component of articles to determine if there is a duplicate article. This change excludes doc extensions from that check to allow documentation extensions to have the same filename. rdar://117174884 * Add test to ensure doc extensions can have the same filename Checks that doc extensions with the same filename do not produce a warning and DocC no longer drops the content from one of the files.
Fix typo in RenderContentCompilerTests resolve some PR feedback Update Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift Co-authored-by: David Rönnqvist <[email protected]> add tests with multiple variants of thematic breaks Don't enforce unique filenames for documentation extensions (swiftlang#863) * Allow documentation extensions to have the same name Since documentation extensions' filenames have no impact on the URL of any pages, there's no need to enforce unique filenames for them. DocC currently uses only the filename / last path component of articles to determine if there is a duplicate article. This change excludes doc extensions from that check to allow documentation extensions to have the same filename. rdar://117174884 * Add test to ensure doc extensions can have the same filename Checks that doc extensions with the same filename do not produce a warning and DocC no longer drops the content from one of the files. Update the year in license headers Bump patch version
Fix typo in RenderContentCompilerTests resolve some PR feedback Update Sources/SwiftDocC/Model/Rendering/Content/RenderBlockContent.swift Co-authored-by: David Rönnqvist <[email protected]> add tests with multiple variants of thematic breaks Don't enforce unique filenames for documentation extensions (swiftlang#863) * Allow documentation extensions to have the same name Since documentation extensions' filenames have no impact on the URL of any pages, there's no need to enforce unique filenames for them. DocC currently uses only the filename / last path component of articles to determine if there is a duplicate article. This change excludes doc extensions from that check to allow documentation extensions to have the same filename. rdar://117174884 * Add test to ensure doc extensions can have the same filename Checks that doc extensions with the same filename do not produce a warning and DocC no longer drops the content from one of the files. Update the year in license headers Bump patch version
Bug/issue #, if applicable: rdar://117174884
Summary
Currently, if any two articles have the same filename, DocC will warn for one of the files that it is a redeclaration and the file will be skipped. Article filenames need to be unique because those base names are used for the article's URL which need to be unique. However, documentation extensions' filenames have no impact on the URLs of any pages, so there's no need to enforce unique filenames for them.
This change skips the enforcement of unique filenames for documentation extensions to allow doc extensions to have the same filenames and for a doc extension to have the same filename as an article.
Testing
Steps:
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded