Skip to content

paijp/diagram-in-comment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

diagram-in-comment

What is this?

  • You can draw a diagram using the comment block in your code.
  • This comment in your source....
/*jp.pa-i/syntaxdiagram
{{|({
|(}
|(|
|(r
|(?
r}{|((
[literal
|([
[name
}|(#
[config key
(=
[number
}
*/

syntaxdiagram image

  • ....by this command.
 $ php diacom.php <helper/jp.pa-i/syntaxdiagram.php >syntaxdiagram.html
  • And this comment in your source....
/*jp.pa-i.cir/cir sip3 U1
22(4[VOUT])2{c104}2[[G]
22(66[VIN])2{c104}2[[G]
22222[[G]

cir image

How does it work?

  • If you put this code into stdin,
/*sample/type-a
100
110
*/

/*sample/type-b
200
*/

/*sample/type-a
300
*/
  • diacode.php will do this.
$ php sample/type-a.php @SHA1SUM@ <<EOO
/*sample/type-a
100
110
*/

/*sample/type-b
200
*/

/*sample/type-a
300
*/
EOO

$ php sample/type-b.php @SHA1SUM@ <<EOO
/*sample/type-b
200
*/

/*sample/type-a
300
*/
EOO

$ php sample/type-a.php @SHA1SUM@ <<EOO
/*sample/type-a
300
*/
EOO
  • Each script should process the block before the first '*/'.

  • Because some scripts may process the next block of code, or the entire code.

  • diacode.php only requires stdin and stdout, so you can run these scripts under Docker.

  • @SHA1SUM@ is a SHA1 hexadecimal string and is passed as a command line parameter(argv).

  • Please use this if your helper script needs to know the version of the code.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published