-
Notifications
You must be signed in to change notification settings - Fork 38
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
Accept last_reviewed_on field as a string input #302
Comments
Hi @laurahiles any idea how long it will take to implement the change? I can share the code and test if it helps |
Upstream tecg-docs gem with rub 2.7.2 is set up to expect dates as "yyyy-mm-dd" which are incompatible with ruby 3.x nd dependency updates - see alphagov/tech-docs-gem#302 for more details. Until upstream is fixed, we're removing the review date frontmatter from the only place we use it, so that we can upgrade to a non-vulnerable ruby version
Thanks for raising this Nick. I've done a bit of digging, and to summarise the issue as I understand it:
I have an untested hypothesis that this is fixed in middleman 4.4.3, because they switched to You could still make a strong argument that this gem should support both strings and dates, since middleman's docs clearly suggest that weird stringy date formats are permitted. |
@LeePorte reports that the issue is still present with middleman 4.4.3 however. |
Hello @richardTowers thanks for having a look at this. Your summary make perfect sense, I do remember the The repo is using Middleman 4.4.2 at the moment, Gemfile.lock, so if it does get fixed in that dependency I can bump the version but we do have some other dependency issues in the Gemfile. The repo is using govuk_tech_docs (3.2.1). Due to these issues we paused updating the repo. I do not have my branch with the fix anymore. Is it likely a fix will be applied? |
It's at least on our radar now, I can't promise we'll get to it immediately though. |
I've raised middleman/middleman#2614 with middleman. We should still consider supporting strings, irrespective of whether they decide to fix this. |
Ah, so has this broken building docs completely now? |
Could you point me towards where this is documented? |
Hi @lfdebrux my notes on the topic are here. I am not sure where the documentation is for Middleman. There is this page that states: "If you want, you can specify a full date and time as a date entry in the front matter, to help with ordering multiple posts from the same day. " and has the date as |
Cool, thanks for the added context. Apologies, when I first looked at this ticket I thought it was solely a feature request, I didn't realise that the issue was preventing the docs from building the site even if the date was formatted correctly. My main concern in allowing a string for the I think it might be safer to use |
Hi @lfdebrux
|
I'd be fine with restricting dates to The issue is that if you put a date in your frontmatter like:
Middleman will parse this YAML using I don't think the tech docs gem gets involved early enough in the loading of a template to fiddle with the YAML frontmatter before it's parsed (but maybe it does?). I guess we could also consider monkey patching middleman while we wait for a release... 🙈 |
Looking at the Middleman commit history and the last tag release date, I can't see a new release soon, happy to wait for a new one as the docs work with the older version of Ruby, but 2.7 will be phased out soon: Ruby 2.7 Ruby 2.6 |
Right, thanks for spelling it out for me @richardTowers. How frustrating. |
There's now a release of Middleman with support for Ruby 3.1 - v4.5.0. In theory, this bug should be fixed on middleman 4.5.0, but I haven't tested it yet. |
Hi @richardTowers thanks for the update, nice, we will give it a try with the new versions |
I ran |
What should change
Accept the use of last_reviewed_on field as a string input in any string variation; 2021/02/23, March 2027 23, January 13 2020, rather than a Date data type only. Whilst updating dependencies in the repositories listed in the next section I have found exceptions regarding the last_reviewed_on field as shown here. It appears that middleman expects the Date to be 2021/02/23 as highlighted on this page but the embedded ruby in this repository expects it to be 2021-02-23 as a Date object. As this field causes an exception it makes the title field fail causing the real error to be hidden by middleman asking for H1 tags when <%= current_page.data.title %> is used in the html file.
It currently fails here and the fix is to accept the string that is converted to a Date object:
User need
At MoJ we are using the tech-docs-gem in this repository to publish our template documents based on this template repository. We have many html pages that are utilising the tech-docs-gem to generate the html sites.
I have modified the tech-docs-gem ruby code and tested it works with both a string and a Date object.
The text was updated successfully, but these errors were encountered: