Compare commits

...

2 Commits

Author SHA1 Message Date
Max Richter
2b965cb8f7 feat: handle []string or string for pathAlias
All checks were successful
Build and Push Server / build-and-push (push) Successful in 2m52s
2025-10-24 11:44:57 +02:00
Max Richter
cb40a76eeb chore: update playground 2025-10-24 11:36:15 +02:00
15 changed files with 76 additions and 50 deletions

Binary file not shown.

View File

@@ -22,8 +22,7 @@
- path: datePublished
- path: articleSection
- path: reviewRating.ratingValue
pathAlias:
- rating
pathAlias: rating
- path: reviewRating.bestRating
value: 5
codec: const

View File

@@ -17,12 +17,10 @@
hidden: true
value: Person
- path: author.name
pathAlias:
- author
pathAlias: author
- path: author.email
- path: datePublished
pathAlias:
- date
pathAlias: date
- path: prepTime
- path: cookTime
- path: recipeYield

View File

@@ -19,11 +19,9 @@
value: Person
hidden: true
- path: datePublished
pathAlias:
- date
pathAlias: date
- path: reviewRating.ratingValue
pathAlias:
- rating
pathAlias: rating
- path: reviewRating.bestRating
codec: const
value: 5

View File

@@ -0,0 +1 @@
import{l as o,a as r}from"../chunks/Dqs1i6nG.js";export{o as load_css,r as start};

View File

@@ -1 +0,0 @@
import{l as o,a as r}from"../chunks/Br1P42TZ.js";export{o as load_css,r as start};

View File

@@ -1 +1 @@
import"../chunks/DsnmJJEf.js";import{i as u}from"../chunks/kadZwC1X.js";import{p as h,o as g,k as l,t as v,l as d,q as x,v as e,x as a,y as _}from"../chunks/bc36GTfJ.js";import{s as o}from"../chunks/B1lAeocp.js";import{s as k,p}from"../chunks/Br1P42TZ.js";const $={get error(){return p.error},get status(){return p.status}};k.updated.check;const m=$;var b=g("<h1> </h1> <p> </p>",1);function z(i,n){h(n,!1),u();var r=b(),t=l(r),c=e(t,!0);a(t);var s=_(t,2),f=e(s,!0);a(s),v(()=>{o(c,m.status),o(f,m.error?.message)}),d(i,r),x()}export{z as component};
import"../chunks/DsnmJJEf.js";import{i as u}from"../chunks/kadZwC1X.js";import{p as h,o as g,k as l,t as v,l as d,q as x,v as e,x as a,y as _}from"../chunks/bc36GTfJ.js";import{s as o}from"../chunks/B1lAeocp.js";import{s as k,p}from"../chunks/Dqs1i6nG.js";const $={get error(){return p.error},get status(){return p.status}};k.updated.check;const m=$;var b=g("<h1> </h1> <p> </p>",1);function z(i,n){h(n,!1),u();var r=b(),t=l(r),c=e(t,!0);a(t);var s=_(t,2),f=e(s,!0);a(s),v(()=>{o(c,m.status),o(f,m.error?.message)}),d(i,r),x()}export{z as component};

View File

@@ -1 +1 @@
{"version":"1760178006718"}
{"version":"1761298975653"}

View File

