Title: | Easy Linguistics Document Writing with R Markdown |
Version: | 1.2.0 |
Description: | Provides 'Shiny gadgets' to search, type, and insert IPA symbols into documents or scripts, requiring only knowledge about phonetics or 'X-SAMPA'. Also provides functions to facilitate the rendering of IPA symbols in 'LaTeX' and PDF format, making IPA symbols properly rendered in all output formats. A minimal R Markdown template for authoring Linguistics related documents is also bundled with the package. Some helper functions to facilitate authoring with R Markdown is also provided. |
URL: | https://liao961120.github.io/linguisticsdown/, https://github.com/liao961120/linguisticsdown |
BugReports: | https://github.com/liao961120/linguisticsdown/issues |
Depends: | R (≥ 3.4.0) |
License: | MIT + file LICENCE |
Encoding: | UTF-8 |
LazyData: | true |
Imports: | stringr, shiny, magrittr, miniUI, knitr, rstudioapi, DT |
RoxygenNote: | 6.1.1 |
Suggests: | pkgdown, rmarkdown, testthat, tidyr |
NeedsCompilation: | no |
Packaged: | 2019-03-01 03:01:07 UTC; liao |
Author: | Yongfu Liao |
Maintainer: | Yongfu Liao <liao961120@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2019-03-01 05:30:04 UTC |
Clean the description of ipafeatures
Description
Clean the description of ipafeatures
Usage
clean_dscrb(x)
Conditional Compilation
Description
cond_cmpl
wraps a sequence of IPA string
with LaTeX code in R Markdown document when compiled
to LaTeX. When compiled to HTML, returns the
original sequence.
Usage
cond_cmpl(ipa)
Arguments
ipa |
String. A sequence of IPA symbols. |
Wrapper of knitr::include_graphics
to Deal with URLs and Invalid File Types
Description
Deals with URL paths and invalid file types passed to path
of include_graphics
. When the output format
of the R Markdown is PDF
, and an URL is passed to
path
, the figure is automatically downloaded from the URL
and included using the local relative path.
If a figure has an invalid file extension for PDF output
(e.g. .gif
, .svg
), the function passed to
handler
is used to override the default behavior:
inserting figures with knitr::include_graphics
.
Usage
include_graphics2(path, alt_path = NULL, handler = function(path)
knitr::asis_output(paste("View", tools::file_ext(path), "at", path)),
...)
Arguments
path |
String. Path to a figure to be included. Can be either an URL or a local path. |
alt_path |
String. An alternative figure path for |
handler |
Function. A function with a single argument |
... |
Other arguments to pass to
|
Details
Read more about using the function at http://bit.ly/include_graphics2.
Examples
png_url <- 'https://commonmark.org/images/markdown-mark.png'
gif_url <- 'https://media.giphy.com/media/k3dcUPvxuNpK/giphy.gif'
## Not run:
include_graphics2(gif_url, alt_path = png_url)
## End(Not run)
Wrapper of knitr::include_graphics
for PDF Output
Description
Deals with URL and GIFs. If an url is passed to
path
of include_graphics
,
the figure is automatically downloaded and included
using local relative path. If a figure with .gif
extension is included, a piece of text, rather than the
figure, is inserted.
Usage
include_graphics_latex(path, alt_path = NULL, handler = function(path)
knitr::asis_output(paste("View", tools::file_ext(path), "at", path)),
...)
Lookup IPA symbols with phonetic features or X-SAMPA
Description
Lookup IPA symbols with phonetic features or X-SAMPA
Usage
searchIPA(x = NULL, search = c("feature", "xsampa"))
Arguments
x |
Character. A (partial) term of the features of
an IPA symbol or the (partial) X-SAMPA symbol
corresponding to an IPA symbol. Defaults to |
search |
Character. Search mode, either |
Value
A data frame with 3 rows.
Examples
# Check all IPA symbols
searchIPA()
# Search with feature
searchIPA("bilabial", "feature")
# Search with X-SAMPA
searchIPA("_h", "xsampa")
Insert IPA symbols with Shiny app
Description
writeIPA
opens a shiny gadget in the viewer pane
of RStudio to let users insert a sequence of IPA
symbols into the source pane or console.
Users can choose to use phonetic features (such as
aspirated, schwa,
vl for voiceless, vd for voiced, etc.) to
find IPA symbols or use the
X-SAMPA
input method directly. Note that due to the special
meanings of backslash(\
) in programming,
backslashes(\
) in X-SAMPA symbols are
replaced with slashes(/
).
Usage
writeIPA()
Value
Inserted plain text at the cursor returned by
insertText
.
Source
https://github.com/dmort27/epitran/blob/master/epitran/data/ipa-xsampa.csv
Convert a string of X-SAMPAs to a string of IPAs
Description
Convert a string of X-SAMPAs to a string of IPAs
Usage
xsampa2ipa(string)