-
-
Notifications
You must be signed in to change notification settings - Fork 23
Enable annotating contributor roles #75
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
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
8622e3e
Enable annotating contributor roles
cthoyt 7d87128
Merge branch 'main' into contributor-roles
cthoyt 6bd6b41
Update tests
cthoyt 96b5fcb
Update paper.md
cthoyt e46abac
Update paper.md
cthoyt c5f9486
Update paper.md
cthoyt 7e90813
Update paper.md
cthoyt 2409c92
Update jats
cthoyt def8e9f
Update example-doc.yml
cthoyt d8f01a7
Update example-doc.yml
cthoyt f264a87
Update example-doc.yml
cthoyt bdccf16
Update example-doc.yml
cthoyt 9842b47
Update example-doc.yml
cthoyt c7b2333
Update example-doc.yml
cthoyt 1be42fe
Update paper PDFs
cthoyt 61a877f
Update expected-paper.pdf
cthoyt fd43328
Update paper.pdf
cthoyt 2c0f035
Add additional artifacts
cthoyt db3e068
Update PDFs
cthoyt c87ceb8
safasf
cthoyt 83226c7
Merge remote-tracking branch 'upstream/main' into contributor-roles
cthoyt 20ccefd
Merge remote-tracking branch 'upstream/main' into contributor-roles
cthoyt 59f05e2
Update paper.tex
cthoyt 4675ee7
Update paper.tex
cthoyt 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 hidden or 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 hidden or 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 hidden or 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,2 @@ | ||
| #!/bin/sh | ||
| JOURNAL=joss OPENJOURNALS_PATH=/Users/cthoyt/dev/inara sh ./scripts/entrypoint.sh -v ./example/paper.md |
This file contains hidden or 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 hidden or 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 hidden or 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,86 @@ | ||
| -- Checks if any contributor information is available | ||
|
|
||
| roles = pandoc.List { | ||
| "conceptualization", | ||
| "data-curation", | ||
| "formal-analysis", | ||
| "funding-acquisition", | ||
| "investigation", | ||
| "methodology", | ||
| "project-administration", | ||
| "resources", | ||
| "software", | ||
| "supervision", | ||
| "validation", | ||
| "visualization", | ||
| "writing-original-draft", | ||
| "writing-review-editing" | ||
| } | ||
|
|
||
| degrees = pandoc.List { | ||
| "Lead", | ||
| "Supporting", | ||
| "Equal" | ||
| } | ||
|
|
||
| function invalidRole(str) | ||
| return not roles:includes(str) | ||
| end | ||
|
|
||
| function invalidDegree(str) | ||
| return not degrees:includes(str) | ||
| end | ||
|
|
||
| function join_with_commas_and(list) | ||
| local len = #list | ||
| if len == 0 then | ||
| return "" | ||
| elseif len == 1 then | ||
| return list[1] | ||
| elseif len == 2 then | ||
| return list[1] .. " and " .. list[2] | ||
| else | ||
| local result = table.concat(list, ", ", 1, len - 1) | ||
| return result .. ", and " .. list[len] | ||
| end | ||
| end | ||
|
|
||
| function capitalize_first_letter(str) | ||
| return str:sub(1, 1):upper() .. str:sub(2) | ||
| end | ||
|
|
||
| function clean_role_dict(d) | ||
| if d.type then | ||
| return d | ||
| else | ||
| return {["type"] = pandoc.utils.stringify(d)} | ||
| end | ||
| end | ||
|
|
||
| function Meta (meta) | ||
| meta.hasRoles = false | ||
| for _, author in ipairs(meta.authors or {}) do | ||
| if author.roles then | ||
| meta.hasRoles = true | ||
| roleList = {} | ||
| for _, roleDict in ipairs(author.roles) do | ||
| roleDict = clean_role_dict(roleDict) | ||
| role = pandoc.utils.stringify(roleDict.type) | ||
| if invalidRole(role) then | ||
| error("invalid role for author " .. author.name .. ": " .. role) | ||
|
Collaborator
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. I'm not sure how errors are handled by editorial-bot. @xuanxu, what happens if the conversion fails, would the authors see this error message? |
||
| end | ||
| if roleDict.degree then | ||
| degree = capitalize_first_letter(pandoc.utils.stringify(roleDict.degree)) | ||
| if invalidDegree(degree) then | ||
| error("invalid degree for author " .. author.name .. ": " .. degree) | ||
| end | ||
| table.insert(roleList, role .. " (" .. degree .. ")") | ||
| else | ||
| table.insert(roleList, role) | ||
| end | ||
| end | ||
| author.rolesString = join_with_commas_and(roleList) | ||
| end | ||
| end | ||
| return meta | ||
| end | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.