Skip to content

Commit

Permalink
Problem: asciidoc source interferes with styx templating
Browse files Browse the repository at this point in the history
Solution: Escape all single quote pairs as HTML entities.
  • Loading branch information
clacke committed Apr 25, 2018
1 parent 83e1b30 commit 1cf134b
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 109 deletions.
26 changes: 13 additions & 13 deletions HOWTO.adoc
Expand Up @@ -223,13 +223,13 @@ image::https://raw.githubusercontent.com/fractalide/fractalide/master/doc/images

image::https://raw.githubusercontent.com/fractalide/fractalide/master/doc/images/get.png[get]

[source, nix]
[source, nix, subs="none"]
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes; with edges; ''
flowscript = with nodes; with edges; ''
db_path => db_path get_sql()
input => input id(${todo_get_id}) id -> get get_sql(${sqlite_local_get})
get_sql() id -> id todo_build_json(${todo_build_json})
Expand All @@ -238,7 +238,7 @@ subgraph {
todo_build_json() json -> playload build_resp(${todo_build_response})
get_sql() error -> error build_resp()
build_resp() response -> response todo_add_req_id() response => response
'';
'';
}
----

Expand Down Expand Up @@ -271,13 +271,13 @@ Please understand how the code maps to the above diagram, as these particular di

image::https://raw.githubusercontent.com/fractalide/fractalide/master/doc/images/post.png[post]

[source, nix]
[source, nix, subs="none"]
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes; with edges; ''
flowscript = with nodes; with edges; ''
db_path => db_path insert_todo()
input => input todo_get_todo(${todo_get_todo}) todo -> input cl_todo(${msg_clone})
cl_todo() clone[0] -> insert insert_todo(${sqlite_local_insert})
Expand All @@ -286,7 +286,7 @@ subgraph {
todo_get_todo() req_id -> id todo_add_req_id(${todo_add_req_id})
todo_build_json() json -> playload todo_build_response(${todo_build_response})
todo_build_response() response -> response todo_add_req_id() response => response
'';
'';
}
----

Expand Down Expand Up @@ -316,20 +316,20 @@ post() response -> response http()

image::https://raw.githubusercontent.com/fractalide/fractalide/master/doc/images/delete.png[delete]

[source, nix]
[source, nix, subs="none"]
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes; with edges; ''
flowscript = with nodes; with edges; ''
input => input id(${todo_get_id})
db_path => db_path delete_sql()
id() id -> delete delete_sql(${sqlite_local_delete})
delete_sql() response -> playload build_resp(${todo_build_response})
id() req_id -> id todo_add_req_id(${todo_add_req_id})
build_resp() response -> response todo_add_req_id() response => response
'';
'';
}
----

Expand Down Expand Up @@ -371,13 +371,13 @@ To simplify the graph a little, we've not mentioned the edge from `synch` to `pa

image::https://raw.githubusercontent.com/fractalide/fractalide/master/doc/images/patch_final.png[patch_final]

[source, nix]
[source, nix, subs="none"]
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes; with edges; ''
flowscript = with nodes; with edges; ''
input => input todo_get_todo(${todo_get_todo})
db_path => db_path patch_sql()
todo_get_todo() id -> get get_sql(${sqlite_local_get})
Expand All @@ -390,7 +390,7 @@ subgraph {
get_sql() error -> error synch() error -> error build_resp()
todo_get_todo() req_id -> id todo_add_req_id(${todo_add_req_id})
build_resp() response -> response todo_add_req_id() response => response
'';
'';
}
----

Expand Down Expand Up @@ -426,7 +426,7 @@ You can also fiddle with

Insert this into your `Configuration.nix`

[source, nix]
[source, nix, subs="none"]
----
{ config, pkgs, ... }:
Expand Down
6 changes: 3 additions & 3 deletions README.adoc
Expand Up @@ -86,7 +86,7 @@ Flow-based programming in our books has delivered on its promise. In our system

