doc: declare CONFIG_XYZ with .. option:: vs a header

This allows us to cross ref from code with :option:`CONFIG_XYZ`
generating a useful link and avoiding an 'undefined target` warning.

Hyperlink using :option: instead of :ref:.

Change-Id: I6cc0daec012dfcca504faa47d591885e69c8e521
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
This commit is contained in:
Inaky Perez-Gonzalez 2016-06-13 16:55:03 -07:00 committed by Anas Nashif
parent 3de36d0b7c
commit 0efb479fcc
2 changed files with 6 additions and 7 deletions

View file

@ -31,7 +31,7 @@ def print_items(items, outdir, indent):
var = "CONFIG_%s" %item.get_name()
if not var in done:
done.append(var)
f.write(" * - :ref:`%s`\n" %var)
f.write(" * - :option:`%s`\n" %var)
if len(item.get_prompts()) > 0:
p = item.get_prompts()[0]
else:
@ -39,9 +39,8 @@ def print_items(items, outdir, indent):
f.write(" - %s\n" %p)
config = open("%s/%s.rst" % (outdir, var), "w")
config.write(":orphan:\n\n")
config.write(".. option:: CONFIG_%s:\n" %item.get_name())
config.write(".. _CONFIG_%s:\n" %item.get_name())
config.write("\n%s\n" %var)
config.write("%s\n\n" %(len("%s" %var) * '#' ))
if text:
config.write("\n%s\n\n" %text)
else:

View file

@ -1682,10 +1682,10 @@ class Config(object):
selects_str_rows = []
for target, cond_expr in sc.orig_selects:
if cond_expr is None:
selects_str_rows.append(" :ref:`CONFIG_{0}`".format(target.name))
selects_str_rows.append(" :option:`CONFIG_{0}`".format(target.name))
else:
selects_str_rows.append(
" :ref:`CONFIG_{0}` if {1}".format(target.name,
" :option:`CONFIG_{0}` if {1}".format(target.name,
self._expr_val_str(cond_expr)))
selects_str = "\n * "
selects_str += "\n * ".join(selects_str_rows)
@ -1848,10 +1848,10 @@ class Config(object):
selects_str_rows = []
for target, cond_expr in sc.orig_selects:
if cond_expr is None:
selects_str_rows.append(" :ref:`CONFIG_{0}`".format(target.name))
selects_str_rows.append(" :option:`CONFIG_{0}`".format(target.name))
else:
selects_str_rows.append(
" :ref:`CONFIG_{0}` if {1}".format(target.name,
" :option:`CONFIG_{0}` if {1}".format(target.name,
self._expr_val_str(cond_expr)))
selects_str = "\n".join(selects_str_rows)