[Roxygen-commits] r248 - pkg/sandbox
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jul 20 09:56:23 CEST 2010
Author: pcd
Date: 2010-07-20 09:56:22 +0200 (Tue, 20 Jul 2010)
New Revision: 248
Added:
pkg/sandbox/bibtex-roclet-test.R
pkg/sandbox/hello.R
Modified:
pkg/sandbox/bibtex-roclet.R
Log:
latest bibtex roclet
Added: pkg/sandbox/bibtex-roclet-test.R
===================================================================
--- pkg/sandbox/bibtex-roclet-test.R (rev 0)
+++ pkg/sandbox/bibtex-roclet-test.R 2010-07-20 07:56:22 UTC (rev 248)
@@ -0,0 +1,6 @@
+#' A solution to the halting problem
+#' @references
+#' @bibliography REFERENCES.bib
+#' @cite frankfurt:2010
+#' @cite non-existent-key
+NA
Modified: pkg/sandbox/bibtex-roclet.R
===================================================================
--- pkg/sandbox/bibtex-roclet.R 2010-07-16 20:43:52 UTC (rev 247)
+++ pkg/sandbox/bibtex-roclet.R 2010-07-20 07:56:22 UTC (rev 248)
@@ -1,14 +1,4 @@
-source('../R/roxygen.R')
-source('../R/functional.R')
-source('../R/list.R')
-source('../R/memoize.R')
-source('../R/parse.R')
-source('../R/string.R')
-source('../R/roclet.R')
-source('../R/namespace.R')
-source('../R/collate.R')
-source('../R/Rd.R')
-source('../R/callgraph.R')
+library(roxygen)
library(bibtex)
debug <- function(..., print=str)
@@ -21,16 +11,13 @@
make.bibtex.roclet <- function() {
roclet <- make.roclet()
roclet$bibliography <- 'REFERENCES.bib'
- roclet$citationList <- NULL
- ## candidate for pre.files
parse.bibliography <- function(key, expression)
roclet$bibliography <- expression
parse.cite <- function(key, expression) {
- if (is.nil(roclet$citationList))
- roclet$citationList <- read.bib(file=roclet$bibliography)
- for (citation in roclet$citationList) {
+ citationList <- read.bib(file=roclet$bibliography)
+ for (citation in citationList) {
if (attributes(citation)$key == expression) {
cat(sprintf("%s. %s. %s. %s.\n",
citation$editor,
@@ -45,6 +32,7 @@
immediate.=TRUE)
}
+ roclet$register.parser('bibliography', parse.bibliography)
roclet$register.parser('cite', parse.cite)
roclet
}
Added: pkg/sandbox/hello.R
===================================================================
--- pkg/sandbox/hello.R (rev 0)
+++ pkg/sandbox/hello.R 2010-07-20 07:56:22 UTC (rev 248)
@@ -0,0 +1,18 @@
+library(roxygen)
+
+register.preref.parsers(parse.name, 'hello')
+
+make.hello.roclet <- function() {
+ roclet <- make.roclet()
+
+ parse.hello <- function(key, expression)
+ cat(sprintf("Hi, %s!\n", expression))
+
+ roclet$register.parser('hello', parse.hello)
+
+ roclet
+}
+
+roclet <- make.hello.roclet()
+roclet$parse.parsed(parse.text("#' @hello world",
+ "NA"))
More information about the Roxygen-commits
mailing list