[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: Is there a way to set variable via script?
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2011-12-18 17:17:50
Message-ID: 201112181817.50915.dhdev () gmx ! de
[Download RAW message or body]

On Sunday, 18. December 2011, Gasper Zejn wrote:
> Dne Sunday 18 December 2011 ob 11:12:22 je Dominik Haumann napisal(a):
> > 
> > Currently, not. Can you give us a use case? We could add it for KDE 4.8:
> > document.setVariable(key, value)
> > 
> > This could then set the key/value internally in the document (but not
> > as modeline in the kate: ...; part).
> > 
> > Greetings,
> > Dominik
> 
> Attached is a git patch, that should do exactly that.
> 
> I reused KateDocument::readVariableLine for setting the variables, and if
> I understand correctly, this only sets the variables internally and not
> in the modeline.

I'm ok with this commit.

But there are documentation changes, T.C., is it still ok to change
documentation?

> diff --git a/doc/kate/advanced.docbook b/doc/kate/advanced.docbook
> @@ -2347,6 +2347,16 @@ String document.variable(<parameter>String \
> <replaceable>key</replaceable></param + <term><synopsis>
> + String document.setVariable(<parameter>String \
> <replaceable>key</replaceable></parameter>, <parameter>String \
> ><replaceable>value</replaceable></parameter>); + </synopsis></term>
> + <listitem><para>
> +     Set the value of the requested document variable \
> <replaceable>key</replaceable>. +     Returns the value of set variable.

It would be nice to have a link to the available modelines, i.e. to \
configuring.docbook:  <sect1 id="config-variables">
  <title>Configuring With Document Variables</title>

If you have further issues, would be cool if you send more patches ;)
For instance, it would be good to be able to launch processes, like
  var content = system.execute("ls");
or
  system.execute("svn diff | kompare -o -");
and so on... ;)

Greetings,
Dominik
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic