-
-
Notifications
You must be signed in to change notification settings - Fork 73
Markdown support for Perl #399
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
base: main
Are you sure you want to change the base?
Conversation
like with Javascript (the MDG reference implementation), but as there is no `gherkin-generate-tokens` with it, I don't know if it is a feature or a bug.
@@ -60,7 +60,7 @@ sub build { | |||
Cucumber::Messages::Comment->new( | |||
location => $self->get_location($token), | |||
text => $token->matched_text | |||
); | |||
) unless $self->{uri} =~ m/\.md$/; |
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.
This looks weird. Using Javascript as the reference implementation, I can't find and equivalent.
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.
without this change, I got these 2 failures with AST:
diff --unified <(jq "." ../testdata/good/datatables.feature.md.ast.ndjson) <(jq "." acceptance/testdata/good/datatables.feature.md.ast.ndjson)
--- /dev/fd/63 2025-05-22 10:03:41.040493690 +0200
+++ /dev/fd/62 2025-05-22 10:03:41.057491668 +0200
@@ -1,6 +1,14 @@
{
"gherkinDocument": {
- "comments": [],
+ "comments": [
+ {
+ "location": {
+ "column": 1,
+ "line": 7
+ },
+ "text": " | --- | --- |"
+ }
+ ],
"feature": {
"children": [
{
diff --unified <(jq "." ../testdata/good/tags.feature.md.ast.ndjson) <(jq "." acceptance/testdata/good/tags.feature.md.ast.ndjson)
--- /dev/fd/63 2025-05-22 10:06:50.779264232 +0200
+++ /dev/fd/62 2025-05-22 10:06:50.779264232 +0200
@@ -1,6 +1,21 @@
{
"gherkinDocument": {
- "comments": [],
+ "comments": [
+ {
+ "location": {
+ "column": 1,
+ "line": 19
+ },
+ "text": " | ---------- |"
+ },
+ {
+ "location": {
+ "column": 1,
+ "line": 26
+ },
+ "text": " | ---------- |"
+ }
+ ],
"feature": {
"children": [
{
So, currently the Javascript implementation doesn't populate comments
.
I agree with you, this is done in another way that I do with Perl.
Perl implementation has a gherkin-generate-tokens
, so all tokens must fully populate
$self->_set_token_matched( $token,
Comment => { text => $token->line->line_text, indent => 0 } );
With Javascript, it seems that the token Comment
is not complete, and nothing is pushed in the method build
of AstBuilder
.
With token Comment
, token.matchedText
is populated in GherkinClassicTokenMatcher
but not in GherkinInMarkdownTokenMatcher
.
I don't fully understand the Javascript implementation.
I'm not sure if I understand this. I don't think Markdown supports comments. What would a comment in Markdown look like?
Would you be able to add the functionality to generate tokens to the JS implementation? |
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've given this a once over. Other than my remark on the AST builder I don't see anything too odd. But this PR also exceeds my current capacity for in-depth review.
@ehuelsmann would you be so kind?
sorry, I can't. |
🤔 What's changed?
Adding Markdown with Gherkin (MDG) support for Perl.
⚡️ What's your motivation?
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
Javascript is the reference implementation for MDG, but it lacks the
gherkin-generate-tokens
(and the corresponding tests).So, I am not confident with the test suite.
Some points need clarification:
Comment
are skipped when building the AST : bug or feature ?testdata/good/*.feature.md.tokens
from Markdown support for java #377, but there need some changes. So, these files need a review / validation.📋 Checklist:
This text was originally generated from a template, then edited by hand. You can modify the template here.