CDSoft / pp

PP - Generic preprocessor (with pandoc in mind) - macros, literate programming, diagrams, scripts...

Home Page:http://cdelord.fr/pp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

what a great Generic preprocessor! • Command line argument so that replaced empty lines are deleted

schittli opened this issue · comments

commented

Good evening Christophe

thank you very much for your great work - and sharing it!, it's a really great Software.

I only have just one flaw:
It would be ingenious if one could activate this function via a command line argument:

  1. The preprocessor reads a macro
  2. If the preprocessor processed a line and the line has just white spaces,
  3. then this line will automatically be is deleted

The background is, that the processed result often has a lot of empty lines, for example, lines 2 to 4 are just used for debugging:

Macro:

	while thisBlock != null && res === null
		!ifeq(!3)(1)(print("\nidxN Test: ", idxN))
		!ifeq(!3)(1)(print("\nthisBlock: ", thisBlock))
		!ifeq(!3)(1)(print("\nthisBlock.type: ", thisBlock.type))
		if thisBlock.type == !2
		…

The result has an 3 empty line because the comment had to be removed:

	while thisBlock != null && res === null
		


		if thisBlock.type == Arg2
		…

Thanks a lot, kind regards,
Thomas

Another solution could be to introduce a built-in macro to delete/omit the whole line from the generated output, which could then be inserted in the else clauses of examples like the above.

Hello,
Modifying text outside macros may have undesirable effects in some cases.
You can also manage the layout in the arguments of the macros. e.g.:

		!ifeq(!3)(1)(print("\nidxN Test: ", idxN)
		)!ifeq(!3)(1)(print("\nthisBlock: ", thisBlock)
		)!ifeq(!3)(1)(print("\nthisBlock.type: ", thisBlock.type)
		)if thisBlock.type == !2
		…

or

		!ifeq(!3)(1)(print("\nidxN Test: ", idxN)
		print("\nthisBlock: ", thisBlock)
		print("\nthisBlock.type: ", thisBlock.type)
		)if thisBlock.type == !2
		…
commented

Thank you very much!, @CDSoft
for your support and this cool trick!, I had to think 3 times before I understood what was happening here 😅