Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
agricolamz committed Nov 10, 2024
1 parent 5dee280 commit 04d6aed
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: lingglosses
Type: Package
Title: Interlinear Glossed Linguistic Examples and Abbreviation Lists Generation
Version: 0.0.8
Version: 0.0.9
Depends: R (>= 3.5.0)
Authors@R: person("George", "Moroz",
role = c("aut", "cre"),
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ export(convert_to_df)
export(get_examples_db)
export(gloss_example)
export(make_gloss_list)
importFrom(gt,as_word)
importFrom(gt,fmt_markdown)
importFrom(gt,gt)
importFrom(gt,md)
importFrom(gt,opt_table_lines)
importFrom(gt,tab_footnote)
importFrom(gt,tab_options)
Expand All @@ -18,6 +20,7 @@ importFrom(knitr,is_html_output)
importFrom(knitr,is_latex_output)
importFrom(knitr,knit_hooks)
importFrom(knitr,opts_current)
importFrom(knitr,opts_knit)
importFrom(methods,hasArg)
importFrom(methods,missingArg)
importFrom(rmarkdown,metadata)
Expand Down
6 changes: 4 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# lingglosses 0.0.9

- move from `kableExtra` to `gt` package

# lingglosses 0.0.8

- add 2PL gloss
Expand All @@ -6,12 +10,10 @@

- fix by @yihui


# lingglosses 0.0.6

- small fix for CRAN


# lingglosses 0.0.5

- add possibility to have a sole transliteration line; thx to @sverhees #19
Expand Down
15 changes: 12 additions & 3 deletions R/gloss_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@
#'
#' @importFrom knitr is_latex_output
#' @importFrom knitr is_html_output
#' @importFrom knitr opts_knit
#' @importFrom gt gt
#' @importFrom gt tab_footnote
#' @importFrom gt tab_options
#' @importFrom gt fmt_markdown
#' @importFrom gt md
#' @importFrom gt as_word
#' @importFrom gt opt_table_lines
#' @importFrom methods missingArg
#' @importFrom methods hasArg
Expand Down Expand Up @@ -278,15 +281,15 @@ gloss_example <- function(transliteration,
if(nchar(free_translation) > 0){
result <- gt::tab_footnote(data = result,
footnote = paste0("'",
free_translation,
gt::md(free_translation),
"'"))
}


# add comment --------------------------------------------------------------
if(nchar(comment) > 0){
result <- gt::tab_footnote(data = result,
footnote = comment)
footnote = gt::md(comment))
}

# add audio ---------------------------------------------------------------
Expand Down Expand Up @@ -317,7 +320,13 @@ gloss_example <- function(transliteration,

# return output ------------------------------------------------------------
if(length(unique(splits_by_line)) > 1){
for(i in multiline_result) {print(i)}
if (isTRUE(knitr::opts_knit$get('rmarkdown.pandoc.to') == "docx")) {
for(i in multiline_result) {
cat("```{=openxml}", gt::as_word(i), "```\n\n", sep = "\n")
}
} else {
for(i in multiline_result) {print(i)}
}
} else{
return(result)
}
Expand Down
29 changes: 23 additions & 6 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"codeRepository": "https://CRAN.R-project.org/package=phonfieldwork",
"issueTracker": "https://github.com/agricolamz/lingglosses/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.0.4",
"version": "0.0.9",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.2.0 (2022-04-22)",
"runtimePlatform": "R version 4.3.3 (2024-02-29)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -63,15 +63,15 @@
},
"2": {
"@type": "SoftwareApplication",
"identifier": "kableExtra",
"name": "kableExtra",
"identifier": "gt",
"name": "gt",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=kableExtra"
"sameAs": "https://CRAN.R-project.org/package=gt"
},
"3": {
"@type": "SoftwareApplication",
Expand Down Expand Up @@ -102,9 +102,26 @@
"identifier": "utils",
"name": "utils"
},
"6": {
"@type": "SoftwareApplication",
"identifier": "htmltools",
"name": "htmltools",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=htmltools"
},
"7": {
"@type": "SoftwareApplication",
"identifier": "methods",
"name": "methods"
},
"SystemRequirements": null
},
"fileSize": "53.058KB",
"fileSize": "59.745KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
2 changes: 1 addition & 1 deletion docs/index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ gloss_example("Learn to value yourself, which means: to fight for your happiness
Sometimes examples are too long and do not fit onto the page. In that case you need to add the argument `results='asis'` to your chunk. `gloss_example()` will then automatically split your example into multiple rows.

(@tsa_ex) Mishlesh Tsakhur, East Caucasian [@maisak07: 386]
```{r}
```{r, results='asis'}
gloss_example('za-s jaːluʁ **wo-b** **qa-b-ɨ**; turs-ubɨ qal-es-di ǯiqj-eː jaːluʁ-**o-b** **qa-b-ɨ**',
'1SG.OBL-DAT shawl.3 AUX-3 PRF-3-bring.PFV woolen_sock-PL NPL.bring-PL-A.OBL place-IN shawl.3-AUX-3 PRF-3-bring.PFV',
'(they) **brought** me a shawl; instead of (lit. in place of bringing) woolen socks, (they) **brought** a shawl.',
Expand Down

0 comments on commit 04d6aed

Please sign in to comment.