vim-literate-markdown

A Vim plugin to replicate a subset of Org mode's literate programming, for Markdown files.
git clone git://git.alex.balgavy.eu/vim-literate-markdown.git
Log | Files | Refs | README

commit ea4bd5f8ec93e92e00ef295face1f66c573919b9
parent a494f8c891c3bae268aeb74ccf70bd1bf3a98c9a
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Thu, 14 Apr 2022 14:59:23 +0200

Working on more tests

Diffstat:
Atests/macro_included_in_two_separate_blocks.md | 26++++++++++++++++++++++++++
Atests/macro_included_in_two_separate_blocks.rb | 10++++++++++
Atests/output.rb | 10++++++++++
Mtests/run.sh | 12+++++++++++-
Atests/wip/out_of_order_macros.md | 13+++++++++++++
Atests/wip/out_of_order_macros.rb | 4++++
Atests/wip/two_top_level_expansions.md | 19+++++++++++++++++++
7 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/tests/macro_included_in_two_separate_blocks.md b/tests/macro_included_in_two_separate_blocks.md @@ -0,0 +1,26 @@ +# Including a macro in two separate blocks +<!-- :Tangle(ruby) <^> DIRNAME/FILENAME.rb --> +```ruby +def whatever + <<block 1>> + <<block 2>> +end +``` + +<!-- :Tangle(ruby) <> <block 1> --> +```ruby +<<to include>> +puts x +``` + +<!-- :Tangle(ruby) <> <block 2> --> +```ruby +<<to include>> +x +``` + +<!-- :Tangle(ruby) <to include> --> +```ruby +x = "whatever" +``` + diff --git a/tests/macro_included_in_two_separate_blocks.rb b/tests/macro_included_in_two_separate_blocks.rb @@ -0,0 +1,10 @@ +def whatever + + + x = "whatever" + puts x + + + x = "whatever" + x +end diff --git a/tests/output.rb b/tests/output.rb @@ -0,0 +1,10 @@ +def whatever + + + x = "whatever" + puts x + + + x = "whatever" + x +end diff --git a/tests/run.sh b/tests/run.sh @@ -40,7 +40,17 @@ test_block_exec() { # Run the tests test_block_exec -for i in all_in_one_file only_specific_language two_different_languages simple_macros example_1 example_2 example_3 indented_tangle_directive; do run_test "$i"; done +for i in \ + all_in_one_file \ + only_specific_language \ + two_different_languages \ + simple_macros \ + example_1 \ + example_2 \ + example_3 \ + indented_tangle_directive \ + macro_included_in_two_separate_blocks +do run_test "$i"; done rm -r "$tempdir" trap - INT TERM EXIT diff --git a/tests/wip/out_of_order_macros.md b/tests/wip/out_of_order_macros.md @@ -0,0 +1,13 @@ +# Out of order macros +<!-- :Tangle(ruby) <the block> --> +```ruby +x = "whatever" +``` + +<!-- :Tangle(ruby) <^> output.rb --> +```ruby +def something + <<the block>> + x +end +``` diff --git a/tests/wip/out_of_order_macros.rb b/tests/wip/out_of_order_macros.rb @@ -0,0 +1,4 @@ +def something + x = "whatever" + x +end diff --git a/tests/wip/two_top_level_expansions.md b/tests/wip/two_top_level_expansions.md @@ -0,0 +1,19 @@ +# Two top-level expansions +<!-- :Tangle(ruby) <^> output.rb --> +```ruby +def whatever + <<to include>> +end +``` + +<!-- :Tangle(ruby) <^> output2.rb --> +```ruby +def something + <<to include>> +end +``` + +<!-- :Tangle(ruby) <to include> --> +```ruby +x = "whatever" +```