Skip to content
This repository was archived by the owner on Feb 22, 2019. It is now read-only.

Conversation

@yoavf
Copy link
Contributor

@yoavf yoavf commented Oct 6, 2016

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/c5SgAxNZEoM
or
// Demo URL: https://wpcalypso.wordpress.com/devdocs/blocks/author-selector
If a string already has a comment, it will be appended.

@akirk
Copy link
Member

akirk commented Oct 7, 2016

There should be a way to disable this, I'd do this by making the Screenshot and Example keywords configurable (that's the default but you can run it with a command line option that disables it?)

cli/index.js Outdated
var inputComment;

var input = fs.readFileSync( inputFile, 'utf8' );
var rxFileCommentMatch = new RegExp( "^//\\s((Screenshot|Example):\\s(.*))$", 'm' );
Copy link
Member

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?

Copy link
Contributor

@Tug Tug left a 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' );
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 updated!

@yoavf yoavf force-pushed the add/default-comment-per-file branch from e1b8859 to a601643 Compare September 24, 2017 11:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants