Skip to content

features: svg object with links and styles#14

Open
fajan wants to merge 7 commits intosplitbrain:masterfrom
fajan:master
Open

features: svg object with links and styles#14
fajan wants to merge 7 commits intosplitbrain:masterfrom
fajan:master

Conversation

@fajan
Copy link

@fajan fajan commented Jun 25, 2015

  • svg object embed with image fallback for browsers not supporting it
  • pdf generation always uses images
  • in the svg dokuwiki links can be added to nodes/edges/labels which are clickable
    • Note: the [[ ... ]] link indicator is needed to parse links as dokuwiki links.
    • for dokuwiki links the target=_top is appended to links, which is necessary for correct object embeding.
    • without the double-bracers, or using href attributes it falls back to dot (target not appended)
  • config option to enable svg or not (always disabled if path not filled out)
  • styles to include some code into the graph
  • config option to add styles
    • Note: I added it to config to enable users (admins...) to relative easily change it.
    • Maybe putting styles to a "styles" directory in the plugin's directory (like dw2pdf's templates) can be alternative to this.

examples:

<graphviz dot center> 
digraph example_links{ 
    inpage [URL="[[#TOC title]]"]
    crosspage [URL="[[sibling:niece]]"]
    interwiki [URL="[[doku>plugins:graphviz]]"]
    external [URL="[[http://example.com]]"]
    withtext [URL="[[sibling|Tooltip to use]]"]
    inpage -> crosspage [label="url to head", headURL="[[:rootpage|with tooltip]]"]
    interwiki -> external [label="default url is label", URL="[[:rootns:page]]"]
</graphvhiz>

set style plugin config:

$conf['plugin']['graphviz']['styles'] = '<style name="fixed_green_circle">node [width=.9, shape=circle, style=filled, fillcolor=green, fixedsize=true, fontcolor=white]</style>
<style name=dotted_blue_edges>edge [style=dotted,color=blue]</style>';

and then use styles in graphviz tag, to apply styles:

<graphviz dot center  fixed_green_circle dotted_blue_edges> 
digraph example_style{ 
   node1 -> node2;
}
</graphvhiz>

fajan added 7 commits June 24, 2015 15:04
- display svg object with png fallback for xhtml
- display png only for dw2pdf
- use dokuwiki urls inside the graph
Inactive[ URL="[[statuses#inactive KPI]]", ];
- display svg broken image for object embed.
- add hash of the current url to data only when use_svg is enabled:
This ensures that the same image is recreated if the same code is placed
to different pages, or the same page is opened from alternative urls ->
the links in the svg object are always relative to it's place.
- config to set up styles
- _parseStyles to parse styles into array
- update syntax to accept styles in <graphviz> tag
- _injectSytles to prepend styles into the graph body
- use preg to separate tags from graph
- fallback old behavior (first / last line are tags) if preg pattern
fails.
- fixed ways to distinguish dw2pdf and xhtml export (they both use
'xhtml' format)
- auth update: dw2pdf fetches links by calling the url, which causes
unauthorized failure for various auth plugins.
Hence if dw2pdf is the renderer, create graph and put the filesystem
path in src.
@robbertmichel
Copy link

robbertmichel commented Jul 12, 2017

Hi,
Quick question: Did this ever get resolved?

Additionally, @mdaines 's viz.js does this... might it be an idea to piggyback on his solution? That would also solve the URL issues that are requested in 2 of the other pulls.

@fajan
Copy link
Author

fajan commented Jul 12, 2017

Hi,
resolved 2 years ago, but I'm not sure.

vis.js: I don't see it, how could an npm package help in PHP?

BTW: did you tried out the example code? I tested everything under IE8, chrome and FF, and all url types was fine and clickable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants