[rkward-devel] a new approach to external plugins

meik michalke meik.michalke at uni-duesseldorf.de
Thu Aug 11 23:12:26 UTC 2011


hi,

am Donnerstag 11 August 2011 (18:22) schrieb meik michalke:
> well, i'll try to write at least the paste() based function in the
> meantime  ;-)

done. i uploaded a new file to rkward/rbackend/rpackages/rkward/R, called
"rk.write.about.R".

it contains four functions
 - rk.write.about() # the actual main function
 - pasteXMLTag()    # called by rk.write.about()
 - pasteXMLAttr()   # called by pasteXMLTag() 
 - indent()         # called by pasteXMLTag() and pasteXMLAttr()
and some sample data. i hope the comments explain enough.

basically it comes down to create a list with the information to be pasted, 
and supply that to the main function:

about.plugins <- list(
  name="Square the circle",
  desc="Squares the circle using Heisenberg compensation.",
  version="0.1-3",
  date=Sys.Date(),
  url="http://eternalwondermaths.example.org/23/stc.html",
  license="GPL",
  category="Geometry",
  authors=list(
    c(name="E.A. Dölle", email="doelle at eternalwondermaths.example.org", 
       url="http://eternalwondermaths.example.org"),
    c(name="A. Assistant", email="alterego at eternalwondermaths.example.org", 
       url="http://eternalwondermaths.example.org/staff/")
  ),
  rkward.min="0.5.3",
  rkward.max="",
  R.min="2.10",
  R.max="",
  depends=list(
    c(package="heisenberg", min="0.11-2", max="",
       repository="http://rforge.r-project.org"),
    c(package="DreamsOfPi", min="0.2", max="", repository=""),
    c(pluginmap="", url="")
  )
)

# now this call:
cat(rk.write.about(about.plugins))

# will produce:
<about 
	name="Square the circle"
	shortinfo="Squares the circle using Heisenberg compensation."
	version="0.1-3"
	releasedate="2011-08-11"
	url="http://eternalwondermaths.example.org/23/stc.html"
	license="GPL"
	category="Geometry">
	<author 
		name="E.A. Dölle"
		email="doelle at eternalwondermaths.example.org"
		url="http://eternalwondermaths.example.org"
	/>
	<author 
		name="A. Assistant"
		email="alterego at eternalwondermaths.example.org"
		url="http://eternalwondermaths.example.org/staff/"
	/>
	<dependencies 
		rkward_min_version="0.5.3"
		R_min_verion="2.10">
		<package 
			name="heisenberg"
			min_version="0.11-2"
			repository="http://rforge.r-project.org"
		/>
		<package 
			name="DreamsOfPi"
			min_version="0.2"
		/>
	</dependencies>
</about>

i tried to make the XML paste function rather generic, although this is just a 
first round... but with some tweaking we could later re-use it, e.g., to write 
helpful functions like

 rk.create.tabbook(tabs=2, labels=c("Data", "Options"))
 ...

should this go into another package (rkwardplugdev?) or something already 
present?


viele grüße :: m.eik

-- 
dipl. psych. meik michalke
institut f"ur experimentelle psychologie
abt. f"ur diagnostik und differentielle psychologie
heinrich-heine-universit"at d-40204 d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20110812/13af42fd/attachment.sig>


More information about the Rkward-devel mailing list