Topic on Project:Support desk

[RESOLVED] Visualizing a file generated with dumpLinks.php

6
195.234.74.168 (talkcontribs)

It's probably a very lame question as I can't even google a one, but could you please suggest any visualization tool to visualize a plain links file generated with dumpLinks.php? Linux or Windows, CLI or GUI -- does not really matter (however, Linux and probably CLI are much preferrable). Thank you in advance!

Ciencia Al Poder (talkcontribs)

Documentation of Manual:dumpLinks.php says it's a plain text editor, so you can use any plain text editor or just output its contents directly to the console output.

195.234.74.168 (talkcontribs)

I'm afraid I was not too specific while asking the question. I just would like to know is there probably a tool that could visualize it as a graph, not just plain text.

195.234.74.168 (talkcontribs)

I seem to have solved the problem. Not sure how fine it is, but I figured out it may be worked around using DOT+GraphViz and ImageMagick. Say, something like:

php dumpLinks.php | ../../plain-to-dot.sh | dot -Tps | convert ps:- png:- > wiki.png

where plain-to-dot.sh is as follows:

#!/bin/bash

echo 'digraph wiki {'

while read ROW; do

HEAD=$(echo "$ROW" | cut -d ' ' -f 1)

TAIL=$(echo "$ROW" | cut -d ' ' -f 2-)

# `cut` seems to return TAIL as HEAD if only one field is supplied

if [ "$HEAD" != "$TAIL" ]; then

for FIELD in $(echo -n "$TAIL" | tr " " "\n"); do

echo -e "\t\"$HEAD\" -> \"$FIELD\";";

done

fi

done < "${1:-/dev/stdin}"

echo '}'
195.234.74.168 (talkcontribs)

4-spaces not working? Oops...

Ciencia Al Poder (talkcontribs)

wrap it inside <pre> tags ;)

thanks for sharing!