From 19d58268d2a98524997ff0e331f2f028f0cfb08f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helmut=20H=C3=A4nsel?= Date: Thu, 26 Oct 2023 23:54:35 +0200 Subject: [PATCH] use macro aliasing to be compatible with all Julia versions --- src/Elements.jl | 47 +++++++++-------------------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/src/Elements.jl b/src/Elements.jl index 1bae55d1..6f69ed05 100644 --- a/src/Elements.jl +++ b/src/Elements.jl @@ -169,11 +169,12 @@ julia> span("Bad stuff's about to happen", class="warning", @if(:warning)) "Bad stuff's about to happen" ``` """ -macro var"if"(expr) +macro iif(expr) Expr(:kw, Symbol("v-if"), esc_expr(expr)) end +const var"@if" = var"@iif" -""" + """ @elseif(expr) Generates `v-else-if` Vue.js code using `expr` as the condition. @@ -186,9 +187,10 @@ julia> span("An error has occurred", class="error", @elseif(:error)) "An error has occurred" ``` """ -macro var"elseif"(expr) +macro elsiif(expr) Expr(:kw, Symbol("v-else-if"), esc_expr(expr)) end +const var"@elseif" = var"@elsiif" """ @else(expr) @@ -203,9 +205,10 @@ julia> span("Might want to keep an eye on this", class="notice", @else(:notice)) "Might want to keep an eye on this" ``` """ -macro var"else"(expr) +macro els(expr) Expr(:kw, Symbol("v-else"), esc_expr(expr)) end +const var"@else" = var"@els" """ Generates `v-for` directive to render a list of items based on an array. @@ -218,43 +221,11 @@ julia> p(" {{todo}} ", class="warning", @for(:"todo in todos")) "

\n {{todo}} \n

\n" ``` -""" -macro var"for"(expr) - Expr(:kw, Symbol("v-for"), esc_expr(expr)) -end - - -""" -`@recur` is deprecated and has been replaced by `@for`. -It is kept for compatibility reasons and will be removed in a future release. -""" -macro iif(expr) - esc(:(@if($expr))) -end - -""" -`@recur` is deprecated and has been replaced by `@for`. -It is kept for compatibility reasons and will be removed in a future release. -""" -macro els(expr) - esc(:(@else($expr))) -end - -""" -`@recur` is deprecated and has been replaced by `@for`. -It is kept for compatibility reasons and will be removed in a future release. -""" -macro elsiif(expr) - esc(:(@elseif($expr))) -end - -""" -`@recur` is deprecated and has been replaced by `@for`. -It is kept for compatibility reasons and will be removed in a future release. """ macro recur(expr) - esc(:(@for($expr))) + Expr(:kw, Symbol("v-for"), esc_expr(expr)) end +const var"@for" = var"@recur" """ @text(expr)