Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Grab page values from XML on DOI queries. fixes #33

  • Loading branch information...
commit cea61ebe0e059a03cf9d3a0f58d96941dae715dc 1 parent ecf2b1c
@cboettig authored
Showing with 19 additions and 7 deletions.
  1. +3 −1 R/formatref.R
  2. +7 −4 R/print_markdown.R
  3. +9 −2 R/print_rdfa.R
View
4 R/formatref.R
@@ -20,7 +20,9 @@ formatref <- function(a){
volume = xpathSApply(a, "//journal_volume/volume", xmlValue),
doi = xpathSApply(a, "//journal_article/doi_data/doi", xmlValue),
issn = xpathSApply(a, "//issn[@media_type='print']", xmlValue),
-# url = xpathSApply(a, "//journal_article/doi_data/resource", xmlValue)
+# url = xpathSApply(a, "//journal_article/doi_data/resource", xmlValue),
+ pages = paste(xpathSApply(a, "//journal_article/pages/first_page", xmlValue),
+ xpathSApply(a, "//journal_article/pages/last_page", xmlValue), sep="--")
)
)
}
View
11 R/print_markdown.R
@@ -23,10 +23,13 @@ print_markdown <- function(bib, ordering =
paste(' **', r$volume, '**', sep="")
number <- if(!is.null(r$number))
paste(" (", r$number, ") ", sep="")
- spage <- if(!is.null(r$page[1]))
- paste(" ", r$page[1], sep="")
- epage <- if(!is.null(r$page[2]))
- paste('-', r$page[2], sep="")
+
+ pgs <- if(!is.null(r$pages))
+ strsplit(r$pages, "--")[[1]]
+ spage <- if(!is.null(pgs[1]))
+ paste(" ", pgs[1], sep="")
+ epage <- if(!is.null(pgs[2]))
+ paste('-', pgs[2], sep="")
pages <- paste(spage, epage, sep="")
doi <- if(!is.null(r$doi))
paste(' [', r$doi, '](http://dx.doi.org/', r$doi, ')', sep="")
View
11 R/print_rdfa.R
@@ -43,8 +43,15 @@ print_rdfa <- function(bib, ordering =
volume <- check(' <span property="bibo:volume">', r$volume)
number <- check(' (<span property=bibo:issue">', r$number)
- spage <- check(' <span property=bibo:startPage">', r$page[1])
- epage <- check('-<span property=bibo:endPage">', r$page[2])
+ pgs <- if(!is.null(r$pages))
+ strsplit(r$pages, "--")[[1]]
+ spage <- if(!is.null(pgs[1]))
+ paste(" ", pgs[1], sep="")
+ epage <- if(!is.null(pgs[2]))
+ paste('-', pgs[2], sep="")
+
+ spage <- check(' <span property=bibo:startPage">', spage)
+ epage <- check('-<span property=bibo:endPage">', epage)
pages <- paste(spage, epage, sep="")
doi <-
if(!is.null(r$doi))
Please sign in to comment.
Something went wrong with that request. Please try again.