Skip to content
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

Generate: slugs with numbers break generation #663

Closed
jiegillet opened this issue Sep 24, 2022 · 1 comment · Fixed by #664
Closed

Generate: slugs with numbers break generation #663

jiegillet opened this issue Sep 24, 2022 · 1 comment · Fixed by #664
Assignees
Labels
kind: bug User-facing incorrect behavior

Comments

@jiegillet
Copy link

jiegillet commented Sep 24, 2022

Hi!
I was trying to do the equivalent of this PR in the Elm track, but I ran into an issue.
We have concepts named basics-1 and basics-2, which makes configlet generate break.

For the concept exercise lucians-luscious-lasagna, I wrote the introduction.md.tpl as

# Introduction

%{concept: basics-1}

But after generation the introduction.md is

# Introduction

1}

The culprit probably is

if scanp(content, i,
"%{", *{' '}, "concept", *{' '}, ':', *{' '},
+{'a'..'z', '-'} -> conceptSlug.add($_), *{' '}, '}'):

It seems that it would be easy enough to support numbers, is that an option?

@ee7
Copy link
Member

ee7 commented Sep 27, 2022

Good catch - thanks.

It seems that it would be easy enough to support numbers, is that an option?

Yes, I believe we should do this.

In lint.md we specify that:

The "concepts[].slug" value must be a kebab-case string² with length <= 255

and that a kebab-case string can contain digits:

kebab-case string: a string that contains only characters in the range [a-z0-9], optionally separated by dashes (e.g. "two-fer"). It must match the regular expression: ^[a-z0-9]+(-[a-z0-9]+)*$

So configlet generate should support a concept slug that contains a digit in the placeholder.

@ee7 ee7 self-assigned this Sep 27, 2022
@ee7 ee7 added the kind: bug User-facing incorrect behavior label Sep 27, 2022
@ee7 ee7 closed this as completed in #664 Oct 4, 2022
ee7 added a commit that referenced this issue Oct 4, 2022
A concept slug is allowed to contain digits [1]:

    The `concepts[].slug` value must be a kebab-case string with length <= 255

    [...]

    kebab-case string: a string that [...] must match the regular expression: `^[a-z0-9]+(-[a-z0-9]+)*$`

but `configlet generate` did not support such a slug.

With this commit, `configlet generate` now behaves as expected for an
`introduction.md.tpl` file like:

    # Introduction

    %{concept: basics-1}

[1] https://github.com/exercism/docs/blob/ba3eba34d334/building/configlet/lint.md#glossary

Fixes: #663
@ee7 ee7 moved this to Done in Configlet roadmap Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug User-facing incorrect behavior
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants