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

!include in pp interferes with !include in PlantUML

holmboe opened this issue · comments

I am trying to use the !include directive in PlantUML and it is processed by pp before it reaches PlantUML, and naturally it fails.

A Markdown file:

!uml(network-overview-diagram)(Network Overview Diagram)
~~~
!include <tupadr3/common>
!include <tupadr3/font-awesome/cloud>
FA_CLOUD([datacenter],Datacenter,frame) #White {
}
~~~

The error message is: pp: include wrong number of arguments

I thought I'd work around the issue by using !includeurl, which is a PlantUML directive, but not a pp directive, but it fails too.

You can tell pp not to preprocess some parts of the file with the !raw macro:

  !uml(network-overview-diagram)(Network Overview Diagram)
  ~~~
  !raw(!)include <tupadr3/common>
  !raw(!)include <tupadr3/font-awesome/cloud>
  FA_CLOUD([datacenter],Datacenter,frame) #White {
  }
  ~~~

or:

  !uml(network-overview-diagram2)(Network Overview Diagram)
  ~~~
  !raw
  ```
  !include <tupadr3/common>
  !include <tupadr3/font-awesome/cloud>
  FA_CLOUD([datacenter],Datacenter,frame) #White {
  }
  ```
~~~

You can also use macrochars to change the character used to execute macros. e.g.:

!macrochars(§)  §comment(from here, § calls pp macros)

§uml(network-overview-diagram3)(Network Overview Diagram)
~~~
!include <tupadr3/common>
!include <tupadr3/font-awesome/cloud>
FA_CLOUD([datacenter],Datacenter,frame) #White {
}
~~~

§macrochars(!)  !comment(restore the default char)

I use this macro in pp.md to document macros without executing them.

I was hoping for something along the lines of your second comment (with the macrochars), much appreciated that it did in fact exist. It solved my problem. 🥇

FYI, I also tried !raw(!)include and !raw-with-block as per your first comment but couldn't get it to work in my tests, though I might very well have messed something up on my end.