Skip to content

Commit

Permalink
add tldr 110
Browse files Browse the repository at this point in the history
  • Loading branch information
gutjuri committed Mar 18, 2024
1 parent 789da3e commit c9931db
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ TLDR106 | Page title should start with a hash (`#`)
TLDR107 | File name should end with `.md` extension
TLDR108 | File name should not contain whitespace
TLDR109 | File name should be lowercase
TLDR110 | Command example should not be empty

[npm-url]: https://www.npmjs.com/package/tldr-lint
[npm-image]: https://img.shields.io/npm/v/tldr-lint.svg
Expand Down
1 change: 1 addition & 0 deletions lib/tldr-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports.ERRORS = parser.ERRORS = {
'TLDR107': 'File name should end with .md extension',
'TLDR108': 'File name should not contain whitespace',
'TLDR109': 'File name should be lowercase',
'TLDR110': 'Command example should not be empty',
};

(function(parser) {
Expand Down
21 changes: 12 additions & 9 deletions lib/tldr-parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions specs/pages/failing/110.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# tar

> Archiving utility.
> Often combined with a compression method, such as gzip or bzip.
> More information: <https://www.gnu.org/software/tar>.
- [c]reate an archive from [f]iles:

``
6 changes: 6 additions & 0 deletions specs/tldr-lint.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ describe('Common TLDR formatting errors', function() {
expect(containsOnlyErrors(errors, 'TLDR109')).toBeTruthy();
expect(errors.length).toBe(1);
});

it('TLDR110\t' + linter.ERRORS.TLDR110, function () {
let errors = lintFile('pages/failing/110.md').errors;
expect(containsOnlyErrors(errors, 'TLDR110')).toBeTruthy();
expect(errors.length).toBe(1);
});
});

describe('TLDR pages that are simply correct', function() {
Expand Down
11 changes: 6 additions & 5 deletions tldr.yy
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ example_commands : example_command -> [$example_command]
-> yy.error(@example_command, 'TLDR105') || $example_commands
;

example_command : BACKTICK example_command_inner BACKTICK -> $example_command_inner
example_command : BACKTICK BACKTICK -> yy.error(@$, 'TLDR110')
| BACKTICK example_command_inner BACKTICK -> $example_command_inner
/* | BACKTICK example_command_inner -> yy.error(@$, 'TLDR103') || $example_command_inner */
;

example_command_inner : COMMAND_TEXT -> $COMMAND_TEXT
| COMMAND_TOKEN -> $COMMAND_TOKEN
| COMMAND_TEXT example_command_inner
-> [].concat(yy.createCommandText($COMMAND_TEXT), $example_command_inner)
| COMMAND_TOKEN example_command_inner
-> [].concat(yy.createToken($COMMAND_TOKEN), $example_command_inner)
| example_command_inner COMMAND_TEXT
-> [].concat($example_command_inner, yy.createCommandText($COMMAND_TEXT))
| example_command_inner COMMAND_TOKEN
-> [].concat($example_command_inner, yy.createToken($COMMAND_TOKEN))
;

0 comments on commit c9931db

Please sign in to comment.