Re: [Zim-wiki] Using dynamic templates

2013-09-10 Thread Jaap Karssenberg
I had intended to have the dokuwiki at http://zim-wiki.org/wiki as the
collection point for all user content, however login seems to be broken at
the moment, so need to see if I can bring it up again in the next few
days...

Regards,

Jaap



On Tue, Sep 10, 2013 at 1:19 PM, Orri!  wrote:

> 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.
>
> #!/bin/bash
> #:
> #:
>
> #: Input will be one or two words in small letters
> echo "Name:"
> read name
>
> #: providing different versions of the name
> namedata=${name// /_}
> nameplus=${name// /+}
> namebig=${name~}
> nameuscore=${namebig// /_}
> nameurl=${namebig//_/%20}
>
> 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 =
> [[+Gallery]]
> = 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" >
> "/home/orri/Notebooks/catalog/Models/$nameuscore.txt"
>
> #: 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
>
>
> Cheers!
>
> ___
> Mailing list: https://launchpad.net/~zim-wiki
> Post to : zim-wiki@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~zim-wiki
> More help   : https://help.launchpad.net/ListHelp
>
>
___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


[Zim-wiki] Using dynamic templates

2013-09-10 Thread Orri!
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.

#!/bin/bash
#:
#:

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

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

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 =
[[+Gallery]]
= 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" >
"/home/orri/Notebooks/catalog/Models/$nameuscore.txt"

#: 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


Cheers!


0xB358C3A6.asc
Description: application/pgp-keys
___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp