thibaultmarin / hpp2plantuml

Convert C++ header files to PlantUML
MIT License
223 stars 35 forks source link

Offer skin file option #4

Closed PanderMusubi closed 5 years ago

PanderMusubi commented 5 years ago

Please, offer an optional argument to include a skin file.

For example, the option can be called -s or --skin-file and requires a valid path to a file. The file will contain skinparam settings and its path will be used after an !include command following directly the @startuml command at the top of in the generated PlantUML file.

thibaultmarin commented 5 years ago

v0.5 allows templates (see https://github.com/thibaultmarin/hpp2plantuml#command-line for an example adding skinparam lines)

PanderMusubi commented 5 years ago

With version 0.5, I use as ninja template:

{% extends "skin.iuml" %}

{% block preamble %}
title Nuspell
{% endblock %}

and run

hpp2plantuml -i "../../../nuspell/src/nuspell/*.hxx" -o 99-source-generated-class-diagram.pu -t 99-source-generated-class-diagram.jinja

When I use the template, I only get the expanded content of the template in the pu output file. When I do not use the template, I do get class diagram in the pu output file. am I missing something?

thibaultmarin commented 5 years ago

I don't know what is in skin.iuml or where the file is located, so it is difficult to diagnose the problem. It looks like you may be trying to extend a skin.iuml template which I am guessing may extend 'default.puml'. jinja2 may be failing to find skin.iuml (because it does not belong to the package) so you may only get the title block. If skin.iuml were in the same location as default.puml, maybe things would work.

On 2019-01-01T09:50:49-0500, Pander wrote:

With version 0.5, I use as ninja template:

  {% extends "skin.iuml" %}

  {% block preamble %}
  title Nuspell
  {% endblock %}

and run

  hpp2plantuml -i "../../../nuspell/src/nuspell/*.hxx" -o 99-source-generated-class-diagram.pu -t 99-source-generated-class-diagram.jinja

When I use the template, I only get the expanded content of the template in the pu output file. When I do not use the template, I do get class diagram in the pu output file. am I missing something?

-- You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub: https://github.com/thibaultmarin/hpp2plantuml/issues/4#issuecomment-450735928

PanderMusubi commented 5 years ago

Thanks for the feedback. The skin.iuml is in the same directory and has only skinparam lines. When I rename it to default.puml and refer to that file, the same error occurs.

You can duplicate the error easily by doing this (the shell files are very simple):

cd /tmp
wget https://github.com/nuspell/nuspell/archive/master.zip
unzip master.zip
rm -f master.zip
mv nuspell-master nuspell
wget https://github.com/nuspell/misc-nuspell/archive/master.zip
unzip master.zip
cd misc-nuspell-master/uml/
./1-hpp2plantuml-fixme.sh
more plantuml/99-source-generated-class-diagram.pu

This results in only content of the template file, but no class diagram, that is the issue here:

!include skin.iuml

title Nuspell

Then run it without using a template:

./1-hpp2plantuml-workaround.sh
more plantuml/99-source-generated-class-diagram.pu

will show the class diagram, but not anything from the template of course.

I have noticed that referring to a missing template file will result also in a class diagram. But any line in the template will get put in the output file, but no class diagram, even when the template file is empty.

thibaultmarin commented 5 years ago

I cannot reproduce your problem. When I run:

cd /tmp
wget https://github.com/nuspell/nuspell/archive/master.zip
unzip master.zip
rm -f master.zip
mv nuspell-master nuspell
wget https://github.com/nuspell/misc-nuspell/archive/master.zip
unzip master.zip
cd misc-nuspell-master/uml/
./1-hpp2plantuml-fixme.sh
more plantuml/99-source-generated-class-diagram.pu

I get an output that starts with

@startuml

title Nuspell

/' Objects '/

namespace nuspell {
    class Aff_Data {

which looks correct to me.

To include the skin.iuml, the following works for me (run this while in the misc-nuspell-master/uml/ folder):

cat > plantuml/99-source-generated-class-diagram-skin.jinja <<EOL
{% extends 'default.puml' %}

{% block preamble %}
title Nuspell
{% include 'skin.iuml' %}
{% endblock %}
EOL

cd plantuml
hpp2plantuml -i "../../../nuspell/src/nuspell/*.hxx" -o 99-source-generated-class-diagram-skin.pu -t 99-source-generated-class-diagram-skin.jinja
cd ..
more plantuml/99-source-generated-class-diagram-skin.pu

What output do you get?

I ran everything from a fresh virtual environment, maybe you can try that.