-
Notifications
You must be signed in to change notification settings - Fork 482
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
Allow for duplicate docstrings in @docs
and @autodocs
, issue #1079
#1570
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7c93348
Allow for duplicate docstrings in and blocks; index has include_str
manuelbb-upb f4a0b49
remove UUIDs, not needed
manuelbb-upb 7c21c42
missing "^" in regex for
manuelbb-upb a3c5cb4
Merge branch 'master' into master
manuelbb-upb b92a319
Merge branch 'master' into master
fredrikekre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 | ||||
---|---|---|---|---|---|---|
|
@@ -7,7 +7,7 @@ using Base.Meta | |||||
import Base: isdeprecated, Docs.Binding | ||||||
using DocStringExtensions | ||||||
import Markdown, LibGit2 | ||||||
import Base64: stringmime | ||||||
import Base64: stringmime, base64encode | ||||||
import ..ERROR_NAMES | ||||||
|
||||||
# escape characters that has a meaning in regex | ||||||
|
@@ -218,9 +218,11 @@ struct Object | |||||
binding :: Binding | ||||||
signature :: Type | ||||||
|
||||||
function Object(b::Binding, signature::Type) | ||||||
id_str :: AbstractString | ||||||
|
||||||
function Object(b::Binding, signature::Type, i_s :: AbstractString = "") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
m = nameof(b.mod) === b.var ? parentmodule(b.mod) : b.mod | ||||||
new(Binding(m, b.var), signature) | ||||||
new(Binding(m, b.var), signature, base64encode(i_s) ) | ||||||
end | ||||||
end | ||||||
|
||||||
|
@@ -256,7 +258,9 @@ end | |||||
function Base.print(io::IO, obj::Object) | ||||||
print(io, obj.binding) | ||||||
print_signature(io, obj.signature) | ||||||
print_id(io, obj.id_str) | ||||||
end | ||||||
print_id(io::IO, id :: AbstractString ) = isempty(id) ? nothing : print(io, '-', id) | ||||||
print_signature(io::IO, signature::Union{Union, Type{Union{}}}) = nothing | ||||||
print_signature(io::IO, signature) = print(io, '-', signature) | ||||||
|
||||||
|
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.
Perhaps the syntax should be
instead? I think that pattern is used elsewhere for e.g. doctest filters etc.
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.
Also, do you ever care about the
id
or just that it is unique?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.
Maybe the current approach follows the idea that is used in example blocks? there the id/name for continued examples is also just added with a space.
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.
Yea that's true.
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.
If I remember correctly, I need the
id_str
for the filtering mechanism in@index
blocks.This filtering should allow to
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.
is it ever useful to have index with duplicates though? Perhaps there should be a canonical
@docs
block or 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.
I guess not, and I am not sure myself anymore what I wanted this feature for.
I think it was primarily meant for exclusion of docstring subsets, but most of the use cases that come to mind can also be achieved with the
Pages
kw.The only (exotic) example I can think of is a single documentation page that has subsections (possibly containing duplicate docstrings in
@docs
blocks) and an@index
is meant to be created for each subsection.