Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7871e98
commit c79cce1
Showing
52 changed files
with
2,578 additions
and
891 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,86 @@ | ||
2e97763375879f700020e846acb0b8e0 *DESCRIPTION | ||
476df302221cf6d686e238b07ddf3540 *NAMESPACE | ||
d8b4c39d3297287c6e04dd5133796e79 *DESCRIPTION | ||
573abac574bbc7e48288060ed8f8a1ea *NAMESPACE | ||
9f3ebbd3aa7dff31aa4d2b7004e607bc *R/add_html_tags.R | ||
cedb2de056ee5ff6d317f3d6aefb381a *R/apply_graph_theme.R | ||
ab7f58b0dc6ca7aebb7a09a5b3bdb86d *R/base30toNumeric.R | ||
fab85987fc7eb61ca8a0b0572108776c *R/cat0.R | ||
20620e0c652f1db74cebd4075b759ddb *R/clean_source.R | ||
c75ce5614cd0f86aecea908deacf967e *R/clean_sources.R | ||
113cabdb761247730a1b4a31d0d5f6af *R/code_source.R | ||
a815112916ed178e6019c49df2dec2b3 *R/clean_source.R | ||
0839bbc4f59d04bbfa70678d96a31a13 *R/clean_sources.R | ||
b70333955715384a3f5403a75d6dd736 *R/code_source.R | ||
4e964e844d43db88d1736278063b20dc *R/code_sources.R | ||
87cb9480e993ffbec8a97ef6cb3e239a *R/collapse_occurrences.R | ||
ecfdeae7b849ae7ecfb9e3c5114f675d *R/collect_coded_fragments.R | ||
686bd2bf88c1da9fab486225c9e8107b *R/collect_coded_fragments.R | ||
aa8f7921457282154454c83cde49bc95 *R/create_cooccurrence_matrix.R | ||
92bf98f887d74e35619865bb7a143052 *R/css.R | ||
f35286cf88ec31a7f74464292946214c *R/escapeRegexCharacterClass.R | ||
05905233467b24a053e5d30cdbaa5769 *R/generate_uids.R | ||
83d62f5b08dd85bd0d86bee960d953be *R/export_to_html.R | ||
2dcec6dae516827af2ce69df8665601e *R/export_to_markdown.R | ||
7c85833434de206f2ecd1872a135d528 *R/extract_codings_by_coderId.R | ||
23b9ed5e9580f13c1ae9405ce95758c1 *R/generate_uids.R | ||
0133398a9b8bfe52773f625667a92c42 *R/get_deductive_code_values.R | ||
5bd503f3b1f50ef8ff13357068500bdc *R/get_leaf_code.R | ||
f03360f58ff02b8238f9c2e7ae6282c7 *R/get_leaf_codes.R | ||
f28ca9058b519b18e69b102c27b88d07 *R/inductiveCodes_to_tree.R | ||
fb71ec1e464ccb8563d9fa6287451c25 *R/load_source.R | ||
8451ef7b1194a330381fe7b9a00a5361 *R/load_sources.R | ||
75e3a709d687d472cbc28066666b6519 *R/load_sources.R | ||
4d6ef3d3cfb3f40dd2d1a5c8bdc8c437 *R/merge_sources.R | ||
fd5f20882538f69adec138fec7f3190c *R/numericToBase30.R | ||
2b97f6b3146382f529b8778eaa8b051d *R/parse_source.R | ||
c162b1f7dda4253847ffdbc7866401cd *R/parse_sources.R | ||
0111b15805ceb8fdf983e740798af66d *R/parsed_sources_to_ena_network.R | ||
fdb4034a8b35d37e0ccb1401cfe0cce2 *R/prepend_ids_to_source.R | ||
a65ffab15af20de2bc324f6472b02bb5 *R/prepend_ids_to_sources.R | ||
94fb426d0f1364378e0d578791a1d72e *R/opts.R | ||
03fb96666f5a35ef04ab964419329ec8 *R/parse_source.R | ||
507c1fc7ef2cbffe5c695cf7b651f8f2 *R/parse_source_by_coderId.R | ||
7b874a05d1b9e067cc22de614d8dc1bb *R/parse_sources.R | ||
f709266286a346c90f62f2bc53bb9e10 *R/parse_sources_by_coderId.R | ||
bd550d3fe0eb5ebe33d6494761a3a81d *R/parsed_sources_to_ena_network.R | ||
abe3bc7b576457ef2d5d11da20fff2f9 *R/prepend_ids_to_source.R | ||
e03ab7d5a2ac0a95ebd41ab54d643b82 *R/prepend_ids_to_sources.R | ||
f5cfefe0e2eaf3dfb2a343f1e0f744b4 *R/repeatStr.R | ||
94faec1a4c4dafa6b7655cc9228db68d *R/rock.R | ||
c4fb74f411088bea5a9b0acbdff9b9e6 *R/search_and_replace_in_source.R | ||
1b18c2e5e70482d91a461fbf00ec23c9 *R/search_and_replace_in_sources.R | ||
bbe8ff2dd2faee0aa25a7276a1f19c70 *R/split_source.R | ||
6c5541d350d6888fd2d75b2d664505f0 *R/split_sources.R | ||
2413957e3eb857d215b84584ccc3e427 *R/vecTxt.R | ||
2e20ef14b848c6e0fc09ba8411e92ff9 *README.md | ||
3dbb667fbd22be4bc28803dd5cc64a49 *build/vignette.rds | ||
57cc6609f9ac99623d6b895ac3075c7f *inst/doc/introduction_to_rock.R | ||
8f372aba7366e7a3b3de2e6df6384c7e *inst/doc/introduction_to_rock.Rmd | ||
d04a7b3581e99d2621208dac5cdc29aa *inst/doc/introduction_to_rock.html | ||
efea8c84b873697894ecfd69d846199b *README.md | ||
6e2cb7590a15d12b028c294fbd6b4aad *build/vignette.rds | ||
29916f37ac22750dc162ba6a0faa802e *inst/css/basic.css | ||
92af3981f10606ab3532f7ab30c68c52 *inst/css/bootstrap.min.css | ||
53b8bbc8c6d1ce5025deaee251233f16 *inst/css/default.css | ||
ea8eab93de05207476b4c5f91642b478 *inst/doc/introduction_to_rock.R | ||
955755b5e75df7716af8349ca2180ef6 *inst/doc/introduction_to_rock.Rmd | ||
7b38f7d5822d8ed062b45900b2bdbcbb *inst/doc/introduction_to_rock.pdf | ||
a5ec8992415d2b6b12f259ce74ebbb37 *inst/extdata/attitude.dct | ||
00887529d7c01e7e33624a34f5eade29 *inst/extdata/behavior.dct | ||
613546db269eeaed2186b953ffdecf5b *inst/extdata/example-1.rock | ||
cd53bc3624262bbddc47564e40f71f4f *inst/extdata/example-1.rock | ||
8efe47da800c8bd00b5eefafc7fcf941 *inst/extdata/intention.dct | ||
021207db2a0a364be0de9f43f2f28c30 *inst/extdata/longer-test.rock | ||
6a0035c3b7777817aa20428f769fa0da *inst/extdata/lorum-ipsum.rock | ||
6a0035c3b7777817aa20428f769fa0da *inst/extdata/lorum-ipsum2.rock | ||
d5ab574927a009403636c739e927fd30 *inst/extdata/perceived_behavioral_control.dct | ||
9fdcac650f437af27be9ae700d00c0a2 *inst/extdata/perceived_norm.dct | ||
acb2f299ac45154f38f2ba58dd1b9dff *inst/extdata/second-test-file.rock | ||
87a7b8fa56e0f126211616cf74cf4442 *man/add_html_tags.Rd | ||
32601596d81f5490c86341dcad8a03e9 *man/apply_graph_theme.Rd | ||
5093fea4f6d48c4e46049ac0e892db4c *man/base30conversion.Rd | ||
6c1409dfc19e705084da1bf2671c2ae7 *man/cat0.Rd | ||
113870ba992839998aed42199623dd4d *man/cleaning_sources.Rd | ||
1169a35b9e9bb1f92b43845ffad1b6d9 *man/coding_sources.Rd | ||
bfa928fdf7039b9e257b63cdbd1afea5 *man/cleaning_sources.Rd | ||
6a9c1939ab36ceb7007b7c6693b5dd1a *man/coding_sources.Rd | ||
705d46482d8af849904c17caa063987b *man/collapse_occurrences.Rd | ||
e103f559b9c2791d6aea82511db1de83 *man/collect_coded_fragments.Rd | ||
f6cbd5d0973a4f6a3bc0eb0d7f189624 *man/collect_coded_fragments.Rd | ||
66a23c06357d700186d7e8b95e18872b *man/create_cooccurrence_matrix.Rd | ||
b74634ce0d53c76fc3742803658e31d2 *man/generate_uids.Rd | ||
5826c07933204b563cbe93ada20dddd7 *man/loading_sources.Rd | ||
828957a3cda246780931c0cef7da26fd *man/parsed_sources_to_ena_network.Rd | ||
f3a4f4c0ee7293fcf1067f88e55ac5ad *man/parsing_sources.Rd | ||
c58076e9a49359a7d8091d79aad303ce *man/prepending_uids.Rd | ||
8c660ede330cc079b3c3d3f9281ee5e5 *man/css.Rd | ||
2e96c83c60f4de1b4f889b68c63b33af *man/exporting_sources.Rd | ||
b68bd85569f660bccd9ecff594652125 *man/extract_codings_by_coderId.Rd | ||
fba6cb997f29e907efd3c875ccdc2822 *man/generate_uids.Rd | ||
6afd259ab272f13f7015bbb8d1ef068f *man/loading_sources.Rd | ||
f4b5650505bec9e5a19adc7bf5f91b10 *man/merge_sources.Rd | ||
4c53acec9f5e919c5754266dd4c7efdf *man/opts.Rd | ||
e74a298caec3321cba5d9b6dd371b9a2 *man/parsed_sources_to_ena_network.Rd | ||
020cfd2c13d11d3793216598c5d92345 *man/parsing_sources.Rd | ||
8c68b930153c53fa032b97a8bd3daa2e *man/parsing_sources_by_coderId.Rd | ||
5ab2cc1605dfb09f7a1195402d299262 *man/prepending_uids.Rd | ||
37ba44215f231ecaef2ad709d8023c53 *man/repeatStr.Rd | ||
d004a98cf3178fe2bbbeac2d1599dafc *man/rock.Rd | ||
9e6cfbd45ddd64c79c0c57d576c7becc *man/vecTxt.Rd | ||
8c2faf36336dc75bd73bf31f0cd8d85a *tests/testthat.R | ||
44c66660f9d3403d0d41d5fcb4bae3c4 *tests/testthat/test-rock-general.R | ||
8f372aba7366e7a3b3de2e6df6384c7e *vignettes/introduction_to_rock.Rmd | ||
09252e3983b0d4f201aa54ff08fee7f3 *tests/testthat/test-rock-general.R | ||
955755b5e75df7716af8349ca2180ef6 *vignettes/introduction_to_rock.Rmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#' Add HTML tags to a source | ||
#' | ||
#' This function adds HTML tags to a source to allow pretty printing/viewing. | ||
#' | ||
#' @inheritParams parsing_sources | ||
#' @param x A character vector with the source | ||
#' @param codeClass,idClass,sectionClass,uidClass,utteranceClass The classes | ||
#' to use for, respectively, codes, identifiers (such as case identifiers or | ||
#' coder identifiers), section breaks, utterance identifiers, and full | ||
#' utterances. All `<span>` elements except for the full utterances, which | ||
#' are placed in `<div>` elements. | ||
#' | ||
#' @return The character vector with the replacements made. | ||
#' @export | ||
#' | ||
#' @examples add_html_tags("[[cid=participant1]] | ||
#' This is something this participant may have said. | ||
#' Just like this. [[thisIsACode]] | ||
#' ---paragraph-break--- | ||
#' And another utterance."); | ||
add_html_tags <- function(x, | ||
codeClass = rock::opts$get(codeClass), | ||
idClass = rock::opts$get(idClass), | ||
sectionClass = rock::opts$get(sectionClass), | ||
uidClass = rock::opts$get(uidClass), | ||
utteranceClass = rock::opts$get(utteranceClass)) { | ||
|
||
codeRegexes <- rock::opts$get(codeRegexes); | ||
idRegexes <- rock::opts$get(idRegexes); | ||
sectionRegexes <- rock::opts$get(sectionRegexes); | ||
uidRegex <- rock::opts$get(uidRegex); | ||
inductiveCodingHierarchyMarker <- rock::opts$get(inductiveCodingHierarchyMarker); | ||
|
||
res <- x; | ||
|
||
### First replace smaller than and bigger than symbols | ||
### with the corresponding entities | ||
res <- gsub("<", "<", res, fixed=TRUE); | ||
res <- gsub(">", ">", res, fixed=TRUE); | ||
|
||
### Also replace <> symbols in all codeRegexes | ||
codeRegexes <- gsub("<", "<", codeRegexes, fixed=TRUE); | ||
codeRegexes <- gsub(">", ">", codeRegexes, fixed=TRUE); | ||
|
||
### Add html tags | ||
for (currentCodeRegexName in names(codeRegexes)) { | ||
currentCodeRegex <- codeRegexes[currentCodeRegexName]; | ||
codeContentMatches <- grepl(currentCodeRegex, res); | ||
if (any(codeContentMatches)) { | ||
codeContent <- | ||
ifelse(codeContentMatches, | ||
gsub(paste0(".*", currentCodeRegex, ".*"), | ||
"\\1", | ||
res), | ||
""); | ||
splitCodeContent <- | ||
unlist(lapply(strsplit(codeContent, | ||
inductiveCodingHierarchyMarker), | ||
paste0, | ||
collapse=" ")); | ||
splitCodeContent <- | ||
paste0('<span class="', codeClass, | ||
' ', currentCodeRegexName, | ||
#' ', splitCodeContent, | ||
'">'); | ||
# splitCodeContent <- | ||
# ifelse(codeContentMatches, | ||
# splitCodeContent, | ||
# ""); | ||
# currentCodeRegexMatches <- | ||
# gregexpr(paste0("(", currentCodeRegex, ")"), | ||
# res); | ||
res <- | ||
gsub(paste0("(", currentCodeRegex, ")"), | ||
paste0(splitCodeContent, '\\1</span>'), | ||
res); | ||
} | ||
} | ||
|
||
### Also replace <> symbols in all sectionRegexes | ||
sectionRegexes <- gsub("<", "<", sectionRegexes, fixed=TRUE); | ||
sectionRegexes <- gsub(">", ">", sectionRegexes, fixed=TRUE); | ||
|
||
### Add break tags | ||
for (currentBreakRegexName in names(sectionRegexes)) { | ||
currentBreakRegex <- sectionRegexes[currentBreakRegexName]; | ||
codeContentMatches <- grepl(currentBreakRegex, res); | ||
if (any(codeContentMatches)) { | ||
codeContent <- | ||
ifelse(codeContentMatches, | ||
gsub(paste0(".*", currentBreakRegex, ".*"), | ||
"\\1", | ||
res), | ||
""); | ||
splitCodeContent <- | ||
unlist(lapply(strsplit(codeContent, | ||
inductiveCodingHierarchyMarker), | ||
paste0, | ||
collapse=" ")); | ||
splitCodeContent <- | ||
paste0('<span class="', sectionClass, | ||
' ', currentBreakRegexName, | ||
'">'); | ||
res <- | ||
gsub(paste0("(", currentBreakRegex, ")"), | ||
paste0(splitCodeContent, '\\1</span>'), | ||
res); | ||
} | ||
} | ||
|
||
### Also replace <> symbols in all idRegexes | ||
idRegexes <- gsub("<", "<", idRegexes, fixed=TRUE); | ||
idRegexes <- gsub(">", ">", idRegexes, fixed=TRUE); | ||
|
||
### Add identifier tags | ||
for (currentIdRegexName in names(idRegexes)) { | ||
currentIdRegex <- idRegexes[currentIdRegexName]; | ||
codeContentMatches <- grepl(currentIdRegex, res); | ||
if (any(codeContentMatches)) { | ||
res <- | ||
gsub(paste0("(", currentIdRegex, ")"), | ||
paste0('<span class="', idClass, | ||
' ', currentIdRegexName, | ||
'">\\1</span>'), | ||
res); | ||
} | ||
} | ||
|
||
### Add UID tags | ||
res <- | ||
gsub(paste0("(", uidRegex, ")"), | ||
paste0('<span class="', uidClass, | ||
'">\\1</span>'), | ||
res); | ||
|
||
res <- paste0('<div class="', utteranceClass, '">', res, '</div>\n'); | ||
|
||
return(res); | ||
|
||
} |
Oops, something went wrong.