chore: pager AnsiEsc
This commit is contained in:
@@ -162,9 +162,6 @@
|
|||||||
pg-17-hemar = buildHemarExt pkgs "17";
|
pg-17-hemar = buildHemarExt pkgs "17";
|
||||||
c-hectic = pkgs.callPackage ./package/c/hectic/default.nix {};
|
c-hectic = pkgs.callPackage ./package/c/hectic/default.nix {};
|
||||||
watch = pkgs.callPackage ./package/c/watch/default.nix {};
|
watch = pkgs.callPackage ./package/c/watch/default.nix {};
|
||||||
hmpl = pkgs.callPackage ./package/c/hmpl/default.nix {
|
|
||||||
hectic = self.packages.${system}.hectic;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells.${system} = let
|
devShells.${system} = let
|
||||||
|
|||||||
@@ -1540,6 +1540,8 @@ render_template(TemplateNode *node, Jsonb *define, StringInfo result, MemoryCont
|
|||||||
/* Convert to Jsonb */
|
/* Convert to Jsonb */
|
||||||
Jsonb *context_jsonb = JsonbValueToJsonb(res);
|
Jsonb *context_jsonb = JsonbValueToJsonb(res);
|
||||||
|
|
||||||
|
elog(DEBUG1, "Context JSONB: %s", JsonbToCString(NULL, &context_jsonb->root, VARSIZE_ANY_EXHDR(context_jsonb)));
|
||||||
|
|
||||||
/* Render the section body with the new context */
|
/* Render the section body with the new context */
|
||||||
render_template(current->value->section.body, context_jsonb, result, context);
|
render_template(current->value->section.body, context_jsonb, result, context);
|
||||||
|
|
||||||
|
|||||||
@@ -356,6 +356,30 @@ identation1
|
|||||||
RAISE WARNING 'Test %: Tabs: FAILED with error: %', total_tests, SQLERRM;
|
RAISE WARNING 'Test %: Tabs: FAILED with error: %', total_tests, SQLERRM;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
-- Test 18: Context
|
||||||
|
total_tests := total_tests + 1;
|
||||||
|
BEGIN
|
||||||
|
test_result := hemar.render(
|
||||||
|
'{"value": 12, "array": [1, 2, 3]}'::jsonb,
|
||||||
|
'
|
||||||
|
{{for item in array}}
|
||||||
|
{{exec RETURN context::TEXT}}
|
||||||
|
{{end}}
|
||||||
|
'
|
||||||
|
);
|
||||||
|
expected := '
|
||||||
|
';
|
||||||
|
|
||||||
|
IF test_result = expected THEN
|
||||||
|
RAISE NOTICE 'Test %: Context: PASSED', total_tests;
|
||||||
|
passed_tests := passed_tests + 1;
|
||||||
|
ELSE
|
||||||
|
RAISE WARNING 'Test %: Context: FAILED. Expected "%", got "%"', total_tests, expected, test_result;
|
||||||
|
END IF;
|
||||||
|
EXCEPTION WHEN OTHERS THEN
|
||||||
|
RAISE WARNING 'Test %: Context: FAILED with error: %', total_tests, SQLERRM;
|
||||||
|
END;
|
||||||
|
|
||||||
-- Print summary
|
-- Print summary
|
||||||
IF passed_tests = total_tests THEN
|
IF passed_tests = total_tests THEN
|
||||||
RAISE NOTICE '------------------------------------';
|
RAISE NOTICE '------------------------------------';
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
{pkgs, ...}:
|
{pkgs, ...}:
|
||||||
pkgs.writeShellScriptBin "pager" ''
|
pkgs.writeShellScriptBin "pager" ''
|
||||||
nvim -R --clean -c 'set buftype=nofile' -c 'nnoremap q :q!<CR>' -c 'set nowrap' \
|
nvim -R --clean NONE \
|
||||||
-c 'set runtimepath^=${pkgs.vimPlugins.vim-plugin-AnsiEsc}' \
|
-c 'nnoremap q :q!<CR>' \
|
||||||
-c 'runtime! plugin/*.vim' -c 'AnsiEsc' - $@
|
-c 'set buftype=nofile nowrap' \
|
||||||
# ^^^^^^^^^^^^^^^^^^^^
|
-c 'set runtimepath^=${pkgs.vimPlugins.vim-plugin-AnsiEsc}' \
|
||||||
# Prevents Neovim from treating the buffer as a file
|
-c 'runtime! plugin/*.vim' \
|
||||||
# ^^^^^^^^^^^^^^^^^^^^
|
-c 'set conceallevel=3' \
|
||||||
# Makes 'q' quit Neovim immediately
|
-c 'AnsiEsc' $@ -
|
||||||
# ^^^^^^^^^^^
|
|
||||||
# Disables text wrapping
|
|
||||||
# ^^^^^^^^
|
|
||||||
# Enables ANSI color interpretation
|
|
||||||
''
|
''
|
||||||
|
|||||||
Reference in New Issue
Block a user