From Media Design: Networked & Lens-Based wiki
Jump to navigation Jump to search

MIPSUM, an Inkscape "lorem ipsum" plugin for learning while practicing

Mipsum-before.png Mipsum-after.png


A plugin that generates place-holder text randomly taken from the FLOSS Manual for Inkscape.


1. Install the plugin putting the files contained in the following .zip in your Inkscape extension folder ($HOME/.config/inkscape/extensions/ or /usr/share/inkscape/extensions):

2. Create a textbox (or more) and write the word "mipsum" followed (without any space) by the number of characters you want to generate.

3. In your Inkscape, go to Extensions>Python>Mipsum. It will generate text taken from the manual for Inkscape.

4. Learn new tricks and techniques.


helloworld.inx describes your extensions to Inkscape.

<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="">
        <dependency type="executable" location="extensions"></dependency>
            <submenu _name="Python"/>
        <command reldir="extensions" interpreter="python"></command>
</inkscape-extension> is the actual extension.

import os
import random
import sys, codecs
from lxml import etree

f =[-1], encoding="utf-8")

# open the file and parse into an etree file
t = etree.parse(f)

# modify the tree

NS = {"svg": ""}

# get the inkscape manual from
lynxcmd = "lynx -dump -nolist | tr '\n' ' ' | sed 's/  */\ /g'"
data = os.popen(lynxcmd).read()

for flowPara in t.xpath("//svg:flowPara", namespaces=NS):
    if flowPara.text[0:6] == "mipsum" :
        # get the number of charachters to generate    
        charnum = int(flowPara.text[6:])
        # takes a random part of the text inside the manual
        charnumend = random.randint(0,239605)
        charnumbegin = charnumend - charnum
        flowPara.text = data[charnumbegin:charnumend]

# output tree
sys.stdout.write(etree.tostring(t, encoding="utf-8", xml_declaration=True))