@@ -6,16 +6,16 @@
<link href="./_app/immutable/assets/0.z6k2NkFs.css" rel="stylesheet">
<link href="./_app/immutable/assets/2.DQ5mJGGf.css" rel="stylesheet">
<link rel="modulepreload" href="./_app/immutable/entry/start.DsQ6_q0N.js">
<link rel="modulepreload" href="./_app/immutable/chunks/Br1P42TZ.js">
<link rel="modulepreload" href="./_app/immutable/entry/start.DXq0HO7Q.js">
<link rel="modulepreload" href="./_app/immutable/chunks/Dqs1i6nG.js">
<link rel="modulepreload" href="./_app/immutable/chunks/B1lAeocp.js">
<link rel="modulepreload" href="./_app/immutable/chunks/bc36GTfJ.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.BPb8TaDv.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.DiY95TQA.js">
<link rel="modulepreload" href="./_app/immutable/chunks/DsnmJJEf.js">
<link rel="modulepreload" href="./_app/immutable/chunks/DyoUZ9Ht.js">
<link rel="modulepreload" href="./_app/immutable/nodes/0.BxuPCyXV.js">
<link rel="modulepreload" href="./_app/immutable/chunks/DyOAiIET.js">
<link rel="modulepreload" href="./_app/immutable/nodes/2.42-dS2Hb.js">
<link rel="modulepreload" href="./_app/immutable/nodes/2.jl401D1B.js">
<link rel="modulepreload" href="./_app/immutable/chunks/kadZwC1X.js"><!--[--><link rel="icon" href="data:image/svg+xml,%3csvg%20width='202'%20height='202'%20viewBox='0%200%20202%20202'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M198%20101C198%2047.4284%20154.572%204%20101%204C63.6769%204%2031.2771%2025.0794%2015.0566%2055.9824C31.5802%2036.8304%2058.3585%2025%2087.5%2025C107.135%2025%20125.868%2030.5962%20141.081%2040.3643C163.17%2054.5475%20177.915%2077.5995%20176.999%20105.066C176.961%20122.231%20171.229%20138.064%20161.595%20150.771L159.861%20153.057L133.999%20112.606L100.778%20164.568L65.0068%20108.618L42.0176%20144.873C57.3037%20166.504%2084.4388%20181%20114.5%20181C149.395%20181%20180.331%20159.267%20193.398%20130.6C196.385%20121.268%20198%20111.323%20198%20101ZM29.0127%20106.222C29.2632%20118.862%2033.0866%20130.771%2039.5967%20141.223L64.9932%20101.171L100.778%20157.143L134%20105.182L160.106%20146.016C168.233%20134.357%20173%20120.186%20173%20104.895H173.002C173.825%2079.7876%20160.762%2058.4662%20140.614%2044.8486L101%20108.688L61.3604%2044.7793C41.8587%2057.6651%2029%2079.7788%2029%20104.895L29.0127%20106.222ZM202%20101C202%20156.781%20156.781%20202%20101%20202V198C134.1%20198%20163.327%20181.42%20180.831%20156.113C164.258%20173.559%20140.379%20185%20114.5%20185C82.6725%20185%2053.8784%20169.41%2037.9658%20146.05C30.0365%20134.409%2025.3017%20120.829%2025.0137%20106.303L25%20104.895C25%2077.6227%2039.3659%2053.7077%2060.9336%2040.3018L62.6338%2039.2441L101%20101.101L137.249%2042.6855C123.002%2033.9863%20105.671%2029%2087.5%2029C51.3264%2029%2019.6837%2047.7188%207.41992%2075.377C5.19019%2083.5392%204%2092.1306%204%20101C4%20154.572%2047.4284%20198%20101%20198V202C45.2192%20202%200%20156.781%200%20101C0%2045.2192%2045.2192%200%20101%200C156.781%200%20202%2045.2192%20202%20101Z'%20fill='%23555'/%3e%3c/svg%3e"/> <script src="/_playground/wasm_exec.js"></script><!--]--><title>Marka Playground</title>
</head>
<body data-sveltekit-preload-data="hover">
@@ -39,7 +39,7 @@ My favourite baguette recipe
<script>
{
__sveltekit_6mqoqb = {
__sveltekit_fb1f8c = {
base: new URL(".", location).pathname.slice(0, -1),
assets: "/_playground"
};
@@ -47,8 +47,8 @@ My favourite baguette recipe
const element = document.currentScript.parentElement;
Promise.all([
import("./_app/immutable/entry/start.DsQ6_q0N.js"),
import("./_app/immutable/entry/app.BPb8TaDv.js")
import("./_app/immutable/entry/start.DXq0HO7Q.js"),
import("./_app/immutable/entry/app.DiY95TQA.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 2],

Binary file not shown.

View File

@@ -8,21 +8,21 @@ import (
)
type yamlBlock struct {
Path string `yaml:"path"`
Codec string `yaml:"codec"`
Value any `yaml:"value,omitempty"`
Fields []yamlField `yaml:"fields"`
ListTemplate string `yaml:"listTemplate,omitempty"`
Hidden bool `yaml:"hidden,omitempty"`
PathAlias []string `yaml:"pathAlias,omitempty"`
Path string `yaml:"path"`
Codec string `yaml:"codec"`
Value any `yaml:"value,omitempty"`
Fields []yamlField `yaml:"fields"`
ListTemplate string `yaml:"listTemplate,omitempty"`
Hidden bool `yaml:"hidden,omitempty"`
PathAlias StringOrSlice `yaml:"pathAlias,omitempty"`
}
type yamlField struct {
Path string `yaml:"path"`
Value any `yaml:"value,omitempty"`
Codec string `yaml:"codec"`
Hidden bool `yaml:"hidden,omitempty"`
PathAlias []string `yaml:"pathAlias,omitempty"`
Path string `yaml:"path"`
Value any `yaml:"value,omitempty"`
Codec string `yaml:"codec"`
Hidden bool `yaml:"hidden,omitempty"`
PathAlias StringOrSlice `yaml:"pathAlias,omitempty"`
}
func parseYamlTemplate(input Slice) (block Block, err error) {

31
template/yaml_types.go Normal file
View File

@@ -0,0 +1,31 @@
package template
import "errors"
type StringOrSlice []string
func (s *StringOrSlice) UnmarshalYAML(unmarshal func(any) error) error {
var single string
if err := unmarshal(&single); err == nil {
if single == "" {
*s = nil
return nil
}
*s = []string{single}
return nil
}
var multi []string
if err := unmarshal(&multi); err == nil {
*s = multi
return nil
}
var nothing *struct{}
if err := unmarshal(&nothing); err == nil {
*s = nil
return nil
}
return errors.New("expected string, []string, or null")
}