Better coloring

This commit is contained in:
Marc Garcia Puig 2019-05-15 17:39:25 +02:00 committed by Néstor Subirón
parent edd7286228
commit d6c955fd32
2 changed files with 392 additions and 388 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,10 @@
import os import os
import yaml import yaml
COLOR_METHOD = '#7fb800'
COLOR_PARAM = '#00a6ed'
COLOR_INSTANCE_VAR = '#f8805a'
def join(elem, separator = ''): def join(elem, separator = ''):
return separator.join(elem) return separator.join(elem)
@ -167,13 +171,13 @@ def gen_doc_method_def(method, indx=False):
if indx: if indx:
method_name = bold(method_name) method_name = bold(method_name)
else: else:
method_name = bold(color('#64BA2E', method_name)) method_name = bold(color(COLOR_METHOD, method_name))
for p in method['params']: for p in method['params']:
default = ''.join(['=', str(p['default'])]) if 'default' in p else '' default = ''.join(['=', str(p['default'])]) if 'default' in p else ''
if indx: if indx:
param = ''.join([param, bold(p['param_name']), default, ', ']) param = ''.join([param, bold(p['param_name']), default, ', '])
else: else:
param = ''.join([param, '<font color="#2980B9">', bold(p['param_name']), default, '</font>', ', ']) param = ''.join([param, '<font color="', COLOR_PARAM, '">', bold(p['param_name']), default, '</font>', ', '])
param = param[:-2] # delete the last ', ' param = param[:-2] # delete the last ', '
return ''.join([method_name, parentheses(param)]) return ''.join([method_name, parentheses(param)])
@ -244,7 +248,7 @@ def add_doc_method(md, method, class_key):
def add_doc_inst_var(md, inst_var, class_key): def add_doc_inst_var(md, inst_var, class_key):
var_name = inst_var['var_name'] var_name = inst_var['var_name']
var_key = '.'.join([class_key, var_name]) var_key = '.'.join([class_key, var_name])
md.list_pushn(html_key(var_key) + bold(var_name)) md.list_pushn(html_key(var_key) + bold(color(COLOR_INSTANCE_VAR, var_name)))
if valid_dic_val(inst_var, 'doc'): if valid_dic_val(inst_var, 'doc'):
md.textn(md.prettify_doc(inst_var['doc'])) md.textn(md.prettify_doc(inst_var['doc']))
md.list_pop() md.list_pop()