Giter VIP home page Giter VIP logo

diagrams's People

Contributors

gitter-badger avatar jeffcorp avatar wolfgangfahl avatar

Stargazers

 avatar

Watchers

 avatar  avatar

diagrams's Issues

Handle errors

if there is an error in generating a diagram it should be propagated to the wiki client with a proper json message.

@startuml,@enduml

plantuml diagrams should be automatically wrapped as did the original plantuml extension

AttributeError: 'NoneType' object has no attribute 'generate'

I'm trying upgrading our Mediawiki installation from an old version to 1.35 LTS. GraphViz isn't maintained anymore, so I'm now using the plugin Diagrams. The Python application is running and I can draw diagrams directly from the build-in webgui. Only drawing a diagram from our Mediawiki installation doesn't work. Diagrams show the following error when I try to draw a diagram from Mediawiki:

[2022-02-08 13:28:14,315] ERROR in app: Exception on /render [POST]
Traceback (most recent call last):
 File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2073, in wsgi_app
   response = self.full_dispatch_request()
 File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1518, in full_dispatch_request
   rv = self.handle_user_exception(e)
 File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1516, in full_dispatch_request
   rv = self.dispatch_request()
 File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1502, in dispatch_request
   return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
 File "dgs/webserver.py", line 68, in renderForWikiExtension
   result=gen.generate('dot',source,targetFormat)
AttributeError: 'NoneType' object has no attribute 'generate'

The diagram I tried to draw:

<graphviz>
   digraph G {
     rankdir = TD;
     edge [arrowhead=none];
     node [shape=box, color=lightblue2, style=filled];
     "dummy1"; "dummy2"; "dummy3";

     "dummy1" -> "dummy3" [label="100Mbps" fontsize="10"];
     "dummy1" -> "dummy3" [label="100Mbps" fontsize="10"];
     "dummy2" -> "dummy3" [label="100Mbps" fontsize="10"];
     "dummy2" -> "dummy3" [label="100Mbps" fontsize="10"];
   }
</graphviz>

LocalSettings.php:

wfLoadExtension('Diagrams');
$wgDiagramsServiceUrl = 'http://127.0.0.1:5003';

TIKZ code as result

Using TIKZ is the common way to draw pictures/diagrams with latex.
An output option would be very helpful.
Below is an example of an UML-Class diagram using the tikz-uml package, see overleaf example as well.

\begin{tikzpicture}
  \begin{umlpackage}{EquipmentProfile}
    \umlclass[]{Terminal}{conductedTo : ACLineSegment\\limit: Limit}{}
    \umlclass[x=-5, y=-3]{Limit}{value : double}{}
    \umlclass[x=+5, y=-3]{ACLineSegment}{}{}
    \umlclass[y=-5]{IdentifiedObject}{name : string\\mrid : IRI}{}
    
    \umlinherit[geometry=|-]{ACLineSegment}{IdentifiedObject}
    \umlinherit[geometry=|-]{Limit}{IdentifiedObject}
    \umlinherit[geometry=-|]{Terminal}{IdentifiedObject}
    
    \umlunicompo[mult=0..2, pos2=0.5]{Terminal}{ACLineSegment}
    \umlunicompo[mult=1]{Terminal}{Limit}
  \end{umlpackage}
\end{tikzpicture}

Renders to:
grafik

add command line arguments

the webservice debug, port and host should be specifiable via the command line

python3 dgs/webserver.py -h
usage: webserver.py [-h] [--debug] [--port PORT] [--host HOST]

Diagrams rendering webservice

optional arguments:
  -h, --help   show this help message and exit
  --debug      run in debug mode
  --port PORT  the port to use
  --host HOST  the host to serve for

Module dgs Not Found

Trying to run
python3 dgs/webserver.py
or
./run
in directory diagrams caused an error:

"File "dgs/webserver.py", line 9, in from dgs.diagrams import Generators, Generator, Example
ModuleNotFoundError: No module named 'dgs'"<

Could be solved by chagngin line 9 in webserver.py from
from dgs.diagrams import Generators, Generator, Example
to
from diagrams import Generators, Generator, Example

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.