From 0efb479fcc9c9c480b7dac3037227f0079fa2e40 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Mon, 13 Jun 2016 16:55:03 -0700 Subject: [PATCH] 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 --- doc/scripts/genrest/genrest.py | 5 ++--- doc/scripts/genrest/kconfiglib.py | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/scripts/genrest/genrest.py b/doc/scripts/genrest/genrest.py index fd5686d828..fc9217ae00 100644 --- a/doc/scripts/genrest/genrest.py +++ b/doc/scripts/genrest/genrest.py @@ -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: diff --git a/doc/scripts/genrest/kconfiglib.py b/doc/scripts/genrest/kconfiglib.py index 3f0b0c38a8..4c85aedd05 100644 --- a/doc/scripts/genrest/kconfiglib.py +++ b/doc/scripts/genrest/kconfiglib.py @@ -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)