smartdown
smartdown copied to clipboard
Add has content node to scenario api.
This will be used to assert against content in a outcome.
Usage
# Description
- name_of_q1_p1: answer_to_q1_p1
- name_of_q1_p2: answer_to_q1_p2
name_of_q2_p2: answer_to_q2_p2
outcome_the_result
has content: "Some content", "Some more content"
I might be missing something, but it feels odd to me that we're using so much regular expression and String manipulation in the ScenarioSetInterpreter
rather than using Parslet rules. This isn't specific to this PR, so shouldn't necessarily prevent this from being merged, but I would like to understand why we're taking this approach.
Stepping back even further, I do worry that we're having to reinvent a lot of wheels in Smartdown - taking this PR as an example, Ruby already does a good job of interpreting an array of strings in various forms.
The use of regex in ScenarioSetInterpreter
was down to time pressures, and that the complexity of scenarios has grown since the initial implementation. I'd be happy to see it implemented with Parslet, when time allows.
Not using Ruby is the point of Smartdown, hence having to re-invent some wheels. As i explained, the two aims of Smartdown where:
- a syntax that mirrored how content designers think/interact with content, as they're the ultimate owners of smart-answers, not developers
- a safe representation that can be authored by non-developrs, be exposed via an API (to match the new-world GOV.UK publishing stack), and executed safely and securely.
Hopefully thats clearer?