├── .gitignore ├── .merlin ├── .travis.yml ├── CHANGES ├── Makefile ├── README.md ├── _tags ├── blueprint.install ├── blueprint.version.in ├── cli └── blue.ml ├── lib ├── META.in ├── blueprint.ml ├── blueprint.mli ├── blueprint.mllib ├── xmlRope.ml └── xmlRope.mli ├── opam ├── test ├── .gitignore ├── .merlin ├── Makefile ├── README.md ├── _tags ├── attr_add │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── attr_compose │ ├── a.xml │ ├── b.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── attr_empty │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── attr_floating │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── attr_format │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── attr_insert │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── attr_multi │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── attr_open │ ├── err.txt │ ├── in.xml │ ├── out.p.xml │ └── test.sh ├── attr_replace │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── attr_seq │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── attr_tags │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── bad_attr_name │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── bad_compose_scope │ ├── err.txt │ ├── extract.xml │ ├── local.xml │ ├── out.p.xml │ └── test.sh ├── bad_decl_scope │ ├── err.txt │ ├── in.xml │ ├── out.p.xml │ └── test.sh ├── bad_ident_comma │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── bad_insert_name │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── bad_let_name │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── bad_with │ ├── err.txt │ ├── in.xml │ ├── out.p.xml │ └── test.sh ├── bad_xml_no_close │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── closed_fields │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── closed_parent │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── closure_default │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── compose2 │ ├── blog.xml │ ├── meta.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── compose2_closure │ ├── a.xml │ ├── b.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── compose2_closure_nonlocal │ ├── a.xml │ ├── b.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── compose2_closure_shadow │ ├── a.xml │ ├── b.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── compose3 │ ├── a.xml │ ├── b.xml │ ├── c.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── compose3_rec │ ├── a.xml │ ├── b.xml │ ├── c.xml │ ├── err.p.txt │ ├── err.txt │ └── test.sh ├── compose_stdin │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl_double_open │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl_dup │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl_hole_closed │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl_hole_closed_scope │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl_hole_open │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl_hole_open_chained │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl_intro_rec │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── decl_local_let │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── decl_mutual_rec │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── decl_rec │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── default_closure │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── default_empty_insert │ ├── err.txt │ ├── in.xml │ ├── out.p.xml │ └── test.sh ├── default_insert │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── default_open │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── default_rec │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── default_rec_with │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── default_zero_insert │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── else_body_closed │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── else_body_stage │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── else_floating │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── else_hole_stage │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── empty_insert │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── empty_let │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── enoent │ ├── test.sh │ ├── trouble.p.txt │ └── trouble.txt ├── if_body_closed │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── if_body_stage │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── if_empty │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── if_exists_false │ ├── in.xml │ ├── new_success_tmpl │ │ ├── out.p.xml │ │ ├── out.xml │ │ └── test.sh │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── if_exists_now_false │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── if_exists_now_true │ ├── in.xml │ ├── new_success_tmpl │ │ ├── out.p.xml │ │ ├── out.xml │ │ └── test.sh │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── if_exists_true │ ├── in.xml │ ├── new_success_tmpl │ │ ├── out.p.xml │ │ ├── out.xml │ │ └── test.sh │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── if_hole_stage │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── insert_attr │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── insert_default_insert │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── let_attr │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── link │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_accessible │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_balanced_tree │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_child_later │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_child_stacked │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_child_stacked2 │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_child_twice │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_default │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_eloop │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── link_eloop_child │ ├── err.txt │ ├── in.xml │ ├── out.p.xml │ └── test.sh ├── link_list │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_list_alt │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_matrix │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── link_rope_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── new_error_tmpl │ ├── err.p.txt │ ├── err.txt │ └── test.sh ├── new_success_tmpl │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_explicit_inner_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_explicit_post_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_explicit_pre_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_implicit_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_implicit_nested_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_pundef_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_pundef_child_compose │ ├── a.xml │ ├── b.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_pundef_child_parent │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_root_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── ns_root_child_shadow │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── override_default │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── rich_decl │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── rich_decl_chained_closed │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── rich_decl_chained_open │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── scoped_fields │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── scoped_parent │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── self_decl │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── self_hole │ ├── err.txt │ ├── in.xml │ ├── out.p.xml │ └── test.sh ├── seq_attr │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── shadow_decl │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── shadow_scope_decl │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── shadow_scope_decl_multi │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── shadowed_fields │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── shadowed_parent │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── test.ml ├── top_attr │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── top_decl │ ├── a.xml │ ├── b.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── top_insert │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── top_seq_binder │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── top_seq_multi │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── top_seq_single │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── top_seq_ws │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── unknown_tag │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── with │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_accessible │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_balanced_tree │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_bleed │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_child_later │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_child_stacked │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_child_stacked2 │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_child_twice │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_default │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_eloop │ ├── err.p.txt │ ├── err.txt │ ├── in.xml │ └── test.sh ├── with_eloop_child │ ├── err.txt │ ├── in.xml │ ├── out.p.xml │ └── test.sh ├── with_list │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_list_alt │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_matrix │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_rope_child │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh ├── with_rope_child_deep │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh └── with_rope_child_shadow │ ├── in.xml │ ├── out.p.xml │ ├── out.xml │ └── test.sh └── unix ├── blueprint_unix.ml └── blueprint_unix.mli /.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | blue 3 | blue.native 4 | blueprintVersion.ml 5 | lib/META 6 | -------------------------------------------------------------------------------- /.merlin: -------------------------------------------------------------------------------- 1 | PKG cmdliner 2 | PKG xmlm 3 | PKG stringext 4 | PKG polyglot 5 | 6 | S lib 7 | S unix 8 | S cli 9 | S . 10 | B _build 11 | B _build/* 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: required 3 | install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-opam.sh 4 | script: bash -ex .travis-opam.sh 5 | env: 6 | - OCAML_VERSION=latest PACKAGE=blueprint 7 | - OCAML_VERSION=4.01 PACKAGE=blueprint 8 | -------------------------------------------------------------------------------- /CHANGES: -------------------------------------------------------------------------------- 1 | 0.4.0 (trunk): 2 | * Initial public release. 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PRODUCTS=\ 2 | blueprint.a \ 3 | blueprint.cma blueprint.cmxa blueprint.cmxs \ 4 | blueprint.cmi blueprint.cmti \ 5 | xmlRope.cmi xmlRope.cmti 6 | UNIX_PRODS=\ 7 | blueprint_unix.cmi blueprint_unix.cmti 8 | .PHONY: all lib tool install clean blue.native $(PRODUCTS) $(UNIX_PRODS) test 9 | 10 | OCAMLBUILD=ocamlbuild -use-ocamlfind -Is cli,unix,lib 11 | 12 | DESCRN=$(shell [ -d .git ] && git describe --tags --always || cat blueprint.version) 13 | DESCR=$(shell echo "$(DESCRN)" | tr -d '\n') 14 | 15 | DIRTY_FLAG=$(shell [ -d .git ] && git diff-index --quiet HEAD || echo "dirty") 16 | ifeq ($(DIRTY_FLAG),dirty) 17 | DIRTY=true 18 | else 19 | DIRTY=false 20 | endif 21 | 22 | all: lib tool 23 | lib: $(PRODUCTS) $(UNIX_PRODS) 24 | tool: blue 25 | 26 | install: lib lib/META 27 | ocamlfind install blueprint lib/META lib/blueprint.mli \ 28 | $(addprefix _build/lib/,$(PRODUCTS)) \ 29 | $(addprefix _build/unix/,$(UNIX_PRODS)) 30 | 31 | lib/META: lib/META.in 32 | sed -e "s/%{blueprint:version}%/$(DESCR)/" < lib/META.in > lib/META 33 | 34 | blue.native: blueprintVersion.ml 35 | $(OCAMLBUILD) blue.native 36 | 37 | blueprint.cma: 38 | $(OCAMLBUILD) blueprint.cma 39 | 40 | blueprint.cmxa: 41 | $(OCAMLBUILD) blueprint.cmxa 42 | 43 | blueprint.cmxs: 44 | $(OCAMLBUILD) blueprint.cmxs 45 | 46 | %.cmi %.cmti: 47 | $(OCAMLBUILD) $@ 48 | 49 | blue: blue.native 50 | ln -f blue.native blue 51 | 52 | blueprintVersion.ml: 53 | printf "let git_descr = \"" > blueprintVersion.ml 54 | printf "$(DESCR)" >> blueprintVersion.ml 55 | printf "\"\nlet git_dirty = $(DIRTY)\n" >> blueprintVersion.ml 56 | 57 | test: 58 | $(MAKE) 59 | $(MAKE) -C test 60 | $(MAKE) -C test test 61 | 62 | clean: 63 | ocamlbuild -clean 64 | rm -f blueprintVersion.ml blue lib/META 65 | $(MAKE) -C test clean 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # blueprint 2 | 3 | **blueprint** is a [polyglot HTML](http://www.w3.org/TR/html-polyglot/) 4 | (or XML) template system. It's a command and a MirageOS-compatible OCaml 5 | library. 6 | 7 | To use **blueprint** from the command line, just 8 | 9 | ``` 10 | $ blue [templates] 11 | ``` 12 | 13 | and the templates will be composed with the result sent to stdout. 14 | 15 | ## Template language 16 | 17 | The blueprint template language is an XML vocabulary that lets you place 18 | 'holes' in [polyglot HTML](http://www.w3.org/TR/html-polyglot/) (or XML) 19 | documents. The `blue` command line tool automatically binds the 20 | blueprint namespace to the `t:` prefix. Blueprint has 4 tags: *seq*, 21 | *let*, *insert*, and *attr*. 22 | 23 | ### `t:seq` 24 | 25 | `t:seq` is used to group elements together. It is most useful at the 26 | root of a document in order to describe a sequence of elements or to 27 | declare document-level bindings. 28 | 29 | ### `t:let` 30 | 31 | `t:let` has a single required attribute, `name`, which gives a name to 32 | the binding that it creates. Bindings are scoped from the point of 33 | declaration until the end of the parent element. If the parent element 34 | is `t:seq`, the binding will be exported as well. Whitespace before a 35 | `t:let` is elided up to one or two consecutive new lines. 36 | 37 | ### `t:insert` 38 | 39 | `t:insert` has a single required attribute, `name`, which gives a name 40 | to the 'hole' that it creates. Bindings against this name will fill this 41 | hole. When holes are filled, the template which fills the hole will be 42 | recursively populated with any bindings in scope. If an expansion step 43 | would use a binding previously used in the expansion, the expansion 44 | stops before the previous hole is filled. 45 | 46 | If content is supplied to a `t:insert` element, it will be used as the 47 | default value of the hole in the case that no binding matching `@name` 48 | exists in scope. 49 | 50 | Names may only contain alphanumeric characters, '-', and '_'. 51 | 52 | ### `t:attr` 53 | 54 | `t:attr` has a single required attribute, `name`, which is the name of 55 | the attribute to populate. `t:attr` may only immediately follow a start 56 | tag or another `t:attr` excluding whitespace. If the attribute `@name` 57 | already exists, it is replaced with the content of `t:attr`. `t:attr` 58 | may contain any content including `t:let`, `t:insert`, and `t:seq` but, 59 | after recursive binding, all tags in the attribute value will be 60 | dropped. 61 | 62 | ## `blue` 63 | 64 | The `blue` tool is a simple command line wrapper around the `Blueprint` 65 | library. `blue` accepts a sequence of files and composes them into a 66 | single output document. The last file listed is used as the template and 67 | all preceding files are used only for their bindings. Any unbound content 68 | in the preceding files is discarded. The result must not contain any 69 | template elements and will be sent to `stdout`. To read from `stdin`, 70 | use `-` as a file name. The `-p` option will disable incomplete template 71 | errors and allow output of partially fulfilled templates. 72 | -------------------------------------------------------------------------------- /_tags: -------------------------------------------------------------------------------- 1 | : package(cmdliner),package(unix),package(xmlm),package(stringext),package(polyglot) 2 | : package(xmlm),package(stringext),package(polyglot) 3 | : package(xmlm),package(stringext) 4 | true: debug, annot, bin_annot, principal, safe_string 5 | true: strict_sequence 6 | true: warn(@5@8@10@11@12@14@23@24@26@29) 7 | -------------------------------------------------------------------------------- /blueprint.install: -------------------------------------------------------------------------------- 1 | bin: [ "?blue" ] 2 | -------------------------------------------------------------------------------- /blueprint.version.in: -------------------------------------------------------------------------------- 1 | %{blueprint:version}% 2 | -------------------------------------------------------------------------------- /cli/blue.ml: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2015 David Sheets 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | * 16 | *) 17 | 18 | open Printf 19 | open Cmdliner 20 | 21 | let version = BlueprintVersion.( 22 | git_descr ^ (if git_dirty then " (dirty)" else "") 23 | ) 24 | let exec_name = Filename.basename Sys.argv.(0) 25 | 26 | let ns_bind_default = function "t" -> Some Blueprint.xmlns | _ -> None 27 | let ns = ns_bind_default 28 | 29 | let fatal_blueprint_error file err = 30 | eprintf "%s: %s: template error:\n%s\n%!" 31 | exec_name file (Blueprint.error_message err); 32 | exit 1 33 | 34 | let read_blueprint file = 35 | try 36 | match file with 37 | | "-" -> 38 | let open Blueprint in 39 | let prov = Prov.({ src = File file; loc = None; incl = None }) in 40 | let xml_input = Xmlm.make_input ~ns (`Channel stdin) in 41 | let source = xml_source in 42 | let _, rope = of_stream ~prov ~source xml_input in 43 | rope 44 | | file -> 45 | Unix.handle_unix_error (Blueprint_unix.of_file ~ns) file 46 | with 47 | | Blueprint.Error err -> fatal_blueprint_error file err 48 | | Xmlm.Error ((line,col),err) -> 49 | eprintf "%s: %s: XML error at line %d column %d:\n%s\n%!" 50 | exec_name file line col (Xmlm.error_message err); 51 | exit 1 52 | 53 | let rec compose prev_bindings partial = function 54 | | [] -> `Help (`Pager, None) 55 | | [file] -> 56 | let b = read_blueprint file in 57 | let template = Blueprint.(default_rope (Scope.template b)) in 58 | Blueprint.( 59 | try 60 | bind_to_output ~partial stdout prev_bindings template; 61 | `Ok () 62 | with 63 | | Error err -> fatal_blueprint_error file err 64 | ) 65 | | file::files -> 66 | (* template is ignored in all but the last file *) 67 | let bindings = read_blueprint file in 68 | compose (Blueprint.Scope.overlay bindings prev_bindings) partial files 69 | 70 | let compose_cmd = 71 | let doc = "templates to compose, use '-' to read from stdin" in 72 | let docv = "TEMPLATES" in 73 | let templates = Arg.(value (pos_all string [] & info ~docv ~doc [])) in 74 | let doc = "allow partially fulfilled output" in 75 | let partial = Arg.(value (flag & info ~doc ["p"])) in 76 | let man = [ 77 | `S "DESCRIPTION"; 78 | `P ("$(b, "^exec_name^") composes blueprint templates."); 79 | ] 80 | in 81 | Term.( 82 | ret (pure (compose (Blueprint.Scope.empty ())) $ partial $ templates), 83 | info exec_name ~version ~man 84 | ) 85 | 86 | ;; 87 | 88 | match Term.eval compose_cmd with 89 | | `Ok () | `Version | `Help -> exit 0 90 | | `Error _ -> exit 1 91 | -------------------------------------------------------------------------------- /lib/META.in: -------------------------------------------------------------------------------- 1 | version = "%{blueprint:version}%" 2 | description = "Simple templating based on XML ropes" 3 | requires = "xmlm polyglot" 4 | archive(byte) = "blueprint.cma" 5 | archive(byte, plugin) = "blueprint.cma" 6 | archive(native) = "blueprint.cmxa" 7 | archive(native, plugin) = "blueprint.cmxs" 8 | exists_if = "blueprint.cma" 9 | -------------------------------------------------------------------------------- /lib/blueprint.mli: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2013-2015 David Sheets 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | * 16 | *) 17 | 18 | module Prov : sig 19 | type loc = int * int 20 | type src = Stream of string | File of string 21 | type t = { 22 | src : src; 23 | loc : loc option; 24 | incl : (string * t) option; 25 | } 26 | end 27 | 28 | type binding_error = [ 29 | | `Empty_hole of Prov.t option * string 30 | | `Dangling_link of Prov.t * string * string 31 | ] 32 | 33 | type expansion_error = [ 34 | | binding_error 35 | | `Disallowed_expansion of Prov.t * string 36 | ] 37 | 38 | type error = [ 39 | | expansion_error 40 | | `Bad_ident of Prov.loc * string 41 | | `Unknown_tag of Prov.loc * string 42 | | `Missing_attribute of Prov.loc option * string * string 43 | | `Floating_attr of Prov.loc * string 44 | | `Floating_else of Prov.loc 45 | | `Data_after_root of Prov.loc option 46 | | `Element_after_root of Prov.loc option 47 | ] 48 | 49 | exception Error of error 50 | 51 | type signal = Prov.loc * Xmlm.signal 52 | 53 | val xmlns : string 54 | 55 | val xmlns_map_default : string -> string option 56 | 57 | val error_message : error -> string 58 | 59 | module Ident : sig 60 | type absolute = [ `Absolute ] 61 | type relative = [ `Relative ] 62 | type any = [ absolute | relative ] 63 | type 'a t 64 | type relative_t = relative t 65 | type absolute_t = absolute t 66 | type any_t = any t 67 | end 68 | 69 | module IntSet : Set.S with type elt = int 70 | 71 | module Scope : sig 72 | type 'rope t 73 | 74 | val to_string : 'a t -> string 75 | 76 | val empty : unit -> 'a t 77 | 78 | val template : 'rope t -> 'rope option Lazy.t 79 | 80 | val overlay : 'rope t -> 'rope t -> 'rope t 81 | 82 | val find : 'rope t -> string -> 'rope t option 83 | end 84 | 85 | module Hole : sig 86 | type ('rope, 'value) t 87 | end 88 | 89 | module Env : sig 90 | type 'rope t 91 | 92 | val create : 'rope Scope.t -> 'rope t 93 | end 94 | 95 | module rec Template : 96 | (XmlRope.TEMPLATE with type hole = (Rope.t, Rope.t) Hole.t 97 | and type prov = Prov.t 98 | and type env = Rope.t Env.t) 99 | and Rope : XmlRope.S 100 | with type hole = Template.hole 101 | and type prov = Template.prov 102 | and type env = Template.env 103 | 104 | type t = Rope.t Scope.t 105 | 106 | val default_rope : Rope.t option Lazy.t -> Rope.t 107 | 108 | val of_stream : 109 | prov:Prov.t -> source:('acc -> 'acc * signal option) -> 'acc -> 'acc * t 110 | 111 | val xml_source : Xmlm.input -> Xmlm.input * signal option 112 | 113 | val bind : 114 | ?partial:bool -> 115 | sink:'acc Rope.sink -> 116 | 'acc -> Rope.t Scope.t -> Rope.t -> 'acc 117 | 118 | val sink : 119 | ?partial:bool -> ('a -> Xmlm.signal -> 'a) -> 120 | (Prov.t -> 'a -> Xmlm.signal list -> 'a) 121 | 122 | val buffer_sink : 123 | ?partial:bool -> Buffer.t -> 124 | (Prov.t -> unit -> Xmlm.signal list -> unit) 125 | 126 | val bind_to_output : 127 | ?partial:bool -> out_channel -> Rope.t Scope.t -> Rope.t -> unit 128 | 129 | module Tree : sig 130 | val empty : unit -> t 131 | 132 | val add : string -> t -> t -> t 133 | 134 | val tag : string -> string * t 135 | 136 | val of_kv : (string * t) list -> t 137 | val of_kv_maybe : (string * t option) list -> t 138 | val of_kv_string : (string * string) list -> t 139 | val of_string : string -> t 140 | val of_list : t list -> t 141 | val of_cons : string -> t -> t 142 | val of_cons_string : string -> string -> t 143 | 144 | val of_lazy_tree : (unit -> t) -> t 145 | 146 | val root : t -> t 147 | end 148 | -------------------------------------------------------------------------------- /lib/blueprint.mllib: -------------------------------------------------------------------------------- 1 | Blueprint 2 | XmlRope 3 | Blueprint_unix 4 | -------------------------------------------------------------------------------- /lib/xmlRope.ml: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2015 David Sheets 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | * 16 | *) 17 | 18 | type 'a deque = 'a list * 'a list 19 | 20 | module type TEMPLATE = sig 21 | type hole 22 | type prov 23 | type env 24 | 25 | val signals_of_hole : prov:prov -> env -> hole -> Xmlm.signal list 26 | end 27 | 28 | module type S = sig 29 | type hole 30 | type prov 31 | type env 32 | type t 33 | type patch_action = Retain | Recurse of env * t | Replace of t 34 | type patch = env -> prov -> hole -> patch_action 35 | type 'out sink = prov -> 'out -> Xmlm.signal list -> 'out 36 | 37 | val of_data : prov:prov -> string -> t 38 | 39 | val of_list : prov:prov -> Xmlm.signal list -> t 40 | 41 | val make_hole : prov:prov -> hole -> t 42 | 43 | val make_attrs : prov:prov -> Xmlm.tag -> (Xmlm.name * t) list -> t 44 | val in_attrs : t -> bool 45 | val with_attr : t -> Xmlm.name * t -> t 46 | 47 | val concat : t -> t -> t 48 | val ( ++ ) : t -> t -> t 49 | val ( +? ) : t option -> t -> t 50 | 51 | val empty : t 52 | 53 | val is_empty : t -> bool 54 | 55 | val map_signals : (Xmlm.signal list -> Xmlm.signal list) -> t -> t 56 | 57 | val optimize : t -> t 58 | 59 | val of_tree : 60 | prov:prov -> 61 | ([< `Data of string | `El of Xmlm.tag * 'b list ] as 'b) list -> t 62 | 63 | val holes : t -> hole list 64 | 65 | val map_prov : (prov -> prov) -> t -> t 66 | 67 | val patch : patch -> env -> t -> t 68 | 69 | val to_stream : patch:patch -> sink:'out sink -> env -> 70 | 'out -> t -> 'out 71 | 72 | val to_list : patch:patch -> env -> t -> Xmlm.signal list 73 | end 74 | 75 | module Make(M : TEMPLATE) : S 76 | with type hole = M.hole 77 | and type prov = M.prov 78 | and type env = M.env = 79 | struct 80 | type hole = M.hole 81 | type prov = M.prov 82 | type env = M.env 83 | 84 | (* TODO: could include indexes for fast traversal/lookup *) 85 | type t = 86 | | Literal of M.prov * Xmlm.signal deque 87 | | Hole of M.prov * M.hole 88 | | Attrs of M.prov * Xmlm.tag * (Xmlm.name * t) list 89 | | Sequence of t deque 90 | 91 | type patch_action = Retain | Recurse of env * t | Replace of t 92 | type patch = env -> prov -> hole -> patch_action 93 | 94 | type 'out sink = prov -> 'out -> Xmlm.signal list -> 'out 95 | 96 | let of_data ~prov data = Literal (prov, ([`Data data],[])) 97 | 98 | let of_list ~prov list = Literal (prov, (list,[])) 99 | 100 | let make_hole ~prov hole = Hole (prov, hole) 101 | let make_attrs ~prov tag attrs = Attrs (prov, tag, attrs) 102 | let rec in_attrs = function 103 | | Literal (_,_) | Hole (_,_) | Sequence ([],[]) -> false 104 | | Attrs (_,_,_) -> true 105 | | Sequence (_,rope::_) -> in_attrs rope 106 | | Sequence (fropes,[]) -> in_attrs (Sequence ([],List.rev fropes)) 107 | let rec with_attr rope attr = match rope with 108 | | Literal (_,_) | Hole (_,_) | Sequence ([],[]) -> rope 109 | | Attrs (prov, tag, attrs) -> Attrs (prov, tag, attr::attrs) 110 | | Sequence (fropes,rope::rropes) -> 111 | Sequence (fropes, (with_attr rope attr)::rropes) 112 | | Sequence (fropes,[]) -> with_attr (Sequence ([],List.rev fropes)) attr 113 | 114 | (* TODO: could optimize if prov = prov' *) 115 | let concat a b = match a, b with 116 | | Sequence (fropes, rropes), atom -> Sequence (fropes, atom::rropes) 117 | | atom, Sequence (fropes, rropes) -> Sequence (atom::fropes, rropes) 118 | | atom, atom' -> Sequence ([atom; atom'], []) 119 | 120 | let (++) = concat 121 | let (+?) lhs rhs = match lhs with None -> rhs | Some lhs -> lhs ++ rhs 122 | 123 | let empty = Sequence ([],[]) 124 | 125 | let rec is_empty = function 126 | | Literal (_,([],[])) -> true 127 | | Sequence (f,r) -> List.for_all is_empty f && List.for_all is_empty r 128 | | Literal (_,_) 129 | | Attrs (_,_,_) 130 | | Hole (_,_) -> false 131 | 132 | (* TODO: Should re-arrange for optimal access *) 133 | let rec optimize = function 134 | | Literal (prov, (f, r)) -> Literal (prov, (f@(List.rev r), [])) 135 | | Hole _ | Attrs _ as x -> x 136 | | Sequence ([x], []) -> optimize x 137 | | Sequence (xs, []) -> 138 | begin match opt_seq xs with 139 | | [] -> empty 140 | | [x] -> x 141 | | xs -> Sequence (xs, []) 142 | end 143 | | Sequence (f, r) -> Sequence (f@(List.rev r), []) 144 | and opt_seq = function 145 | | [] -> [] 146 | | (Sequence (f,r))::xs -> (opt_seq (f@(List.rev r)))@(opt_seq xs) 147 | | x::xs -> (optimize x)::(opt_seq xs) 148 | 149 | (* TODO: Should optimize first in order to pass f contiguous signals *) 150 | let rec map_signals f x = match x with 151 | | Hole (_,_) 152 | | Attrs (_,_,_) -> x 153 | | Literal (prov,(forward,reverse)) -> 154 | Literal (prov,(f (forward @ (List.rev reverse)),[])) 155 | | Sequence (fropes,rropes) -> 156 | Sequence (List.map (map_signals f) (fropes @ (List.rev rropes)),[]) 157 | 158 | let of_tree ~prov xml = 159 | let rec aux acc = function 160 | | `Data d -> (`Data d)::acc 161 | | `El (tag,contents) -> 162 | `El_end::(List.fold_left aux ((`El_start tag)::acc) contents) 163 | in 164 | Literal (prov, List.(rev (fold_left aux [] xml), [])) 165 | 166 | let holes rope = 167 | let rec aux acc = function 168 | | Literal (_,_) -> acc 169 | | Hole (_, hole) -> hole::acc 170 | | Attrs (_, _, ropes) -> List.fold_left (fun acc (_name, rope) -> 171 | aux acc rope 172 | ) acc ropes 173 | | Sequence (fropes, rropes) -> 174 | List.(fold_left aux (fold_left aux acc fropes) (rev rropes)) 175 | in 176 | List.rev (aux [] rope) 177 | 178 | let rec map_prov f = function 179 | | Literal (prov, ds) -> Literal (f prov, ds) 180 | | Sequence (fropes,rropes) -> 181 | Sequence (List.map (map_prov f) fropes, List.map (map_prov f) rropes) 182 | | Hole (prov, h) -> Hole (f prov, h) (* TODO: map into hole? *) 183 | | Attrs (prov, tag, ropes) -> 184 | Attrs (f prov, tag, 185 | List.map (fun (name,rope) -> (name, map_prov f rope)) ropes) 186 | 187 | (* TODO: should also optimize rope? *) 188 | let patch f acc rope = 189 | let rec aux acc = function 190 | | Literal (_,_) as r -> r 191 | | Sequence (fropes,rropes) -> 192 | Sequence (List.map (aux acc) fropes, List.map (aux acc) rropes) 193 | | Hole (prov, h) as hole -> 194 | begin match f acc prov h with 195 | | Recurse (acc, t) -> aux acc t 196 | | Replace t -> t 197 | | Retain -> hole 198 | end 199 | | Attrs (prov, tag, ropes) -> 200 | Attrs (prov, tag, 201 | List.map (fun (name,rope) -> (name, aux acc rope)) ropes) 202 | in 203 | aux acc rope 204 | 205 | (* A sink building a buffer without tags *) 206 | let rec drop_tag prov buf = function 207 | | [] -> buf 208 | | (`Dtd _ | `El_start (_,_) | `El_end)::r -> drop_tag prov buf r 209 | | (`Data s)::r -> Buffer.add_string buf s; drop_tag prov buf r 210 | 211 | let set_attr attrs attr value = 212 | let rec loop acc = function 213 | | [] -> List.rev ((attr,value)::acc) 214 | | (a,_)::r when a = attr -> List.rev_append acc ((attr,value)::r) 215 | | h::r -> loop (h::acc) r 216 | in 217 | loop [] attrs 218 | 219 | (* TODO: should use patch? *) 220 | let rec to_stream 221 | : 'out. patch:_ -> sink:'out sink -> 'a -> 'out -> _ -> 'out = 222 | fun ~patch -> 223 | let rec aux : 'out. _ -> _ -> 'out sink -> 'out -> _ -> 'out = 224 | fun acc patch sink out -> function 225 | | Literal (prov, (fs,rs)) -> 226 | sink prov (sink prov out fs) (List.rev rs) 227 | | Hole (prov, h) -> 228 | begin match patch acc prov h with 229 | | Recurse (acc, rope) -> aux acc patch sink out rope 230 | | Replace t -> aux acc (fun _ _ _ -> Retain) sink out t 231 | | Retain -> 232 | sink prov out (M.signals_of_hole ~prov acc h) 233 | end 234 | | Sequence (fropes, rropes) -> 235 | List.(fold_left (aux acc patch sink) 236 | (fold_left (aux acc patch sink) out fropes) 237 | (rev rropes)) 238 | | Attrs (prov, (el,attrs), ropes) -> 239 | let attrs = List.fold_left (fun attrs (name,rope) -> 240 | let buf = Buffer.create 16 in 241 | let buf = aux acc patch drop_tag buf rope in 242 | set_attr attrs name (Buffer.contents buf) 243 | ) attrs (List.rev ropes) in 244 | sink prov out [`El_start (el,attrs)] 245 | in 246 | fun ~sink acc out rope -> 247 | aux acc patch sink out rope 248 | 249 | let to_list ~patch acc rope = 250 | let sink _ acc s = List.rev_append s acc in 251 | List.rev (to_stream ~patch ~sink acc [] rope) 252 | end 253 | -------------------------------------------------------------------------------- /lib/xmlRope.mli: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2013-2015 David Sheets 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | * 16 | *) 17 | 18 | (* TODO: shouldn't expose? *) 19 | type 'a deque = 'a list * 'a list 20 | 21 | module type TEMPLATE = sig 22 | type hole 23 | type prov 24 | type env 25 | 26 | val signals_of_hole : prov:prov -> env -> hole -> Xmlm.signal list 27 | end 28 | 29 | module type S = sig 30 | type hole 31 | type prov 32 | type env 33 | type t 34 | type patch_action = Retain | Recurse of env * t | Replace of t 35 | type patch = env -> prov -> hole -> patch_action 36 | type 'out sink = prov -> 'out -> Xmlm.signal list -> 'out 37 | 38 | val of_data : prov:prov -> string -> t 39 | 40 | val of_list : prov:prov -> Xmlm.signal list -> t 41 | 42 | val make_hole : prov:prov -> hole -> t 43 | 44 | val make_attrs : prov:prov -> Xmlm.tag -> (Xmlm.name * t) list -> t 45 | val in_attrs : t -> bool 46 | val with_attr : t -> Xmlm.name * t -> t 47 | 48 | val concat : t -> t -> t 49 | val ( ++ ) : t -> t -> t 50 | val ( +? ) : t option -> t -> t 51 | 52 | val empty : t 53 | 54 | val is_empty : t -> bool 55 | 56 | val map_signals : (Xmlm.signal list -> Xmlm.signal list) -> t -> t 57 | 58 | val optimize : t -> t 59 | 60 | val of_tree : 61 | prov:prov -> 62 | ([< `Data of string | `El of Xmlm.tag * 'b list ] as 'b) list -> t 63 | 64 | val holes : t -> hole list 65 | 66 | val map_prov : (prov -> prov) -> t -> t 67 | 68 | val patch : patch -> env -> t -> t 69 | 70 | val to_stream : 71 | patch:patch -> sink:'out sink -> env -> 'out -> t -> 'out 72 | 73 | val to_list : patch:patch -> env -> t -> Xmlm.signal list 74 | end 75 | 76 | module Make(M : TEMPLATE) : S 77 | with type hole = M.hole 78 | and type prov = M.prov 79 | and type env = M.env 80 | -------------------------------------------------------------------------------- /opam: -------------------------------------------------------------------------------- 1 | opam-version: "1.2" 2 | name: "blueprint" 3 | version: "0.4.0" 4 | maintainer: "sheets@alum.mit.edu" 5 | authors: [ "David Sheets" ] 6 | license: "ISC" 7 | homepage: "https://github.com/dsheets/blueprint" 8 | bug-reports: "https://github.com/dsheets/blueprint/issues" 9 | dev-repo: "https://github.com/dsheets/blueprint.git" 10 | 11 | substs: [ "lib/META" "blueprint.version" ] 12 | 13 | build: [ 14 | [make "lib"] 15 | [make "tool"] { cmdliner:installed & base-unix:installed } 16 | ] 17 | install: [ 18 | [make "install"] 19 | ] 20 | remove: [ 21 | ["ocamlfind" "remove" "blueprint"] 22 | ] 23 | build-test: [ 24 | [make "test"] 25 | ] 26 | 27 | depends: [ 28 | "ocamlfind" {build} 29 | "xmlm" 30 | "polyglot" 31 | "stringext" 32 | "alcotest" {test} 33 | ] 34 | depopts: [ 35 | "cmdliner" 36 | "base-unix" 37 | ] 38 | available: [ ocaml-version >= "4.01.0" ] 39 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | _tests 2 | test.native 3 | -------------------------------------------------------------------------------- /test/.merlin: -------------------------------------------------------------------------------- 1 | REC 2 | 3 | PKG alcotest 4 | 5 | S . 6 | B . 7 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all test clean 2 | 3 | all: test.native 4 | 5 | test.native: test.ml 6 | ocamlbuild -use-ocamlfind -cflags -w,@f@p@u@y test.native 7 | 8 | test: test.native 9 | ./test.native 10 | 11 | clean: 12 | ocamlbuild -clean 13 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | # blueprint tests 2 | 3 | These tests exercise the `blue` command line tool and success is defined 4 | as byte-identical output to an expected result. 5 | 6 | ## The structure of a test 7 | 8 | Each test consists of a shell script, `test.sh`, which is executed with 9 | an environment including `OCAMLRUNPARAM=b` and `BLUE` set to the 10 | specific invocation of the `blue` tool under test (e.g. `blue -i`). By 11 | default, tests expect input in `in.xml`. The output of the test will be 12 | compared against `out.xml` if the test script exits 0, `err.txt` if the 13 | test script exits 1, or `trouble.txt` if the test script exits 14 | 2. Symbolic links are used to keep the test result variations in sync if 15 | they are expected to be the same. 16 | 17 | ## Creating a new test 18 | 19 | Use `cp -R new_success_tmpl my_new_success_test` or `cp -R 20 | new_error_tmpl my_new_error_test` to create a new success or error test 21 | respectively. Then, add this test to the test listing at the end of 22 | `test.ml`. 23 | -------------------------------------------------------------------------------- /test/_tags: -------------------------------------------------------------------------------- 1 | <*>: package(alcotest) 2 | true: debug, annot, bin_annot, principal, safe_string 3 | true: strict_sequence 4 | true: warn(@5@8@10@11@12@14@23@24@26@29) 5 | -------------------------------------------------------------------------------- /test/attr_add/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | content 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_add/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_add/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_add/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_compose/a.xml: -------------------------------------------------------------------------------- 1 | main 2 | -------------------------------------------------------------------------------- /test/attr_compose/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_compose/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_compose/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_compose/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} a.xml b.xml 4 | -------------------------------------------------------------------------------- /test/attr_empty/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_empty/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_empty/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_empty/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_floating/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/attr_floating/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | line 4, column 25: the attribute 'class' is not attached to a start tag 3 | -------------------------------------------------------------------------------- /test/attr_floating/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

After this paragraph, there is an attribute attachment.

4 | main 5 |

The attribute attachment will be ignored.

6 | 7 | 8 | -------------------------------------------------------------------------------- /test/attr_floating/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_format/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | content 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/attr_format/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_format/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/attr_format/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_insert/in.xml: -------------------------------------------------------------------------------- 1 | 2 | main 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/attr_insert/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_insert/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_insert/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_multi/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | content 4 | best 5 | main 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/attr_multi/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_multi/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_multi/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_open/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | No value for hole named 'foo' 3 | from file 'in.xml', line 3, column 46 4 | -------------------------------------------------------------------------------- /test/attr_open/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_open/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_open/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_replace/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | body 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_replace/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_replace/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_replace/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_seq/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_seq/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_seq/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_seq/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/attr_tags/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | bold and italic 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_tags/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/attr_tags/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/attr_tags/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/bad_attr_name/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/bad_attr_name/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Line 3, column 12: tag 'attr' is missing attribute 'name' 3 | -------------------------------------------------------------------------------- /test/bad_attr_name/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/bad_attr_name/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/bad_compose_scope/err.txt: -------------------------------------------------------------------------------- 1 | blue: extract.xml: template error: 2 | No value for hole named 'local' 3 | from file 'extract.xml', line 3, column 27 4 | -------------------------------------------------------------------------------- /test/bad_compose_scope/extract.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/bad_compose_scope/local.xml: -------------------------------------------------------------------------------- 1 | 2 | Devonshire Arms 3 | 4 | -------------------------------------------------------------------------------- /test/bad_compose_scope/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/bad_compose_scope/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} local.xml extract.xml 4 | -------------------------------------------------------------------------------- /test/bad_decl_scope/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | No value for hole named 'head' 3 | from file 'in.xml', line 6, column 26 4 | -------------------------------------------------------------------------------- /test/bad_decl_scope/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | head 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/bad_decl_scope/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/bad_decl_scope/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/bad_ident_comma/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/bad_ident_comma/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | line 1, column 25: the identifier 'foo,bar' is invalid 3 | -------------------------------------------------------------------------------- /test/bad_ident_comma/in.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/bad_ident_comma/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/bad_insert_name/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/bad_insert_name/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Line 2, column 12: tag 'insert' is missing attribute 'name' 3 | -------------------------------------------------------------------------------- /test/bad_insert_name/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/bad_insert_name/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/bad_let_name/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/bad_let_name/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Line 2, column 9: tag 'let' is missing attribute 'name' 3 | -------------------------------------------------------------------------------- /test/bad_let_name/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/bad_let_name/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/bad_with/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Dangling link 'missing' prevented expansion of 'x' 3 | from file 'in.xml', line 4, column 38 4 | -------------------------------------------------------------------------------- /test/bad_with/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | x 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/bad_with/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/bad_with/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/bad_xml_no_close/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/bad_xml_no_close/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: XML error at line 2 column 1: 2 | unexpected end of input 3 | -------------------------------------------------------------------------------- /test/bad_xml_no_close/in.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/bad_xml_no_close/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/closed_fields/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {foo.bar} 4 | 5 | 6 | 7 |

No foo.bar

8 |

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/closed_fields/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

No foo.bar

5 |

6 | {foo.bar} 7 |

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/closed_fields/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

No foo.bar

5 |

6 | {foo.bar} 7 |

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/closed_fields/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/closed_parent/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {} 4 | 5 | 6 | 7 | foo.bar 8 |

No foo

9 |

10 | 11 | 12 | -------------------------------------------------------------------------------- /test/closed_parent/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

No foo

5 |

6 | {foo.bar} 7 |

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/closed_parent/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

No foo

5 |

6 | {foo.bar} 7 |

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/closed_parent/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/closure_default/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Z 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/closure_default/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/closure_default/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Z 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/closure_default/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/compose2/blog.xml: -------------------------------------------------------------------------------- 1 | 2 | Hello, World! 3 | David Sheets 4 | 2015-06-05 5 | 6 | 7 |

8 |

First post!

9 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /test/compose2/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
Author
Title
Time
8 | 9 | 10 | -------------------------------------------------------------------------------- /test/compose2/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/compose2/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
AuthorDavid Sheets
TitleHello, World!
Time2015-06-05
9 | 10 | 11 | -------------------------------------------------------------------------------- /test/compose2/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} blog.xml meta.xml 4 | -------------------------------------------------------------------------------- /test/compose2_closure/a.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3 4 | 0 5 | 9 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/compose2_closure/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | 5 | (, , ) 6 | 7 | a.p = 8 |

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/compose2_closure/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/compose2_closure/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | a.p = 6 | 7 | (3, 0, 9) 8 | 9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /test/compose2_closure/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} a.xml b.xml 4 | -------------------------------------------------------------------------------- /test/compose2_closure_nonlocal/a.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3 4 | 0 5 | 9 6 | 7 | x 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/compose2_closure_nonlocal/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | 5 | (X, Y, Z) 6 | 7 | y 8 | a.p = 9 |

10 | 11 | 12 | -------------------------------------------------------------------------------- /test/compose2_closure_nonlocal/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | a.p = 6 | 7 | (x, y, Z) 8 | 9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /test/compose2_closure_nonlocal/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | a.p = 6 | 7 | (x, y, Z) 8 | 9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /test/compose2_closure_nonlocal/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} a.xml b.xml 4 | -------------------------------------------------------------------------------- /test/compose2_closure_shadow/a.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3 4 | 0 5 | 9 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/compose2_closure_shadow/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | 5 | (, , ) 6 | 7 | x 8 | a.p = 9 |

10 | 11 | 12 | -------------------------------------------------------------------------------- /test/compose2_closure_shadow/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/compose2_closure_shadow/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | a.p = 6 | 7 | (3, 0, 9) 8 | 9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /test/compose2_closure_shadow/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} a.xml b.xml 4 | -------------------------------------------------------------------------------- /test/compose3/a.xml: -------------------------------------------------------------------------------- 1 | 2 | A 3 | 4 | -------------------------------------------------------------------------------- /test/compose3/b.xml: -------------------------------------------------------------------------------- 1 | 2 | B: a is 3 | 4 | -------------------------------------------------------------------------------- /test/compose3/c.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

a is

4 |

b is

5 | 6 | 7 | -------------------------------------------------------------------------------- /test/compose3/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/compose3/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

a is A

5 |

b is B: a is A

6 | 7 | 8 | -------------------------------------------------------------------------------- /test/compose3/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} a.xml b.xml c.xml 4 | -------------------------------------------------------------------------------- /test/compose3_rec/a.xml: -------------------------------------------------------------------------------- 1 | 2 | [b=] 3 | 4 | -------------------------------------------------------------------------------- /test/compose3_rec/b.xml: -------------------------------------------------------------------------------- 1 | 2 | [a=] 3 | 4 | -------------------------------------------------------------------------------- /test/compose3_rec/c.xml: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | -------------------------------------------------------------------------------- /test/compose3_rec/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/compose3_rec/err.txt: -------------------------------------------------------------------------------- 1 | blue: c.xml: template error: 2 | Disallowed expansion of 'b' 3 | from file 'a.xml', line 2, column 40 4 | included as 'a' from file 'b.xml', line 2, column 40 5 | included as 'b' from file 'c.xml', line 2, column 30 6 | -------------------------------------------------------------------------------- /test/compose3_rec/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} a.xml b.xml c.xml 4 | -------------------------------------------------------------------------------- /test/compose_stdin/in.xml: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | -------------------------------------------------------------------------------- /test/compose_stdin/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/compose_stdin/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

X

4 | 5 | -------------------------------------------------------------------------------- /test/compose_stdin/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "X" | ${BLUE} - in.xml 4 | -------------------------------------------------------------------------------- /test/decl/in.xml: -------------------------------------------------------------------------------- 1 | 2 | The value of x 3 | 4 | -------------------------------------------------------------------------------- /test/decl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/decl/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/decl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_double_open/in.xml: -------------------------------------------------------------------------------- 1 | 2 | X: 3 | Y: 4 | Z 5 | 6 |

7 | z 8 |

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/decl_double_open/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/decl_double_open/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

X:Y:Z

5 |

X:Y:z

6 | 7 | 8 | -------------------------------------------------------------------------------- /test/decl_double_open/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_dup/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | X 8 | 9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /test/decl_dup/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/decl_dup/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
 5 |     X
 6 |     X
 7 |     X
 8 |   
9 | 10 | 11 | -------------------------------------------------------------------------------- /test/decl_dup/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_hole_closed/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Z 4 | 5 | 6 | 7 | 8 | z 9 |

10 | 11 | 12 | -------------------------------------------------------------------------------- /test/decl_hole_closed/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/decl_hole_closed/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | Z 6 |

7 | 8 | 9 | -------------------------------------------------------------------------------- /test/decl_hole_closed/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_hole_closed_scope/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Z 4 | z 5 | 6 | 7 | 8 | 9 |

10 | 11 | 12 | -------------------------------------------------------------------------------- /test/decl_hole_closed_scope/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/decl_hole_closed_scope/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | Z 7 |

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/decl_hole_closed_scope/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_hole_open/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Z 4 | 5 | 6 | 7 | 8 |

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/decl_hole_open/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/decl_hole_open/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | Z 6 |

7 | 8 | 9 | -------------------------------------------------------------------------------- /test/decl_hole_open/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_hole_open_chained/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [] 5 | vs. 6 | [] 7 | 8 | 9 | 10 | 11 | 12 | Daniel Webster 13 | 14 | 15 | 16 | Mr. Scratch 17 | 18 | 19 | 20 |

21 | 22 | Defense: 23 | 24 | 25 | 26 | Prosecution: 27 | 28 | 29 |

30 |

31 | 32 | 33 | -------------------------------------------------------------------------------- /test/decl_hole_open_chained/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/decl_hole_open_chained/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | 7 | [Mr. Scratch] 8 | vs. 9 | 10 | [Daniel Webster] 11 | 12 | 13 | 14 |

15 |

16 | 17 | Defense: Daniel Webster 18 | 19 |

20 |

21 | 22 | Prosecution: Mr. Scratch 23 | 24 |

25 | 26 | 27 | -------------------------------------------------------------------------------- /test/decl_hole_open_chained/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_intro_rec/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/decl_intro_rec/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Disallowed expansion of 'x' 3 | from file 'in.xml', line 3, column 37 4 | included as 'x' from file 'in.xml', line 2, column 41 5 | included as 'intro' from file 'in.xml', line 4, column 25 6 | -------------------------------------------------------------------------------- /test/decl_intro_rec/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/decl_intro_rec/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_local_let/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Again! 4 |

5 |

6 |
7 | 8 | Stop! 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/decl_local_let/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/decl_local_let/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Again!

6 |

Again!

7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/decl_local_let/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_mutual_rec/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/decl_mutual_rec/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Disallowed expansion of 'c' 3 | from file 'in.xml', line 6, column 23 4 | included as 'b' from file 'in.xml', line 3, column 23 5 | included as 'a' from file 'in.xml', line 9, column 23 6 | included as 'c' from file 'in.xml', line 11, column 21 7 | -------------------------------------------------------------------------------- /test/decl_mutual_rec/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/decl_mutual_rec/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/decl_rec/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/decl_rec/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Disallowed expansion of 'omega' 3 | from file 'in.xml', line 3, column 27 4 | included as 'omega' from file 'in.xml', line 5, column 25 5 | -------------------------------------------------------------------------------- /test/decl_rec/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/decl_rec/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/default_closure/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Z 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/default_closure/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Z 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/default_closure/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Z 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/default_closure/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/default_empty_insert/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | No value for hole named 'missing' 3 | from file 'in.xml', line 2, column 27 4 | -------------------------------------------------------------------------------- /test/default_empty_insert/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/default_empty_insert/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/default_empty_insert/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/default_insert/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Empty!

4 |
5 | 6 | -------------------------------------------------------------------------------- /test/default_insert/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Empty!

5 |
6 | 7 | -------------------------------------------------------------------------------- /test/default_insert/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Empty!

5 | 6 | 7 | -------------------------------------------------------------------------------- /test/default_insert/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/default_open/in.xml: -------------------------------------------------------------------------------- 1 | 2 | No 'y'! 3 |

Y

4 | 5 | -------------------------------------------------------------------------------- /test/default_open/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/default_open/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Y

4 | 5 | -------------------------------------------------------------------------------- /test/default_open/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/default_rec/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/default_rec/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Disallowed expansion of 'bar' 3 | from file 'in.xml', line 4, column 49 4 | -------------------------------------------------------------------------------- /test/default_rec/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/default_rec/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/default_rec_with/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/default_rec_with/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Default value for unbound @with 'quux' already expanded 3 | from file 'in.xml', line 5, column 40 4 | included as 'bar' from file 'in.xml', line 5, column 61 5 | -------------------------------------------------------------------------------- /test/default_rec_with/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/default_rec_with/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/default_zero_insert/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/default_zero_insert/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/default_zero_insert/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/default_zero_insert/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/else_body_closed/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | x 5 | 6 | 7 | 8 | 9 | X! 10 | 11 |

12 | 13 | 14 | -------------------------------------------------------------------------------- /test/else_body_closed/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | X! 7 | 8 |

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/else_body_closed/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | X! 7 | 8 |

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/else_body_closed/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/else_body_stage/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | x 4 | 5 | 6 | 7 | 8 | 9 | X! 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /test/else_body_stage/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | x 7 | 8 |

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/else_body_stage/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | x 7 | 8 |

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/else_body_stage/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/else_floating/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/else_floating/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | line 1, column 8: the else tag is not attached to an if tag 3 | -------------------------------------------------------------------------------- /test/else_floating/in.xml: -------------------------------------------------------------------------------- 1 | Or else! 2 | -------------------------------------------------------------------------------- /test/else_floating/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/else_hole_stage/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | x 9 | 10 | 11 | 12 | X! 13 |

14 | 15 | 16 | -------------------------------------------------------------------------------- /test/else_hole_stage/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | 7 | x 8 | 9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /test/else_hole_stage/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | 7 | x 8 | 9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /test/else_hole_stage/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/empty_insert/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Empty!

6 |
7 | 8 | 9 | -------------------------------------------------------------------------------- /test/empty_insert/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Empty!

6 |
7 | 8 | 9 | -------------------------------------------------------------------------------- /test/empty_insert/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Empty!

6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/empty_insert/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/empty_let/in.xml: -------------------------------------------------------------------------------- 1 | No x 2 | -------------------------------------------------------------------------------- /test/empty_let/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | No x 3 | -------------------------------------------------------------------------------- /test/empty_let/out.xml: -------------------------------------------------------------------------------- 1 | 2 | No x 3 | -------------------------------------------------------------------------------- /test/empty_let/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/enoent/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/enoent/trouble.p.txt: -------------------------------------------------------------------------------- 1 | trouble.txt -------------------------------------------------------------------------------- /test/enoent/trouble.txt: -------------------------------------------------------------------------------- 1 | ../../blue: "open" failed on "in.xml": No such file or directory 2 | -------------------------------------------------------------------------------- /test/if_body_closed/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | x 5 | 6 | 7 | 8 | 9 | X! 10 | 11 | 12 |

13 | 14 | 15 | -------------------------------------------------------------------------------- /test/if_body_closed/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_body_closed/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | X! 7 |

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/if_body_closed/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_body_stage/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | x 4 | 5 | 6 | 7 | 8 | 9 | 10 | X! 11 |

12 | 13 | 14 | -------------------------------------------------------------------------------- /test/if_body_stage/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_body_stage/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | x 7 |

8 | 9 | 10 | -------------------------------------------------------------------------------- /test/if_body_stage/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_empty/in.xml: -------------------------------------------------------------------------------- 1 | 2 |

Hello, World!

3 |
4 | -------------------------------------------------------------------------------- /test/if_empty/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_empty/out.xml: -------------------------------------------------------------------------------- 1 |

Hello, World!

2 | -------------------------------------------------------------------------------- /test/if_empty/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_exists_false/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Inconceivable!

6 |
7 |
8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/if_exists_false/new_success_tmpl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_exists_false/new_success_tmpl/out.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dsheets/blueprint/725a37c38e09ab6b044ab29e7b0803b0828f7f09/test/if_exists_false/new_success_tmpl/out.xml -------------------------------------------------------------------------------- /test/if_exists_false/new_success_tmpl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_exists_false/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

Inconceivable!

7 |
8 | 9 | 10 | -------------------------------------------------------------------------------- /test/if_exists_false/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/if_exists_false/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_exists_now_false/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Inconceivable!

5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /test/if_exists_now_false/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Inconceivable!

6 |
7 | 8 | -------------------------------------------------------------------------------- /test/if_exists_now_false/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/if_exists_now_false/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_exists_now_true/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Hello, World!

6 |
7 | 8 | 9 | -------------------------------------------------------------------------------- /test/if_exists_now_true/new_success_tmpl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_exists_now_true/new_success_tmpl/out.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dsheets/blueprint/725a37c38e09ab6b044ab29e7b0803b0828f7f09/test/if_exists_now_true/new_success_tmpl/out.xml -------------------------------------------------------------------------------- /test/if_exists_now_true/new_success_tmpl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_exists_now_true/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_exists_now_true/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Hello, World!

6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/if_exists_now_true/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_exists_true/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Hello, World!

6 |
7 |
8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/if_exists_true/new_success_tmpl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_exists_true/new_success_tmpl/out.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dsheets/blueprint/725a37c38e09ab6b044ab29e7b0803b0828f7f09/test/if_exists_true/new_success_tmpl/out.xml -------------------------------------------------------------------------------- /test/if_exists_true/new_success_tmpl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_exists_true/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_exists_true/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

Hello, World!

7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/if_exists_true/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/if_hole_stage/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | x 9 | 10 | 11 | 12 | X! 13 | 14 |

15 | 16 | 17 | -------------------------------------------------------------------------------- /test/if_hole_stage/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/if_hole_stage/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | 6 | 7 | x 8 | 9 |

10 | 11 | 12 | -------------------------------------------------------------------------------- /test/if_hole_stage/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/insert_attr/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/insert_attr/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | line 4, column 27: the attribute 'class' is not attached to a start tag 3 | -------------------------------------------------------------------------------- /test/insert_attr/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | main 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/insert_attr/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/insert_default_insert/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | No 'y'! 5 | 6 | 7 | 8 | 'y'! 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/insert_default_insert/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 'y'! 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/insert_default_insert/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 'y'! 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/insert_default_insert/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/let_attr/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/let_attr/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | line 3, column 25: the attribute 'class' is not attached to a start tag 3 | -------------------------------------------------------------------------------- /test/let_attr/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | main 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/let_attr/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | a1 4 | b1 5 | 6 | 7 | a2 8 | b2 9 | 10 | 11 |

12 |

13 |

14 |
15 | 16 | 1 17 | 18 | 19 | 20 | 21 | 22 | 2 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/link/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/link/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

1

7 |

a1

8 |

b1

9 | 10 | 11 | 12 | 13 |

2

14 |

a2

15 |

b2

16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/link/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_accessible/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 0 3 | 1 4 | [] 5 | 6 | 7 |

zero

8 |

one

9 | 10 | 11 | -------------------------------------------------------------------------------- /test/link_accessible/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/link_accessible/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

zero [0]

5 |

one [1]

6 | 7 | 8 | -------------------------------------------------------------------------------- /test/link_accessible/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_balanced_tree/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 5 | 1 6 | 7 | 2 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 | 17 | 18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/link_balanced_tree/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
0
7 |
8 | 9 |
10 |
1
11 |
12 | 13 |
14 |
2
15 |
16 | 17 |
18 |
19 | 20 |
21 |
22 | 23 |
24 |
25 | 26 |
27 |
2
28 |
29 | 30 |
31 |
32 | 33 |
34 |
35 | 36 |
37 |
38 | 39 |
40 |
41 | 42 |
43 |
1
44 |
45 | 46 |
47 |
2
48 |
49 | 50 |
51 |
52 | 53 |
54 |
55 | 56 |
57 |
58 | 59 |
60 |
2
61 |
62 | 63 |
64 |
65 | 66 |
67 |
68 | 69 |
70 |
71 | 72 |
73 |
74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /test/link_balanced_tree/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
0
7 |
8 | 9 |
10 |
1
11 |
12 | 13 |
14 |
2
15 |
16 | 17 |
18 |
19 | 20 |
21 |
22 | 23 |
24 |
25 | 26 |
27 |
2
28 |
29 | 30 |
31 |
32 | 33 |
34 |
35 | 36 |
37 |
38 | 39 |
40 |
41 | 42 |
43 |
1
44 |
45 | 46 |
47 |
2
48 |
49 | 50 |
51 |
52 | 53 |
54 |
55 | 56 |
57 |
58 | 59 |
60 |
2
61 |
62 | 63 |
64 |
65 | 66 |
67 |
68 | 69 |
70 |
71 | 72 |
73 |
74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /test/link_balanced_tree/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | .child.value: 4 | template with .child: 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | template 13 | 14 | 15 | .child.value: 16 | template with .child: 17 | 18 | 19 | 20 | 21 | 22 | data 23 | 24 |
    25 |
  • 26 | 27 | before missing: 28 |
  • 29 | before 30 |
  • 31 | 32 | before present with data: 33 |
  • 34 |
  • before present:
  • 35 |
  • 36 | 37 | after missing: 38 |
  • 39 | after 40 |
  • 41 | 42 | after present with data: 43 |
  • 44 |
  • after present:
  • 45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /test/link_child/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/link_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 |
  • 5 | before missing: 6 | .child.value: data 7 | template with .child: 8 | 9 | 10 | data 11 | 12 | 13 |
  • 14 |
  • 15 | before present with data: 16 | .child.value: data 17 | template with .child: 18 | 19 | 20 | data 21 | 22 | 23 |
  • 24 |
  • before present: 25 | .child.value: before 26 | template with .child: 27 | 28 | 29 | before 30 | 31 |
  • 32 |
  • 33 | after missing: 34 | .child.value: data 35 | template with .child: 36 | 37 | 38 | data 39 | 40 | 41 |
  • 42 |
  • 43 | after present with data: 44 | .child.value: data 45 | template with .child: 46 | 47 | 48 | data 49 | 50 | 51 |
  • 52 |
  • after present: 53 | .child.value: after 54 | template with .child: 55 | 56 | 57 | after 58 | 59 |
  • 60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /test/link_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_child_later/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | 18 | 1 19 | 20 | 2 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/link_child_later/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

1

6 | 7 |

2

8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/link_child_later/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

1

6 | 7 |

2

8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/link_child_later/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_child_stacked/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | a 21 | b 22 | c 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/link_child_stacked/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | a 6 | 7 | b 8 | 9 | c 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/link_child_stacked/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | a 6 | 7 | b 8 | 9 | c 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/link_child_stacked/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_child_stacked2/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | a 21 | b 22 | c 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/link_child_stacked2/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | a 6 | 7 | b 8 | 9 | c 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/link_child_stacked2/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | a 6 | 7 | b 8 | 9 | c 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/link_child_stacked2/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_child_twice/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | datum 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/link_child_twice/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/link_child_twice/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | datum 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/link_child_twice/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_default/in.xml: -------------------------------------------------------------------------------- 1 | 2 | x 3 | 4 | No x with data. 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/link_default/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | No x with data. 5 | No x with data. 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/link_default/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | No x with data. 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/link_default/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_eloop/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/link_eloop/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Disallowed traversal of 'f' 3 | from file 'in.xml' 4 | -------------------------------------------------------------------------------- /test/link_eloop/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/link_eloop/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_eloop_child/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | No value for hole named 'f' 3 | from file 'in.xml', line 5, column 25 4 | included as 'f.child' from file 'in.xml', line 7, column 28 5 | included as 'f' from file 'in.xml', line 9, column 21 6 | -------------------------------------------------------------------------------- /test/link_eloop_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/link_eloop_child/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/link_eloop_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_list/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 5 | 1 6 | 7 | 2 8 | 9 | 3 10 | 11 | 12 | 13 | 14 | 15 | 16 |
  • 17 | 18 | 19 |
    20 |
      21 | 22 | 23 |
    24 | 25 | 26 | -------------------------------------------------------------------------------- /test/link_list/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 | 6 |
    1. 0
    2. 7 | 8 |
    3. 1
    4. 9 | 10 |
    5. 2
    6. 11 | 12 |
    7. 3
    8. 13 | 14 | 15 | 16 | 17 | 18 |
    19 | 20 | 21 | -------------------------------------------------------------------------------- /test/link_list/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 | 6 |
    1. 0
    2. 7 | 8 |
    3. 1
    4. 9 | 10 |
    5. 2
    6. 11 | 12 |
    7. 3
    8. 13 | 14 | 15 | 16 | 17 | 18 |
    19 | 20 | 21 | -------------------------------------------------------------------------------- /test/link_list/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_list_alt/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | A 4 | 5 | B 6 | 7 | C 8 | 9 | D 10 | 11 | E 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
  • 20 | 21 | 22 |
    23 | 24 |
  • 25 | 26 | 27 |
    28 |
      29 | 30 | 31 |
    32 | 33 | 34 | -------------------------------------------------------------------------------- /test/link_list_alt/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
      4 | 5 |
    1. A
    2. 6 | 7 |
    3. B
    4. 8 | 9 |
    5. C
    6. 10 | 11 |
    7. D
    8. 12 | 13 |
    9. E
    10. 14 | 15 | 16 | 17 | 18 | 19 | 20 |
    21 | 22 | 23 | -------------------------------------------------------------------------------- /test/link_list_alt/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
      4 | 5 |
    1. A
    2. 6 | 7 |
    3. B
    4. 8 | 9 |
    5. C
    6. 10 | 11 |
    7. D
    8. 12 | 13 |
    9. E
    10. 14 | 15 | 16 | 17 | 18 | 19 | 20 |
    21 | 22 | 23 | -------------------------------------------------------------------------------- /test/link_list_alt/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_matrix/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 5 | 1 6 | 7 | 8 | 9 | 5 10 | 11 | 6 12 | 13 | 7 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 |
    23 | 24 | 25 |
    32 |
    33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | (,) 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /test/link_matrix/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
    567
    0(0,5)(0,6)(0,7)
    1(1,5)(1,6)(1,7)
    55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /test/link_matrix/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
    567
    0(0,5)(0,6)(0,7)
    1(1,5)(1,6)(1,7)
    55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /test/link_matrix/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/link_rope_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | No .fchild 4 | No .child 5 | 6 | 7 | fchild 8 | child 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/link_rope_child/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/link_rope_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fchild 6 | child 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/link_rope_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/new_error_tmpl/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/new_error_tmpl/err.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dsheets/blueprint/725a37c38e09ab6b044ab29e7b0803b0828f7f09/test/new_error_tmpl/err.txt -------------------------------------------------------------------------------- /test/new_error_tmpl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/new_success_tmpl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/new_success_tmpl/out.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dsheets/blueprint/725a37c38e09ab6b044ab29e7b0803b0828f7f09/test/new_success_tmpl/out.xml -------------------------------------------------------------------------------- /test/new_success_tmpl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_explicit_inner_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | [foo.bar] 4 | No [.bar] 5 | 6 | 7 |

    8 |

    No [foo.bar]

    9 | 10 | 11 | -------------------------------------------------------------------------------- /test/ns_explicit_inner_child/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/ns_explicit_inner_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    5 | [foo.bar] 6 |

    7 |

    [foo.bar]

    8 | 9 | 10 | -------------------------------------------------------------------------------- /test/ns_explicit_inner_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_explicit_post_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    No [bar]

    4 |

    No [.bar]

    5 |
    6 | [foo.bar] 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/ns_explicit_post_child/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    No [bar]

    6 |

    [foo.bar]

    7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/ns_explicit_post_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    No [bar]

    6 |

    [foo.bar]

    7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/ns_explicit_post_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_explicit_pre_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | [foo.bar] 3 | 4 |

    No [bar]

    5 |

    No [.bar]

    6 |
    7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/ns_explicit_pre_child/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    No [bar]

    6 |

    [foo.bar]

    7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/ns_explicit_pre_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    No [bar]

    6 |

    [foo.bar]

    7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/ns_explicit_pre_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_implicit_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | [foo.bar] 4 | 5 | 6 |

    7 | 8 | 9 | -------------------------------------------------------------------------------- /test/ns_implicit_child/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/ns_implicit_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    [foo.bar]

    5 | 6 | 7 | -------------------------------------------------------------------------------- /test/ns_implicit_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_implicit_nested_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    4 | [foo.bar] 5 | 6 |

    7 |
    8 | 9 | 10 |

    No foo.bar

    11 | 12 | 13 | -------------------------------------------------------------------------------- /test/ns_implicit_nested_child/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    6 | [foo.bar] 7 |

    8 | 9 |

    No foo.bar

    10 | 11 | 12 | -------------------------------------------------------------------------------- /test/ns_implicit_nested_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    6 | [foo.bar] 7 |

    8 | 9 |

    No foo.bar

    10 | 11 | 12 | -------------------------------------------------------------------------------- /test/ns_implicit_nested_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_pundef_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | [foo.bar] 3 | 4 |

    5 | 6 | 7 | -------------------------------------------------------------------------------- /test/ns_pundef_child/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/ns_pundef_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    [foo.bar]

    5 | 6 | 7 | -------------------------------------------------------------------------------- /test/ns_pundef_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_pundef_child_compose/a.xml: -------------------------------------------------------------------------------- 1 | an orphan 2 | -------------------------------------------------------------------------------- /test/ns_pundef_child_compose/b.xml: -------------------------------------------------------------------------------- 1 | 2 | Annie is . 3 | 4 |

    5 | 6 | 7 | -------------------------------------------------------------------------------- /test/ns_pundef_child_compose/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/ns_pundef_child_compose/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    Annie is an orphan.

    5 | 6 | 7 | -------------------------------------------------------------------------------- /test/ns_pundef_child_compose/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} a.xml b.xml 4 | -------------------------------------------------------------------------------- /test/ns_pundef_child_parent/in.xml: -------------------------------------------------------------------------------- 1 | 2 | [foo.bar] 3 | 4 |

    foo is missing

    5 |

    foo.bar is missing

    6 | 7 | 8 | -------------------------------------------------------------------------------- /test/ns_pundef_child_parent/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    foo is missing

    5 |

    foo.bar is [foo.bar]

    6 | 7 | 8 | -------------------------------------------------------------------------------- /test/ns_pundef_child_parent/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    foo is missing

    5 |

    foo.bar is [foo.bar]

    6 | 7 | 8 | -------------------------------------------------------------------------------- /test/ns_pundef_child_parent/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_root_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | [foo] 3 | [bar] 4 | 5 |

    6 |

    7 | 8 | 9 | -------------------------------------------------------------------------------- /test/ns_root_child/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/ns_root_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    [foo]

    5 |

    [bar]

    6 | 7 | 8 | -------------------------------------------------------------------------------- /test/ns_root_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/ns_root_child_shadow/in.xml: -------------------------------------------------------------------------------- 1 | 2 | [foo] 3 | [.foo] 4 | [.bar] 5 | [bar] 6 | 7 |

    8 |

    9 | 10 | 11 | -------------------------------------------------------------------------------- /test/ns_root_child_shadow/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/ns_root_child_shadow/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    [.foo]

    5 |

    [bar]

    6 | 7 | 8 | -------------------------------------------------------------------------------- /test/ns_root_child_shadow/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/override_default/in.xml: -------------------------------------------------------------------------------- 1 | 2 | X 3 |

    'x' isn't set!

    4 | 5 | -------------------------------------------------------------------------------- /test/override_default/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/override_default/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    X

    4 | 5 | -------------------------------------------------------------------------------- /test/override_default/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/rich_decl/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FOO 5 | (and other metasyntactic variables) 6 | 7 |

    8 | 9 | 10 | -------------------------------------------------------------------------------- /test/rich_decl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/rich_decl/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    5 | FOO 6 | (and other metasyntactic variables) 7 |

    8 | 9 | 10 | -------------------------------------------------------------------------------- /test/rich_decl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/rich_decl_chained_closed/in.xml: -------------------------------------------------------------------------------- 1 | 2 | bound early 3 | 4 | The variable 'closed' is . 5 | 6 | 7 | bound late 8 |

    9 | 10 | insane 11 | 12 | -------------------------------------------------------------------------------- /test/rich_decl_chained_closed/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/rich_decl_chained_closed/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    5 | The variable 'closed' is bound early. 6 |

    7 | 8 | 9 | -------------------------------------------------------------------------------- /test/rich_decl_chained_closed/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/rich_decl_chained_open/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | The variable 'open' is . 4 | 5 | 6 | bound 7 |

    8 | 9 | 10 | -------------------------------------------------------------------------------- /test/rich_decl_chained_open/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/rich_decl_chained_open/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    5 | The variable 'open' is bound. 6 |

    7 | 8 | 9 | -------------------------------------------------------------------------------- /test/rich_decl_chained_open/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/scoped_fields/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {foo.bar} 4 | 5 | 6 | [foo.bar]: 7 | [foo.bar] 8 | 9 |

    10 |

    11 | 12 | 13 | -------------------------------------------------------------------------------- /test/scoped_fields/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/scoped_fields/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    5 | [foo.bar]: {foo.bar} 6 |

    7 |

    [foo.bar]: [foo.bar]

    8 | 9 | 10 | -------------------------------------------------------------------------------- /test/scoped_fields/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/scoped_parent/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | {foo.bar}: {} 4 | 5 | 6 | [foo.bar]: 7 | [foo.bar] 8 | 9 |

    10 |

    11 | 12 | 13 | -------------------------------------------------------------------------------- /test/scoped_parent/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/scoped_parent/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    5 | {foo.bar}: {[foo.bar]} 6 |

    7 |

    [foo.bar]: [foo.bar]

    8 | 9 | 10 | -------------------------------------------------------------------------------- /test/scoped_parent/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/self_decl/in.xml: -------------------------------------------------------------------------------- 1 | 2 | Hello, foo! 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/self_decl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/self_decl/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello, foo! 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/self_decl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/self_hole/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | No value for hole named 'page' 3 | from file 'in.xml', line 3, column 24 4 | -------------------------------------------------------------------------------- /test/self_hole/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/self_hole/out.p.xml: -------------------------------------------------------------------------------- 1 | in.xml -------------------------------------------------------------------------------- /test/self_hole/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/seq_attr/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | main 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/seq_attr/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/seq_attr/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/seq_attr/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/shadow_decl/in.xml: -------------------------------------------------------------------------------- 1 | 2 | Sol 3 | Luna 4 | 5 | In a solar eclipse, is the obstruction. 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/shadow_decl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/shadow_decl/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | In a solar eclipse, Luna is the obstruction. 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/shadow_decl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/shadow_scope_decl/in.xml: -------------------------------------------------------------------------------- 1 | 2 | Sol 3 | 4 | Luna 5 | All about <t:insert name="umbra"/> 6 | 7 | 8 | After a solar eclipse, becomes visible again. 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/shadow_scope_decl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/shadow_scope_decl/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | All about Luna 5 | 6 | 7 | After a solar eclipse, Sol becomes visible again. 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/shadow_scope_decl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/shadow_scope_decl_multi/in.xml: -------------------------------------------------------------------------------- 1 | 2 | Apple 3 | Banana 4 | 5 | Antichrist 6 | Beelzebub 7 | 8 | 9 |

    A is for

    10 |

    B is for

    11 | 12 | 13 | -------------------------------------------------------------------------------- /test/shadow_scope_decl_multi/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/shadow_scope_decl_multi/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

    A is for Apple

    7 |

    B is for Banana

    8 | 9 | 10 | -------------------------------------------------------------------------------- /test/shadow_scope_decl_multi/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/shadowed_fields/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [foo.bar] 5 | 6 | 7 |

    8 |

    {foo.bar}

    9 |

    10 | 11 | 12 | -------------------------------------------------------------------------------- /test/shadowed_fields/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/shadowed_fields/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    5 | [foo.bar] 6 |

    7 |

    8 | {foo.bar} 9 |

    10 |

    11 | [foo.bar] 12 |

    13 | 14 | 15 | -------------------------------------------------------------------------------- /test/shadowed_fields/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/shadowed_parent/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | [foo.bar] 6 | 7 |

    8 |

    9 | {} 10 | 11 |

    12 |

    13 | 14 | 15 | -------------------------------------------------------------------------------- /test/shadowed_parent/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/shadowed_parent/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    5 | [foo.bar] 6 |

    7 |

    8 | {[foo.bar]} 9 |

    10 |

    11 | [foo.bar] 12 |

    13 | 14 | 15 | -------------------------------------------------------------------------------- /test/shadowed_parent/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/test.ml: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2015 David Sheets 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | * 16 | *) 17 | 18 | type result = Success | Error | Trouble 19 | type return = { 20 | blue : result; 21 | i : result; 22 | } 23 | 24 | (* Utilities *) 25 | 26 | let (/) = Filename.concat 27 | 28 | let run command args ~stdin ~stdout ~stderr ?(env=[||]) () = 29 | Unix.create_process_env 30 | command (Array.append [|command|] args) env stdin stdout stderr 31 | 32 | let after pid = Unix.(match waitpid [] pid with 33 | | (_,WEXITED k) -> k 34 | | (_,WSIGNALED _) -> failwith "child unexpectedly signalled" 35 | | (_,WSTOPPED _) -> failwith "child unexpectedly stopped" 36 | ) 37 | 38 | let with_stdout f ~stdout = 39 | let stdin = Unix.(openfile "/dev/zero" [O_RDONLY] 0o000) in 40 | f ~stdin ~stdout ~stderr:Unix.stderr 41 | 42 | let with_stderr f ~stderr = 43 | let stdin = Unix.(openfile "/dev/zero" [O_RDONLY] 0o000) in 44 | f ~stdin ~stdout:Unix.stderr ~stderr 45 | 46 | let in_dir dir f = 47 | let pwd = Unix.getcwd () in 48 | try 49 | Unix.chdir dir; 50 | let r = f () in 51 | Unix.chdir pwd; 52 | r 53 | with e -> 54 | Unix.chdir pwd; 55 | raise e 56 | 57 | let run_diff_test ~channel_fn ~dir ~result env = 58 | let stderr = Unix.stderr in 59 | let stdin, stdout = Unix.pipe () in 60 | let test_pid = in_dir dir (fun () -> 61 | channel_fn (run "test.sh" [||] ~env ()) stdout 62 | ) in 63 | Unix.close stdout; 64 | let diff_pid = 65 | run "diff" [|"-"; dir / result|] ~stdin ~stdout:stderr ~stderr () 66 | in 67 | let test_exit = after test_pid in 68 | let diff_exit = after diff_pid in 69 | (test_exit, diff_exit) 70 | 71 | let run_test ~expected_exit ~channel_fn ~dir ~result ~env ~name = 72 | let run_diff = run_diff_test ~channel_fn ~dir ~result in 73 | let (test_exit, diff_exit) = run_diff env in 74 | Alcotest.(check int ("exit"^name) expected_exit test_exit); 75 | Alcotest.(check int ("diff"^name) 0 diff_exit) 76 | 77 | let run_success_test dir name env () = 78 | let channel_fn f fd = with_stdout f ~stdout:fd in 79 | run_test 80 | ~expected_exit:0 ~channel_fn ~dir ~result:("out"^name^".xml") ~env ~name 81 | 82 | let run_error_test dir name env () = 83 | let channel_fn f fd = with_stderr f ~stderr:fd in 84 | run_test 85 | ~expected_exit:1 ~channel_fn ~dir ~result:("err"^name^".txt") ~env ~name 86 | 87 | let run_trouble_test dir name env () = 88 | let channel_fn f fd = with_stderr f ~stderr:fd in 89 | run_test 90 | ~expected_exit:2 ~channel_fn ~dir ~result:("trouble"^name^".txt") ~env ~name 91 | 92 | let run_result = function 93 | | Success -> run_success_test 94 | | Error -> run_error_test 95 | | Trouble -> run_trouble_test 96 | 97 | let run_return_test return name () = 98 | run_result return.blue name "" [|"OCAMLRUNPARAM=b";"BLUE=../../blue"|] (); 99 | run_result return.i name ".p" [|"OCAMLRUNPARAM=b";"BLUE=../../blue -p"|] () 100 | 101 | (* Tests *) 102 | 103 | let tests = 104 | List.map (fun (name,return) -> name, `Quick, run_return_test return name) 105 | 106 | let success = { blue = Success; i = Success } 107 | let error = { blue = Error; i = Error } 108 | let trouble = { blue = Trouble; i = Trouble } 109 | let partial = { blue = Error; i = Success } 110 | 111 | let success_tests ts = tests (List.map (fun name -> name, success) ts) 112 | 113 | ;; 114 | Printexc.record_backtrace true; 115 | Alcotest.run "blue" [ 116 | 117 | "Simple", success_tests [ 118 | "decl"; 119 | "self_decl"; 120 | "shadow_decl"; 121 | "shadow_scope_decl"; 122 | "shadow_scope_decl_multi"; 123 | "rich_decl"; 124 | "rich_decl_chained_open"; 125 | "rich_decl_chained_closed"; 126 | "top_seq_single"; 127 | "top_seq_ws"; 128 | "decl_local_let"; 129 | "decl_double_open"; 130 | "decl_hole_open"; 131 | "decl_hole_open_chained"; 132 | "decl_hole_closed"; 133 | "decl_hole_closed_scope"; 134 | "decl_dup"; 135 | ]; 136 | 137 | "Composition", success_tests [ 138 | "top_decl"; 139 | "top_seq_binder"; 140 | "compose2"; 141 | "compose3"; 142 | "compose_stdin"; 143 | "compose2_closure"; 144 | "compose2_closure_nonlocal"; 145 | "compose2_closure_shadow"; 146 | ]; 147 | 148 | "Default", success_tests [ 149 | "empty_let"; 150 | "default_insert"; 151 | "insert_default_insert"; 152 | "empty_insert"; 153 | "default_zero_insert"; 154 | "override_default"; 155 | "default_open"; 156 | "default_closure"; 157 | "closure_default"; 158 | "top_insert"; 159 | ]; 160 | 161 | "Attributes", success_tests [ 162 | "attr_add"; 163 | "attr_replace"; 164 | "attr_empty"; 165 | "attr_multi"; 166 | "attr_seq"; 167 | "seq_attr"; 168 | "attr_insert"; 169 | "attr_format"; 170 | "attr_tags"; 171 | "attr_compose"; 172 | ]; 173 | 174 | "Namespace", success_tests [ 175 | "ns_root_child"; 176 | "ns_root_child_shadow"; 177 | "ns_pundef_child"; 178 | "ns_pundef_child_parent"; 179 | "ns_pundef_child_compose"; 180 | "ns_implicit_child"; 181 | "ns_implicit_nested_child"; 182 | "ns_explicit_inner_child"; 183 | "ns_explicit_pre_child"; 184 | "ns_explicit_post_child"; 185 | "scoped_fields"; 186 | "closed_fields"; 187 | "shadowed_fields"; 188 | "scoped_parent"; 189 | "closed_parent"; 190 | "shadowed_parent"; 191 | ]; 192 | 193 | 194 | "Link", success_tests [ 195 | "link"; 196 | (*"link_child";*) (* TODO: Why? Fix this. *) 197 | "link_rope_child"; 198 | (*"link_child_later";*) 199 | (*"link_child_twice";*) (* TODO: Why? Fix this. *) 200 | (*"link_child_stacked";*) 201 | (*"link_child_stacked2";*) 202 | (*"link_default";*) (* TODO: Why? Fix this. *) 203 | "link_list"; 204 | (*"link_list_alt";*) (* TODO: Why? Fix this. *) 205 | "link_balanced_tree"; 206 | "link_matrix"; 207 | "link_accessible"; 208 | ]; 209 | 210 | "With", success_tests [ 211 | "with"; 212 | "with_bleed"; 213 | "with_child"; 214 | "with_rope_child"; 215 | "with_rope_child_deep"; 216 | "with_rope_child_shadow"; 217 | "with_child_later"; 218 | "with_child_twice"; 219 | "with_child_stacked"; 220 | "with_child_stacked2"; 221 | "with_default"; 222 | "with_list"; 223 | "with_list_alt"; 224 | "with_balanced_tree"; 225 | "with_matrix"; 226 | "with_accessible"; 227 | ]; 228 | 229 | "If", success_tests [ 230 | "if_empty"; 231 | "if_exists_now_false"; 232 | "if_exists_now_true"; 233 | "if_exists_false"; 234 | "if_exists_true"; 235 | "if_body_stage"; 236 | "else_body_stage"; 237 | "if_hole_stage"; 238 | "else_hole_stage"; 239 | "if_body_closed"; 240 | "else_body_closed"; 241 | ]; 242 | 243 | "Error", tests [ 244 | "bad_xml_no_close", error; 245 | "self_hole", partial; 246 | "unknown_tag", error; 247 | "bad_decl_scope", partial; 248 | "bad_insert_name", error; 249 | "bad_let_name", error; 250 | "bad_ident_comma", error; 251 | "bad_with", partial; 252 | "top_seq_multi", error; 253 | "decl_rec", error; 254 | "decl_mutual_rec", error; 255 | "decl_intro_rec", error; 256 | "bad_compose_scope", partial; 257 | "compose3_rec", error; 258 | "default_empty_insert", partial; 259 | "default_rec", error; 260 | (*"with_eloop", error;*) (* TODO: FIX ME *) 261 | (*"with_eloop_child", partial;*) (* TODO: FIX ME *) 262 | (*"link_eloop", error;*) (* TODO: FIX ME *) 263 | (*"link_eloop_child", partial;*) (* TODO: FIX ME *) 264 | "bad_attr_name", error; 265 | "attr_open", partial; 266 | "attr_floating", error; 267 | "insert_attr", error; 268 | "let_attr", error; 269 | "top_attr", error; 270 | "else_floating", error; 271 | ]; 272 | 273 | "Trouble", tests [ 274 | "enoent", trouble; 275 | ]; 276 | ] 277 | -------------------------------------------------------------------------------- /test/top_attr/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/top_attr/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | line 1, column 26: the attribute 'impossible' is not attached to a start tag 3 | -------------------------------------------------------------------------------- /test/top_attr/in.xml: -------------------------------------------------------------------------------- 1 | drop 2 | -------------------------------------------------------------------------------- /test/top_attr/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/top_decl/a.xml: -------------------------------------------------------------------------------- 1 | A 2 | -------------------------------------------------------------------------------- /test/top_decl/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |

    4 | 5 | 6 | -------------------------------------------------------------------------------- /test/top_decl/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/top_decl/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    A

    5 | 6 | 7 | -------------------------------------------------------------------------------- /test/top_decl/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} a.xml b.xml 4 | -------------------------------------------------------------------------------- /test/top_insert/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Default page 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/top_insert/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Default page 4 | 5 | 6 | -------------------------------------------------------------------------------- /test/top_insert/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Default page 4 | 5 | -------------------------------------------------------------------------------- /test/top_insert/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/top_seq_binder/in.xml: -------------------------------------------------------------------------------- 1 | 2 | dsheets 3 | 4 | 5 | Hello, World! 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/top_seq_binder/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/top_seq_binder/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello, World! 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/top_seq_binder/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/top_seq_multi/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/top_seq_multi/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Tags are not allowed after the root element 3 | -------------------------------------------------------------------------------- /test/top_seq_multi/in.xml: -------------------------------------------------------------------------------- 1 |

    P_1

    P_2

    2 | -------------------------------------------------------------------------------- /test/top_seq_multi/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/top_seq_single/in.xml: -------------------------------------------------------------------------------- 1 |

    This is the only element.

    2 | -------------------------------------------------------------------------------- /test/top_seq_single/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/top_seq_single/out.xml: -------------------------------------------------------------------------------- 1 |

    This is the only element.

    2 | -------------------------------------------------------------------------------- /test/top_seq_single/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/top_seq_ws/in.xml: -------------------------------------------------------------------------------- 1 | 2 |

    This is the first paragraph.

    3 |
    4 | -------------------------------------------------------------------------------- /test/top_seq_ws/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/top_seq_ws/out.xml: -------------------------------------------------------------------------------- 1 |

    This is the first paragraph.

    2 | -------------------------------------------------------------------------------- /test/top_seq_ws/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/unknown_tag/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/unknown_tag/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | line 2, column 14: unknown tag 'unicorn' 3 | -------------------------------------------------------------------------------- /test/unknown_tag/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /test/unknown_tag/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | a1 4 | b1 5 | 6 | 7 | a2 8 | b2 9 | 10 | 11 |

    12 |

    13 |

    14 |
    15 | 16 | 1 17 | 18 | 19 | 2 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/with/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/with/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    1

    6 |

    a1

    7 |

    b1

    8 | 9 | 10 |

    2

    11 |

    a2

    12 |

    b2

    13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/with/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_accessible/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 0 3 | 1 4 | [] 5 | 6 | 7 |

    zero

    8 |

    one

    9 | 10 | 11 | -------------------------------------------------------------------------------- /test/with_accessible/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/with_accessible/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    zero [0]

    5 |

    one [1]

    6 | 7 | 8 | -------------------------------------------------------------------------------- /test/with_accessible/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_balanced_tree/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 5 | 1 6 | 7 | 2 8 | 9 | 10 | 11 | 12 | 13 |
    14 |
    15 |
    16 | 17 |
    18 |
    19 | 20 |
    21 |
    22 |
    23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/with_balanced_tree/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
    6 |
    0
    7 |
    8 | 9 |
    10 |
    1
    11 |
    12 | 13 |
    14 |
    2
    15 |
    16 | 17 |
    18 |
    19 | 20 |
    21 |
    22 | 23 |
    24 |
    25 | 26 |
    27 |
    2
    28 |
    29 | 30 |
    31 |
    32 | 33 |
    34 |
    35 | 36 |
    37 |
    38 | 39 |
    40 |
    41 | 42 |
    43 |
    1
    44 |
    45 | 46 |
    47 |
    2
    48 |
    49 | 50 |
    51 |
    52 | 53 |
    54 |
    55 | 56 |
    57 |
    58 | 59 |
    60 |
    2
    61 |
    62 | 63 |
    64 |
    65 | 66 |
    67 |
    68 | 69 |
    70 |
    71 | 72 |
    73 |
    74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /test/with_balanced_tree/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
    6 |
    0
    7 |
    8 | 9 |
    10 |
    1
    11 |
    12 | 13 |
    14 |
    2
    15 |
    16 | 17 |
    18 |
    19 | 20 |
    21 |
    22 | 23 |
    24 |
    25 | 26 |
    27 |
    2
    28 |
    29 | 30 |
    31 |
    32 | 33 |
    34 |
    35 | 36 |
    37 |
    38 | 39 |
    40 |
    41 | 42 |
    43 |
    1
    44 |
    45 | 46 |
    47 |
    2
    48 |
    49 | 50 |
    51 |
    52 | 53 |
    54 |
    55 | 56 |
    57 |
    58 | 59 |
    60 |
    2
    61 |
    62 | 63 |
    64 |
    65 | 66 |
    67 |
    68 | 69 |
    70 |
    71 | 72 |
    73 |
    74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /test/with_balanced_tree/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_bleed/in.xml: -------------------------------------------------------------------------------- 1 | 2 | p 3 | div 4 | p2 5 | 6 | 7 |

    8 |
    9 | 10 |
    11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/with_bleed/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    p

    6 |

    div
    7 |

    p2

    8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/with_bleed/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    p

    6 |
    div
    7 |

    p2

    8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/with_bleed/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | .child.value: 4 | template with .child: 5 | 6 | 7 | 8 | template 9 | 10 | 11 | .child.value: 12 | template with .child: 13 | 14 | data 15 | 16 |
      17 |
    • before missing:
    • 18 | before 19 |
    • before present with data:
    • 20 |
    • before present:
    • 21 |
    • after missing:
    • 22 | after 23 |
    • after present with data:
    • 24 |
    • after present:
    • 25 |
    26 | 27 | 28 | -------------------------------------------------------------------------------- /test/with_child/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/with_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 |
    • before missing: 6 | .child.value: data 7 | template with .child: 8 | data 9 | 10 |
    • 11 |
    • before present with data: 12 | .child.value: data 13 | template with .child: 14 | data 15 | 16 |
    • 17 |
    • before present: 18 | .child.value: before 19 | template with .child: 20 | before 21 | 22 |
    • 23 |
    • after missing: 24 | .child.value: data 25 | template with .child: 26 | data 27 | 28 |
    • 29 |
    • after present with data: 30 | .child.value: data 31 | template with .child: 32 | data 33 | 34 |
    • 35 |
    • after present: 36 | .child.value: after 37 | template with .child: 38 | after 39 | 40 |
    • 41 |
    42 | 43 | 44 | -------------------------------------------------------------------------------- /test/with_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_child_later/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

    6 | 7 |
    8 | 9 |
    10 |
    11 | 12 | 13 | 1 14 | 15 | 2 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/with_child_later/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

    1

    7 | 8 |

    2

    9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/with_child_later/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

    1

    7 | 8 |

    2

    9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/with_child_later/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_child_stacked/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | a 14 | b 15 | c 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/with_child_stacked/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | a 7 | 8 | b 9 | 10 | c 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/with_child_stacked/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | a 7 | 8 | b 9 | 10 | c 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/with_child_stacked/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_child_stacked2/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | a 14 | b 15 | c 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/with_child_stacked2/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | a 7 | 8 | b 9 | 10 | c 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/with_child_stacked2/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | a 7 | 8 | b 9 | 10 | c 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/with_child_stacked2/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_child_twice/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | datum 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/with_child_twice/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/with_child_twice/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | datum 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/with_child_twice/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_default/in.xml: -------------------------------------------------------------------------------- 1 | 2 | x 3 | 4 | No x with data. 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/with_default/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | No x with data. 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/with_default/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | No x with data. 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/with_default/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_eloop/err.p.txt: -------------------------------------------------------------------------------- 1 | err.txt -------------------------------------------------------------------------------- /test/with_eloop/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | Disallowed traversal of 'f' 3 | from file 'in.xml', line 1, column 28 4 | -------------------------------------------------------------------------------- /test/with_eloop/in.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/with_eloop/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_eloop_child/err.txt: -------------------------------------------------------------------------------- 1 | blue: in.xml: template error: 2 | No value for hole named 'f' 3 | from file 'in.xml', line 4, column 39 4 | included as 'f.child' from file 'in.xml', line 6, column 28 5 | included as 'f' from file 'in.xml', line 8, column 21 6 | -------------------------------------------------------------------------------- /test/with_eloop_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/with_eloop_child/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/with_eloop_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_list/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 5 | 1 6 | 7 | 2 8 | 9 | 3 10 | 11 | 12 | 13 | 14 | 15 | 16 |
  • 17 | 18 |
    19 |
      20 | 21 |
    22 | 23 | 24 | -------------------------------------------------------------------------------- /test/with_list/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 | 6 |
    1. 0
    2. 7 | 8 |
    3. 1
    4. 9 | 10 |
    5. 2
    6. 11 | 12 |
    7. 3
    8. 13 | 14 | 15 | 16 | 17 | 18 |
    19 | 20 | 21 | -------------------------------------------------------------------------------- /test/with_list/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 | 6 |
    1. 0
    2. 7 | 8 |
    3. 1
    4. 9 | 10 |
    5. 2
    6. 11 | 12 |
    7. 3
    8. 13 | 14 | 15 | 16 | 17 | 18 |
    19 | 20 | 21 | -------------------------------------------------------------------------------- /test/with_list/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_list_alt/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | A 4 | 5 | B 6 | 7 | C 8 | 9 | D 10 | 11 | E 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
  • 20 | 21 |
    22 | 23 |
  • 24 | 25 |
    26 |
      27 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /test/with_list_alt/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 | 6 |
    1. A
    2. 7 | 8 |
    3. B
    4. 9 | 10 |
    5. C
    6. 11 | 12 |
    7. D
    8. 13 | 14 |
    9. E
    10. 15 | 16 | 17 | 18 | 19 | 20 | 21 |
    22 | 23 | 24 | -------------------------------------------------------------------------------- /test/with_list_alt/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 | 6 |
    1. A
    2. 7 | 8 |
    3. B
    4. 9 | 10 |
    5. C
    6. 11 | 12 |
    7. D
    8. 13 | 14 |
    9. E
    10. 15 | 16 | 17 | 18 | 19 | 20 | 21 |
    22 | 23 | 24 | -------------------------------------------------------------------------------- /test/with_list_alt/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_matrix/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 5 | 1 6 | 7 | 8 | 9 | 5 10 | 11 | 6 12 | 13 | 7 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 |
    23 | 24 |
    30 |
    31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | (,) 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/with_matrix/out.p.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
    567
    0(0,5)(0,6)(0,7)
    1(1,5)(1,6)(1,7)
    55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /test/with_matrix/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
    567
    0(0,5)(0,6)(0,7)
    1(1,5)(1,6)(1,7)
    55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /test/with_matrix/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_rope_child/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | No .fchild 4 | No .child 5 | 6 | 7 | fchild 8 | child 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/with_rope_child/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/with_rope_child/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fchild 6 | child 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/with_rope_child/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_rope_child_deep/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | No .fchild 4 | No .child 5 | 6 | 7 | fchild 8 | child 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/with_rope_child_deep/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/with_rope_child_deep/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fchild 6 | child 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/with_rope_child_deep/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /test/with_rope_child_shadow/in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | No .deep 4 | No .deep.child 5 | 6 | 7 | deep 8 | child 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/with_rope_child_shadow/out.p.xml: -------------------------------------------------------------------------------- 1 | out.xml -------------------------------------------------------------------------------- /test/with_rope_child_shadow/out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | deep 6 | child 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/with_rope_child_shadow/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ${BLUE} in.xml 4 | -------------------------------------------------------------------------------- /unix/blueprint_unix.ml: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2015 David Sheets 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | * 16 | *) 17 | 18 | open Blueprint 19 | 20 | let of_file ?(ns=fun _ -> None) path = 21 | let prov = Prov.({ src = File path; loc = None; incl = None }) in 22 | let fd = Unix.(openfile path [O_RDONLY] 0o000) in 23 | let ic = Unix.in_channel_of_descr fd in 24 | try 25 | let xml_input = Xmlm.make_input ~ns (`Channel ic) in 26 | let source = xml_source in 27 | let _, rope = of_stream ~prov ~source xml_input in 28 | close_in ic; 29 | rope 30 | with e -> (* TODO: Actually handle exceptions *) 31 | close_in ic; 32 | raise e 33 | 34 | let bind_to_file ?partial path bindings template = 35 | let oc = open_out path in 36 | bind_to_output ?partial oc bindings template; 37 | close_out oc 38 | -------------------------------------------------------------------------------- /unix/blueprint_unix.mli: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2015 David Sheets 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | * 16 | *) 17 | 18 | open Blueprint 19 | 20 | val of_file : ?ns:(string -> string option) -> string -> t 21 | (** [of_file ?ns path] is the blueprint in the file [path] interpreted 22 | according to the XML namespace map given by [?ns]. *) 23 | 24 | val bind_to_file : 25 | ?partial:bool -> string -> Rope.t Scope.t -> Rope.t -> unit 26 | (** [bind_to_file ?partial path bindings template] returns after 27 | [template] has been written to [path] using [bindings]. If 28 | [partial] is true, [bindings] need not be complete. This is a 29 | convenience function which wraps {!Blueprint.bind_to_output}. *) 30 | --------------------------------------------------------------------------------