#!/bin/bash
# ajouter des liens a des noeuds d'un fichier svg issu des commandes dot
# (webdot, Graphviz) et/ou graph>dot (fv-morphologie)
# FV, 2011

svgfile=$1
linksfile=$2

while read nodelink
do
node=`echo $nodelink |awk 'print $1'`
link=`echo $nodelink |awk 'print $2'`
line=`sed -n '/node\">\ '$node'</=' $svgfile `<br># echo $line<br>i=`expr $line + 1`<br>cat $svgfile | sed -e ''$line' a\<br><a xlink:href="'$link'">' -e ''$i' a\<br></a>' > $svgfile-tmp<br>cp $svgfile-tmp $svgfile-tmp-tmp<br>mv $svgfile-tmp $svgfile<br>done < $linksfile<br></code></p> <p>Commande:<br><code><br>./links2svg fichier.svg nodes-links<br></code><br>Le fichier svg est supposé issu des commandes dot ou neato (<a href="http://www.graphviz.org/">webdot- Graphviz</a>) ou graph>dot de <a href="/fv-morphologie">fv-morphologie</a>.</p> <p>Le fichier nodes-links contient pour chaque ligne le nom du noeud et le lien correspondant.</p> <p>Ce script peutéventuellement être optimisé (pour svg ?) en consultant notamment <a href="http://www.graphviz.org/webdot/hnodes.html">webdot/hnodes.html</a>.</p></section> <footer> <p>© Frédéric Voisin 2026</p> </footer> </body> </html>