I am Abhishek from Mumbai, India
GSoC-22 Contributor
Today I want to share with you some interesting work in
texor is a toolkit package that solves multiple challenges that occour in conversion of LaTeX source files to a web friendly RJ-web-article format.
LaTeX is a very descriptive language with a lot of functionality to extend it. Hence converting content from LaTeX is a bit tricky.
Some of these are :
stream_editor <- function(raw_lines, pattern, target, replacement) {
break_points <- which(grepl(pattern, raw_lines))
#check for length of break_points to avoid no matches
if (!identical(break_points, integer(0))) {
for (iterator in seq_along(break_points)) {
modification_line <- raw_lines[break_points[iterator]]
modified_line <- gsub(target, replacement, modification_line)
raw_lines[break_points[iterator]] <- modified_line
}
message(paste(
"Found ", length(break_points), "Matches for target :", target))
} else {
message(paste("Found 0 Matches for target : ", target))
}
return(raw_lines)
}
To manipulate the AST we use pandoc filters.
function Div(el)
if el.classes[1] == 'thebibliography' then
return { }
end
end
function Math (m)
local left = m.mathtype == 'InlineMath' and '\\(' or '$$'
local right = m.mathtype == 'InlineMath' and '\\)' or '$$'
return pandoc.RawInline('markdown', left .. m.text .. right)
end
rebib is a tool kit package specifically for bibliography challenges.
\bibitem[R Core Team]{R}
R Core Team
\newblock R: A Language and Environment for Statistical Computing
\newblock \emph{R Foundation for Statistical Computing}, Vienna, Austria
\penalty0 2016.
\newblock URL : \url{https://www.R-project.org/}, ISBN 3-900051-07-0
@book{R,
author = {{R Core Team}},
title = {{R: A Language and Environment for Statistical Computing}},
publisher = {R Foundation for Statistical Computing Vienna Austria},
year = {2016},
url = {https://www.R-project.org/},
isbn = {3-900051-07-0}
}