render: missing trailing newline in template output #33

Closed
opened 2026-06-02 02:14:24 +00:00 by xingyue · 0 comments
Owner

Problem

When rendering nodes with a custom template, the output has no trailing newline, causing consecutive renders to concatenate on the same line.

Reproduce

# Setup
rm -rf /tmp/ocas-render-test && mkdir /tmp/ocas-render-test
H="--home /tmp/ocas-render-test"

# Create schema + template
echo '{"type":"object","properties":{"title":{"type":"string"},"done":{"type":"boolean"}},"required":["title","done"],"additionalProperties":false}' | ocas $H put @ocas/schema -p --json
# → value: 9S7JEYS3FKSDH

ocas $H template set 9S7JEYS3FKSDH --inline "[{{ payload.done | ternary: 'x', ' ' }}] {{ payload.title }}"

# Store two nodes
echo '{"title":"Buy milk","done":false}' | ocas $H put @test/todo -p --json
# → value: 9Y7HKWSYSA7YM
echo '{"title":"Walk dog","done":true}' | ocas $H put @test/todo -p --json
# → value: 3HH7T7FEFBJCX

# Render both
ocas $H render 9Y7HKWSYSA7YM
ocas $H render 3HH7T7FEFBJCX

Actual

[false] Buy milk[true] Walk dog

Two renders concatenated on one line.

Expected

[false] Buy milk
[true] Walk dog

Each render output should end with a newline.

Note

The ternary filter behavior (false/true instead of x/ ) might be a separate issue — or a LiquidJS syntax question. The missing newline is the primary bug here.

## Problem When rendering nodes with a custom template, the output has no trailing newline, causing consecutive renders to concatenate on the same line. ## Reproduce ```bash # Setup rm -rf /tmp/ocas-render-test && mkdir /tmp/ocas-render-test H="--home /tmp/ocas-render-test" # Create schema + template echo '{"type":"object","properties":{"title":{"type":"string"},"done":{"type":"boolean"}},"required":["title","done"],"additionalProperties":false}' | ocas $H put @ocas/schema -p --json # → value: 9S7JEYS3FKSDH ocas $H template set 9S7JEYS3FKSDH --inline "[{{ payload.done | ternary: 'x', ' ' }}] {{ payload.title }}" # Store two nodes echo '{"title":"Buy milk","done":false}' | ocas $H put @test/todo -p --json # → value: 9Y7HKWSYSA7YM echo '{"title":"Walk dog","done":true}' | ocas $H put @test/todo -p --json # → value: 3HH7T7FEFBJCX # Render both ocas $H render 9Y7HKWSYSA7YM ocas $H render 3HH7T7FEFBJCX ``` ## Actual ``` [false] Buy milk[true] Walk dog ``` Two renders concatenated on one line. ## Expected ``` [false] Buy milk [true] Walk dog ``` Each render output should end with a newline. ## Note The `ternary` filter behavior (`false`/`true` instead of `x`/` `) might be a separate issue — or a LiquidJS syntax question. The missing newline is the primary bug here.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/ocas#33