When nix is assigned the responsibility of declaratively building fbp `nodes`, a magic thing happens. All that manual overhead of having to build, manage and package etc gets done once and only once by the `node` author, and completely disappears for everyone thereafter. We're left with the reusable good parts that FBP has to offer. Indeed the greatest overhead a `node` user has, is typing the ``node``'s name. We've gone further and distilled the overhead to a few lines, no more intimidating than a typical config file such as `Cargo.toml`:

[source, nix]
[source, nix, subs="none"]
----
{ agent, edges, mods, pkgs }:
Expand Down Expand Up @@ -233,9 +233,9 @@ Now you can add and commit your changes:
[source, sh]
----
$ git add changed_file.js //repeat for each file you changed
$ git commit -m 'problem: very short description of problem //do not close the '', press ENTER two (2) times
$ git commit -m 'problem: very short description of problem //do not close the '', press ENTER two (2) times
>
>solution: short description of how you solved the problem.' //Now you can close the ''. Also mention the issue number if there is one (e.g. #6)
>solution: short description of how you solved the problem.' //Now you can close the ''. Also mention the issue number if there is one (e.g. #6)
$ git push //this will send your changes to _your_ fork on Github
----
* Go to your fork on Github and select the branch you just worked on. Click "pull request" to send a pull request back to the Fractalide repository.
Expand Down
26 changes: 13 additions & 13 deletions doc/quick-start.adoc
Expand Up @@ -16,25 +16,25 @@ $ cd fractalide
The directory will have one file:

[source, nix]
[source, nix, subs="none"]
.edges/prim/bool/default.nix
----
{ edge, edges }:
edge {
src = ./.;
edges = with edges; [];
schema = with edges; ''
schema = with edges; ''
struct PrimBool {
bool @0 :Bool;
}
'';
'';
}
----

* Now we need to make your new `edge` seen by the system. Insert your newly created `edge` into `edges/default.nix`.
[source, nix]
[source, nix, subs="none"]
.edges/default.nix
----
{ pkgs, support, ... }:
Expand Down Expand Up @@ -185,7 +185,7 @@ $ touch nodes/rs/maths/boolean/nand/default.nix

Then insert the below into the `default.nix`

[source, nix]
[source, nix, subs="none"]
.nodes/rs/maths/boolean/nand/default.nix
----
{ agent, edges, mods, pkgs }:
Expand All @@ -205,7 +205,7 @@ Also `mods = with mods.rs; [ rustfbp capnp ];` is where we included our `crate`

* We need to make our `NAND` seen by the system by adding it to `nodes/rs/default.nix`
[source, nix]
[source, nix, subs="none"]
.nodes/rs/default.nix
----
{ pkgs, support, ... }:
Expand Down Expand Up @@ -241,18 +241,18 @@ touch nodes/rs/maths/boolean/not/default.nix

Then insert the below into `default.nix`:

[source, nix]
[source, nix, subs="none"]
.nodes/rs/maths/boolean/not/default.nix
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes.rs; ''
flowscript = with nodes.rs; ''
input => input clone(${msg_clone})
clone() clone[1] -> a nand(${maths_boolean_nand}) output => output
clone() clone[2] -> b nand()
'';
'';
}
----
Expand All @@ -262,7 +262,7 @@ Notice the `${maths_boolean_nand}` and `${msg_clone}`. Nix will replace these wi

* Add your new NOT `subgraph` to the `nodes/rs/default.nix`
[source, nix]
[source, nix, subs="none"]
.nodes/rs/default.nix
----
{ pkgs, support, ... }:
Expand Down Expand Up @@ -303,7 +303,7 @@ Notice the `${maths_boolean_nand}` and `${msg_clone}` were replaced with fully q
First, edit `nodes/rs/test/not/default.nix` so that it looks like this:

[source, nix]
[source, nix, subs="none"]
.nodes/rs/test/not/default.nix
----
{ subgraph, imsg, nodes, edges }:
Expand All @@ -317,9 +317,9 @@ let
in
subgraph {
src = ./.;
flowscript = with nodes.rs; ''
flowscript = with nodes.rs; ''
'${PrimBool}' -> input not(${maths_boolean_not}) output -> input io_print(${maths_boolean_print})
'';
'';
}
----

