Opened 6 years ago

Closed 12 months ago

# Render text from repository

Reported by: Owned by: simon@… rjollos normal PlantUmlMacro normal hasienda 0.11

### Description

It would be nice if it would be possible to render a UML graph from text in the repository rather than text inlined in the wiki page.

### comment:1 follow-up: ↓ 6 Changed 6 years ago by airadier

• Owner changed from robert_martin to airadier
• Status changed from new to assigned

Indeed it would be nice. I'll take a look to implement rendering from source: (repository) and from attach: too.

### comment:2 Changed 4 years ago by rjollos

• Owner changed from airadier to rjollos
• Status changed from assigned to new

The CodeExampleMacro implements a similar feature.

### comment:4 follow-up: ↓ 5 Changed 4 years ago by rjollos

• Cc hasienda added; anonymous removed

I have a working implementation of this feature, which just needs some unit tests added. I also have some questions about the syntax. What is the proper way to pass arguments to WikiProcessors? The only example I could find in Trac 0.12 is the div processor: t:WikiProcessors#Examples. Following that example, the proper syntax would be:

{{{
#!PlantUML path=/somepath
}}}


but I'm not sure how the argument gets passed to the WikiProcessor, and whether this could be made to work with both Trac 0.11 and 0.12.

Maybe a better option would be to provide a WikiMacro for rendering text from the repository. For example,

[[PlantUML(somepath)]]

If we go that route, then I think #9906 should be implemented, and the WikiProcessor should be named plantuml and the macro named PlantUml.

### comment:5 in reply to: ↑ 4 Changed 4 years ago by rjollos

but I'm not sure how the argument gets passed to the WikiProcessor, and whether this could be made to work with both Trac 0.11 and 0.12.

I found that this is actually clearly described in the documentation: trac/wiki/api.py.

### comment:6 in reply to: ↑ 1 Changed 4 years ago by rjollos

Indeed it would be nice. I'll take a look to implement rendering from source: (repository) and from attach: too.

It seems like the ideal approach here would be to pattern this after the ImageMacro syntax. As I'm writing the code for this, I'm finding it is very similar to code that I've recently written for the IncludeMacro.

### comment:7 follow-up: ↓ 9 Changed 4 years ago by rjollos

(In [11637]) Refs #7053: Added support for rendering markup from the repository. NOTE: This is work in progress and the calling syntax will change as support for additional realms is added. Feedback is welcome and appreciated.

The following are supported:

[[PlantUml(/path/to/repository)]]

[[PlantUml(/repos/path/to/repository@rev)]] (i.e. multi-repository installations and specific revisions are supported).

{{{
#!plantuml path="/path/to/repository"
...
}}}


{{{
#!plantuml path="/repos/path/to/repository@rev"
...
}}}


The Trac convention is to use camelcase names for macro calls and lowercase names for WikiProcessors, therefore PlantUml and plantuml have been added as valid casings. However, PlantUML is still a valid casing, retained for backwards compatibility.

### comment:8 Changed 4 years ago by rjollos

(In [11638]) Refs #7053: Added support for translation of error messages.

### comment:9 in reply to: ↑ 7 ; follow-up: ↓ 10 Changed 4 years ago by tom.ghyselinck@…

Hi,

I would be great if we could diversify between two figures in a single file.

e.g. /path/to/source/file.txt contains:

@startuml{figure1.png}
title figure1
@enduml

...

@startuml{figure2.png}
title figure2
@enduml



You could provide something like [[PlantUml(/path/to/source/file.txt#figure1)]] or [[PlantUml(/path/to/source/file.txt@rev#figure1)]] ?
I don't know by heart what's the correct (Trac) syntax for such references.

### comment:10 in reply to: ↑ 9 Changed 4 years ago by rjollos

I would be great if we could diversify between two figures in a single file.

Thanks for your feedback. That seems like a good feature to have, and I will see if I can add it after I add the other plantuml markup sources I have planned to support (wiki, attachment, ...).

### comment:11 Changed 4 years ago by rjollos

(In [12389]) Refs #10229, #7053:

• Fixed error reported on Trac 0.11.7 in which calls containing the uml in the body of the wikiprocessor would fail with Path not specified.
• A message with the file path is now reported when the file is not found in the repository.

### comment:12 Changed 12 months ago by rjollos

• Resolution set to fixed
• Status changed from new to closed