diff --git a/deploy/docs_conversion.py b/deploy/docs_conversion.py index 3059993..00be874 100644 --- a/deploy/docs_conversion.py +++ b/deploy/docs_conversion.py @@ -29,6 +29,10 @@ def create_r_doc(func): row = re.sub(r'^\.\. ', '', row) doc_str += f'{py_to_r_str(row)}\n' + # Replace LaTeX math code + math_pattern = re.compile(r'((:math:)|(math::))\s*`*.+(\\\n)*.+`*') + doc_str = re.sub(math_pattern, '(equation could not be rendered, see API doc on website)', doc_str) + if 'params' in doc_dict.keys(): doc_str += _create_r_params(doc_dict['params'], func) if 'returns' in doc_dict.keys(): @@ -102,8 +106,7 @@ def _translate_type_hints(var_type): if var_type.__module__.startswith('pharmpy'): return var_type.__name__ elif var_type not in TYPE_DICT: - warnings.warn(f'Could not translate type: {var_type}') - return var_type + raise ValueError(f'Could not translate type: {var_type}') return TYPE_DICT[var_type] elif var_type == Any: return 'any' diff --git a/deploy/help_functions.py b/deploy/help_functions.py index 911d872..6aeb965 100644 --- a/deploy/help_functions.py +++ b/deploy/help_functions.py @@ -63,17 +63,7 @@ def py_to_r_str(arg, example=False): r'\w+\[Model\]': 'vector of Model', # FIXME: more general pattern r'\w+\[ModelfitResults\]': 'vector of ModelfitResults'} # FIXME: more general pattern - latex = {r'\\mathsf': '', - r'\\cdot': '*', - r'\\text': '', - r'\\frac': 'frac', - r'\\log': 'log', - r'\\exp': 'exp', - r'\\min': 'min', - r'\\max': 'max', - r'\\epsilon': 'epsilon'} - - py_to_r_dict = {**args, **types, **latex} + py_to_r_dict = {**args, **types} if not example: py_to_r_dict = {**py_to_r_dict, **{r'\[([0-9]+)\]_*': r'(\1)'}}