Expand Down
42 changes: 21 additions & 21 deletions edges/README.adoc
Expand Up @@ -23,15 +23,15 @@ So despite you seeing only Cap'n Proto schema in this directory, the concept of

When developing a `subgraph` there comes a time when the developer wants to inject data into an `agent` or another `subgraph`. One needs to use an `exposed edge` or an `imsg` (initial message) which has this syntax:

[source, nix]
[source, nix, subs="none"]
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes; with edges; ''
flowscript = with nodes; with edges; ''
'${prim_bool}:(boolean=true)' -> INPUT_PORT NAME()
'';
'';
}
----

Expand All @@ -47,43 +47,43 @@ Examples of `hidden edges`

* From one `agent` to another `agent`:

[source, nix]
[source, nix, subs="none"]
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes; with edges; ''
flowscript = with nodes; with edges; ''
agent1() output -> input agent2()
'';
'';
}
----

* Into a `subgraph`:

[source, nix]
[source, nix, subs="none"]
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes; with edges; ''
flowscript = with nodes; with edges; ''
output => input subgraph()
'';
'';
}
----

* Out of a `subgraph`:

[source, nix]
[source, nix, subs="none"]
----
{ subgraph, nodes, edges }:
subgraph {
src = ./.;
flowscript = with nodes; with edges; ''
flowscript = with nodes; with edges; ''
agent() output => output
'';
'';
}
----

Expand Down Expand Up @@ -133,20 +133,20 @@ The `edge` building function accepts these arguments:
* The `edges` attribute resolve transitive dependencies and ensures your `agent` has all the needed files to type check.
* a https://capnproto.org[Cap 'n Proto] `schema`. This is the heart of the contract, this is where you may create potentially complex deep hierarchies of structured data. Please read more about the https://capnproto.org/language.html[schema language].

[source, nix]
[source, nix, subs="none"]
----
{ edge, edges }:
edge {
src = ./.;
edges = with edges; [ command ];
schema = with edges; ''
schema = with edges; ''
@0xf61e7fcd2b18d862;
using Command = import "${command}/src/edge.capnp";
struct ListCommand {
commands @0 :List(Command.Command);
}
'';
'';
}
----

Expand All @@ -164,14 +164,14 @@ The same naming applies for Cap'n Proto `enums` and `interfaces`. It's crucial t
We prefer composition of schema, and the schema must have fully qualified struct names.
Hence, this is example shouldn't be used:

[source, nix]
[source, nix, subs="none"]
----
{ edge, edges }:
edge {
src = ./.;
edges = with edges; [ command ];
schema = with edges; ''
schema = with edges; ''
@0xf61e7fcd2b18d862;
struct Person {
name @0 :Text;
Expand All @@ -197,7 +197,7 @@ edge {
month @1 :UInt8;
day @2 :UInt8;
}
'';
'';
}
----

Expand All @@ -211,20 +211,20 @@ Therefore to avoid this scenario please put `struct Date ...` into it's own sche

Fractalide resolves transitive dependencies for you but you have to use this method:

[source, nix]
[source, nix, subs="none"]
----
{ edge, edges }:
edge {
src = ./.;
edges = with edges; [ command ];
schema = with edges; ''
schema = with edges; ''
@0xf61e7fcd2b18d862;
using CommandInstanceName = import "${command}/src/edge.capnp";
struct ListCommand {
commands @0 :List(CommandInstanceName.Command);
}
'';
'';
}
----

Expand Down
2 changes: 1 addition & 1 deletion fractals/README.adoc
Expand Up @@ -58,7 +58,7 @@ Should you start a new shell, type `<ctrl>-r` then type `125ff` this will search

Insert the below code into a file called `default.nix` which sits in the above folder.

[source, nix]
[source, nix, subs="none"]
.dev/fractalide/fractals/net/http/default.nix
----
{ pkgs
Expand Down

0 comments on commit 1cf134b

Please sign in to comment.