Skip to content

Commit 0812b1a

Browse files
authored
Merge pull request #638 from plotly/0.39.0-issue591
Fix documentation bug which omits children from R help pages
2 parents 6cee22c + a779c60 commit 0812b1a

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

dash/development/_r_components_generation.py

+22-27
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737

3838
frame_element_template = '''`{dep_name}` = structure(list(name = "{dep_name}",
3939
version = "{project_ver}", src = list(href = NULL,
40-
file = "deps/"), meta = NULL,
40+
file = "deps"), meta = NULL,
4141
script = "{dep_rpp}",
4242
stylesheet = NULL, head = NULL, attachment = NULL, package = "{rpkgname}",
4343
all_files = FALSE), class = "html_dependency")'''
4444

4545
frame_body_template = '''`{project_shortname}` = structure(list(name = "{project_shortname}",
4646
version = "{project_ver}", src = list(href = NULL,
47-
file = "deps/"), meta = NULL,
47+
file = "deps"), meta = NULL,
4848
script = "{dep_rpp}",
4949
stylesheet = NULL, head = NULL, attachment = NULL, package = "{rpkgname}",
5050
all_files = FALSE), class = "html_dependency")''' # noqa:E501
@@ -65,7 +65,7 @@
6565
}}
6666
6767
\\usage{{
68-
{prefix}{name}({default_argtext}, ...)
68+
{prefix}{name}({default_argtext})
6969
}}
7070
7171
\\arguments{{
@@ -78,7 +78,8 @@
7878
Version: {package_version}
7979
Authors @R: as.person(c({package_author}))
8080
Description: {package_description}
81-
Depends: R (>= 3.5.0)
81+
Depends: R (>= 3.0.2)
82+
Imports: dashR
8283
Suggests: testthat, roxygen2
8384
License: {package_license}
8485
URL: {package_url}
@@ -223,8 +224,7 @@ def generate_class_string(name, props, project_shortname, prefix):
223224
def generate_js_metadata(pkg_data, project_shortname):
224225
"""
225226
Dynamically generate R function to supply JavaScript
226-
dependency information required by htmltools package,
227-
which is loaded by dashR.
227+
and CSS dependency information required by dashR package.
228228
229229
Parameters
230230
----------
@@ -305,9 +305,6 @@ def write_help_file(name, props, description, prefix):
305305
default_argtext = ''
306306
item_text = ''
307307

308-
# Ensure props are ordered with children first
309-
props = reorder_props(props=props)
310-
311308
prop_keys = list(props.keys())
312309

313310
has_wildcards = any('-*' in key for key in prop_keys)
@@ -331,6 +328,7 @@ def write_help_file(name, props, description, prefix):
331328

332329
if has_wildcards:
333330
item_text += '\n\n\\item{...}{wildcards: `data-*` or `aria-*`}'
331+
default_argtext += ', ...'
334332

335333
file_path = os.path.join('man', file_name)
336334
with open(file_path, 'w') as f:
@@ -350,6 +348,18 @@ def write_class_file(name,
350348
prefix=None):
351349
props = reorder_props(props=props)
352350

351+
# generate the R help pages for each of the Dash components that we
352+
# are transpiling -- this is done to avoid using Roxygen2 syntax,
353+
# we may eventually be able to generate similar documentation using
354+
# doxygen and an R plugin, but for now we'll just do it on our own
355+
# from within Python
356+
write_help_file(
357+
name,
358+
props,
359+
description,
360+
prefix
361+
)
362+
353363
import_string =\
354364
"# AUTO GENERATED FILE - DO NOT EDIT\n\n"
355365
class_string = generate_class_string(
@@ -365,26 +375,13 @@ def write_class_file(name,
365375
f.write(import_string)
366376
f.write(class_string)
367377

368-
# generate the R help pages for each of the Dash components that we
369-
# are transpiling -- this is done to avoid using Roxygen2 syntax,
370-
# we may eventually be able to generate similar documentation using
371-
# doxygen and an R plugin, but for now we'll just do it on our own
372-
# from within Python
373-
write_help_file(
374-
name,
375-
props,
376-
description,
377-
prefix
378-
)
379-
380378
print('Generated {}'.format(file_name))
381379

382380

383381
def write_js_metadata(pkg_data, project_shortname):
384382
"""
385383
Write an internal (not exported) R function to return all JS
386-
dependencies as required by htmltools package given a
387-
function string
384+
dependencies as required by dashR.
388385
389386
Parameters
390387
----------
@@ -488,10 +485,8 @@ def generate_rpkg(pkg_data,
488485
pkghelp_stub_path = os.path.join('man', package_name + '-package.Rd')
489486

490487
# generate the internal (not exported to the user) functions which
491-
# supply the JavaScript dependencies to the htmltools package,
492-
# which is required by DashR (this avoids having to generate an
493-
# RData file from within Python, given the current package generation
494-
# workflow)
488+
# supply the JavaScript dependencies to the dashR package.
489+
# this avoids having to generate an RData file from within Python.
495490
write_js_metadata(
496491
pkg_data=pkg_data,
497492
project_shortname=project_shortname

0 commit comments

Comments
 (0)