Since using Zim I need the same site structures over and over so I used
templates. What bothered me was that they are not dynamic. You can't
say: make a gallery with pictures of this folder, name the site foo,
make a subsite named bar, ...

So I wrote a script which includes a template, makes folders/subfolders
and asks for the name of the new page.

My questions are:
1) can/should user made scripts be collected?
(I think it's worth it)
2) What scripts like this make your life easier?

Here is mine, I put it in use as a button on the toolbar and start it
with xterm scriptname.


#: Input will be one or two words in small letters
echo "Name:"
read name

#: providing different versions of the name
namedata=${name// /_}
nameplus=${name// /+}
nameuscore=${namebig// /_}

echo "namebig" $namebig

echo "Getting Data."
echo "Please stand by ..."

#: getting some data with a scraper
# ... formatting the data, calculating some stuff

#: Putting it together -> this is the part where the template is filled
with our data
echo "
====== ${name~} ======
#: Some data we have found in places
===== Images =====
===== Links =====
#: Some links we build from the data and the name (like search engine
URLs filled with ${name~} and stuff)
===== Tags =====
[[02 Tags|Tags:]] @$namedata" >

#: Making the needed directories
mkdir /home/orri/Notebooks/catalog/Models/$nameuscore
mkdir /home/orri/Notebooks/catalog/Models/$nameuscore/CAD/
mkdir /home/orri/Notebooks/catalog/Models/$nameuscore/Gallery/

#: putting the page in the index
echo '[[+'$namebig']]' >> '/home/alice/Notebooks/catalog/Models.txt'

exit 0

Further ideas
* Sort the index automagically after inserting a new model
* adding pics from a folder to the gallery subfolder and gallery page in
a fixed max-size
* script makes more tags by itself
* write a build-a-gallery-in-zim script


Attachment: 0xB358C3A6.asc
Description: application/pgp-keys

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to