Skip to content

Commit 19c6d1a

Browse files
author
Dominique Quatravaux
committed
[feature] Parse bodies
1 parent 2bc13a4 commit 19c6d1a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

confluence.R

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,27 @@ stopifnot({
135135
anti_join(relation1, relation2, by = by) %>% nrow == 0 &&
136136
anti_join(relation2, relation1, by = by) %>% nrow == 0
137137
})
138+
139+
bodies <- {
140+
ns <- entities_xml %>% xml_find_all('//object[@class="BodyContent"]')
141+
tibble(body_id = ns %>% confluence_id) %>%
142+
mutate(ns %>% props_tibble) %>%
143+
mutate(.keep = "unused",
144+
type = case_when(
145+
bodyType == 0 ~ "SpaceDescription",
146+
bodyType == 1 ~ "CustomContentEntityObject",
147+
bodyType == 2 ~ "PageEtc")) %>%
148+
mutate(ns %>% classful_props_tibble)
149+
}
150+
151+
stopifnot(bodies %>%
152+
filter(is.na(type)) %>%
153+
nrow == 0)
154+
stopifnot(bodies %>%
155+
filter(! is.na(content.SpaceDescription)) %>%
156+
filter(type != "SpaceDescription") %>%
157+
nrow == 0)
158+
stopifnot(bodies %>%
159+
filter(! is.na(content.CustomContentEntityObject)) %>%
160+
filter(type != "CustomContentEntityObject") %>%
161+
nrow == 0)

0 commit comments

Comments
 (0)