Skip to content

Commit

Permalink
Fix Clojure template bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
daxida authored and ellnix committed Apr 28, 2024
1 parent c3d4cd9 commit cdace3e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions config/stub_templates/clojure/loopline.clj.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{%- set clj_split = '(filter #(not-empty %) (str/split (read-line) #" "))' -%}
{%- set vars_length = vars | length -%}

{# SINGLE_TYPE #}
Expand All @@ -6,11 +7,11 @@
{%- if var.var_type == "String" or var.var_type == "Word" -%}
{%- set fn = "" -%}
{%- else -%}
{%- set fn = "(map# " ~ type_tokens[var.var_type] ~ ") " -%}
{%- set fn = "map #(" ~ type_tokens[var.var_type] ~ " %) " -%}
{%- endif -%}

(doseq
[{{ var.ident }} {{ fn }}(filter #(not-empty %) (str/split (read-line) #" "))]
[{{ var.ident }} ({{ fn }}{{ clj_split }})]
( ))
{# MULTIPLE_TYPE #}
{%- else -%}
Expand All @@ -29,7 +30,7 @@

(doseq
[{{ idents }} (map (fn [{{ idents }}] [{{ fns | join(sep=" ") }}])
(partition {{ vars_length }} (filter #(not-empty %) (str/split (read-line) #" ")))
(partition {{ vars_length }} {{ clj_split }}))
]
( ))

Expand Down
9 changes: 4 additions & 5 deletions config/stub_templates/clojure/read_many.clj.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@
{%- if var.var_type == "String" or var.var_type == "Word" -%}
{%- set fn = "" -%}
{%- else -%}
{%- set fn = "(map #(" ~ type_tokens[var.var_type] ~ " %) " -%}
{%- set fn = "map #(" ~ type_tokens[var.var_type] ~ " %) " -%}
{%- endif -%}

{{ idents }} {{ fn }}{{ clj_split }}
[{{ idents }}] ({{ fn }}{{ clj_split }})
{% else -%}

{{ idents }}] {{ clj_split }}
[{{ idents }}] {{ clj_split }}
{% for var in vars -%}
{%- if var.var_type != "String" and var.var_type != "Word" -%}
{{ var.ident }} ({{type_tokens[var.var_type]}} {{var.ident}}
{{ var.ident }} ({{type_tokens[var.var_type]}} {{var.ident}})
{% endif -%}
{%- endfor -%}
)
{% endif %}
2 changes: 1 addition & 1 deletion config/stub_templates/clojure/read_one.clj.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

{%- if var.input_comment %}; {{ var.input_comment }}
{% endif -%}
{{ var.ident }} {{ fn }}]
{{ var.ident }} {{ fn }}

0 comments on commit cdace3e

Please sign in to comment.