-
Notifications
You must be signed in to change notification settings - Fork 16
Add option to define a file-specific comment to be added to all strings in a file #21
base: master
Are you sure you want to change the base?
Conversation
a342b79 to
5861c2e
Compare
|
There should be a way to disable this, I'd do this by making the |
cli/index.js
Outdated
| var inputComment; | ||
|
|
||
| var input = fs.readFileSync( inputFile, 'utf8' ); | ||
| var rxFileCommentMatch = new RegExp( "^//\\s((Screenshot|Example):\\s(.*))$", 'm' ); |
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.
Extend the regex to include http?
Tug
left a comment
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.
Nice addition. Just not sure about throwing an error here, they don't seem to be actually part of any specification.
cli/index.js
Outdated
| if ( validUrl.isWebUri( commentMatches[3] ) ) { | ||
| inputComment = commentMatches[1]; | ||
| } else { | ||
| throw new Error( 'File comment must be a valid web uri' ); |
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.
Do we really want to throw here? Sounds like just skipping the comment silently would be a smoother solution
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.
👍 updated!
… use 'demo' instead of 'example' which is imo less likely to already serve another purpose
e1b8859 to
a601643
Compare
The goal of this PR is to enable developers to add either a screenshot or a public example link to their files, to assist translators:
For example a Calypso block could link to its render in devdocs, by adding the following comment
// Screenshot URL: https://cloudup.com/c5SgAxNZEoMor
// Demo URL: https://wpcalypso.wordpress.com/devdocs/blocks/author-selectorIf a string already has a comment, it will be appended.