GithubHelp home page GithubHelp logo

Offer title option about hpp2plantuml HOT 6 CLOSED

thibaultmarin avatar thibaultmarin commented on August 25, 2024
Offer title option

from hpp2plantuml.

Comments (6)

thibaultmarin avatar thibaultmarin commented on August 25, 2024

I am looking into this. I plan to add support for templates to solve this and #4 simultaneously.

from hpp2plantuml.

thibaultmarin avatar thibaultmarin commented on August 25, 2024

v0.5 should now support templates. See the readme for an example setting the title and skinparam. Please let me know if that fixes the issue.

from hpp2plantuml.

PanderMusubi avatar PanderMusubi commented on August 25, 2024

The extends results in only the content of the file to be included. The block preamble only results in what is added there. I am missing what normally is added by hpp2plantuml.

from hpp2plantuml.

PanderMusubi avatar PanderMusubi commented on August 25, 2024

As example, please also add

{% block preamble %}
!include default.puml

title The Title
{% endblock %}

In that way, the file to be included is not included literally but via reference.

from hpp2plantuml.

thibaultmarin avatar thibaultmarin commented on August 25, 2024

I don't understand the problem. Here are the steps I use and the corresponding
outputs.

Setup a virtual environment

virtualenv -p python3 hpp2plantuml/

Load the virtual environment

source hpp2plantuml/bin/activate

For Windows this may look like: hpp2plantuml\Scripts\activate.bat.

Clone the repository

This is to get the example files.

git clone https://github.com/thibaultmarin/hpp2plantuml.git hpp2plantuml-src/

Install hpp2plantuml

pip install hpp2plantuml

Tests

Default template

Using the default template, I get the following result (no preamble):

hpp2plantuml -i "hpp2plantuml-src/tests/simple_classes_*.hpp" -o output_1.puml

Result:

@startuml





/' Objects '/

abstract class Class01 {
	+{abstract} AbstractPublicMethod(int param) : bool
	+PublicMethod(int param) : bool {query}
	+{static} StaticPublicMethod(bool param) : bool
	#{abstract} _AbstractMethod(int param) : bool
	#_ProtectedMethod(int param) : bool
	#{static} _StaticProtectedMethod(bool param) : bool
	#_protected_var : int
	+public_var : int
}


class Class02 {
	+AbstractPublicMethod(int param) : bool
	-_AbstractMethod(int param) : bool
	-_PrivateMethod(int param) : bool
	-{static} _StaticPrivateMethod(bool param) : bool
	-_private_var : int
}


class Class03 <template<typename T>> {
	+Class03()
	+~Class03()
	-_data : Class01*
	-_obj : Class01*
	-_typed_obj : T*
	-_obj_list : list<Class02>
}


namespace Interface {
	class Class04 {
		+Class04()
		+~Class04()
		-_obj : Class01*
		-_flag : bool
	}
}


namespace Interface {
	class Class04_derived {
		+Class04_derived()
		+~Class04_derived()
		-_var : int
	}
}


enum Enum01 {
	VALUE_0
	VALUE_1
	VALUE_2
}





/' Inheritance relationships '/

.Class01 <|-- .Class02


namespace Interface {
	Class04 <|-- Class04_derived
}





/' Aggregation relationships '/

.Class03 "2" o-- .Class01


.Class03 o-- .Class02


Interface.Class04 o-- .Class01




@enduml

Custom template

To add a title and skinparam options, the custom template examples seems to
work for me:

hpp2plantuml -i "hpp2plantuml-src/tests/simple_classes_*.hpp" -o output_2.puml -t hpp2plantuml-src/tests/custom_template.puml

Result:

@startuml


title "This is a title"
skinparam backgroundColor #EEEBDC
skinparam handwritten true



/' Objects '/

abstract class Class01 {
	+{abstract} AbstractPublicMethod(int param) : bool
	+PublicMethod(int param) : bool {query}
	+{static} StaticPublicMethod(bool param) : bool
	#{abstract} _AbstractMethod(int param) : bool
	#_ProtectedMethod(int param) : bool
	#{static} _StaticProtectedMethod(bool param) : bool
	#_protected_var : int
	+public_var : int
}


class Class02 {
	+AbstractPublicMethod(int param) : bool
	-_AbstractMethod(int param) : bool
	-_PrivateMethod(int param) : bool
	-{static} _StaticPrivateMethod(bool param) : bool
	-_private_var : int
}


class Class03 <template<typename T>> {
	+Class03()
	+~Class03()
	-_data : Class01*
	-_obj : Class01*
	-_typed_obj : T*
	-_obj_list : list<Class02>
}


namespace Interface {
	class Class04 {
		+Class04()
		+~Class04()
		-_obj : Class01*
		-_flag : bool
	}
}


namespace Interface {
	class Class04_derived {
		+Class04_derived()
		+~Class04_derived()
		-_var : int
	}
}


enum Enum01 {
	VALUE_0
	VALUE_1
	VALUE_2
}





/' Inheritance relationships '/

.Class01 <|-- .Class02


namespace Interface {
	Class04 <|-- Class04_derived
}





/' Aggregation relationships '/

.Class03 "2" o-- .Class01


.Class03 o-- .Class02


Interface.Class04 o-- .Class01




@enduml

Include template

If I try to use the template you are proposing, the output does not look good to
me:

echo "{% block preamble %}" > custom_include.puml
echo '!'"include default.puml" >> custom_include.puml
echo "title The Title" >> custom_include.puml
echo "{% endblock %}" >> custom_include.puml

hpp2plantuml -i "hpp2plantuml-src/tests/simple_classes_*.hpp" -o output_3.puml -t custom_include.puml

Result:

!include default.puml
title The Title

I think that 4.1 and 4.2 behave as expected. Can you please
describe in detail what the problem is (input/output/expected output)?

from hpp2plantuml.

thibaultmarin avatar thibaultmarin commented on August 25, 2024

@PanderMusubi, can this and #4 be closed?

from hpp2plantuml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.