princomp / princomp.github.io

Teaching material for the principles of computer programming using C#.
https://princomp.github.io/
Creative Commons Attribution 4.0 International
0 stars 1 forks source link

Document UML template standard and integration #13

Closed aubertc closed 3 weeks ago

aubertc commented 1 month ago

The changes implemented with https://github.com/princomp/princomp.github.io/commit/c7de98ba77c83691d6f6ae24df094b79751e5bf1 should be added to the documentation and explained.

aubertc commented 1 month ago

Actually since mermaid supports class diagrams, and since both quartz and pandoc (with a filter) supports mermaid, we may want to switch to this formalism instead of doing "table in text format".

aubertc commented 1 month ago

Ok, thinking out loud: processing this file

test.md

with pandoc -t html -F mermaid-filter -o something.html test.md gives a html file

<p><img src="TEST.png" title="fig:" alt="TEST" /></p>

and the TEST.png image attached. TEST

removing loc=. from the .md file and processing it with

export MERMAID_FILTER_CAPTION=$(sed -e '1d;$d;/classDiagram/d' test.md) && pandoc -t html -F mermaid-filter -o something.html test.md 

gives a cleaner html file (with the image embedded as a svg as a uri-data):

<p><img
src="[data:image/png;base64,iVBORw0KGg…mCC)"
title="fig:" alt="class ClassName {
    -attribute : type
    +SetAttribute(attributeParameter: type) void
    +GetAttribute() type
    +Method(paramName: type) type 
}" 

but there are two issues with that:

  1. The "title" attribute is messed up, and I don't know why or how to fix that,
  2. the alt attribute is set with an environment variable, meaning we won't be able to set more than one such variable per document (which is very strange).
aubertc commented 1 month ago

Ok, what we could do is generate the .md first, using

export MERMAID_FILTER_CAPTION=$(sed -e '1d;$d;/classDiagram/d' test.md) && pandoc -F mermaid-filter -o test2.md -fmarkdown-implicit_figures  test.md

and then use that file. Using -fmarkdown-implicit_figures when using that file remove the (useless?) caption, but still messes up the figure's title.

aubertc commented 3 weeks ago

Ok, it has been implemented:

https://github.com/princomp/princomp.github.io/blob/5eb4ccd55638871afa3ff7ed1d3222aedfdb22a6/source/Makefile#L247-L267

and documented:

https://github.com/princomp/princomp.github.io/blob/5eb4ccd55638871afa3ff7ed1d3222aedfdb22a6/source/docs/about/dev_guide.md?plain=1#L162-L169