From 8e3d120acb7ecd4b16e11ddc377f20e2593adc07 Mon Sep 17 00:00:00 2001 From: Mark Hansen Date: Fri, 23 Oct 2020 22:02:01 +1100 Subject: [PATCH] Combine `orientation` attr for graphs and nodes This simplifies the generation quite a lot, gets rid of the duplicated anchors for differently-named. Removes a little confusion too, in my opinion. It's not perfect: they have different datatypes. --- doc/info/attrs.html | 21 ++++++--------------- doc/infosrc/attrs | 8 ++++---- doc/infosrc/mkattrs.py | 24 ------------------------ doc/infosrc/templates/attrs.html.j2 | 4 ++-- 4 files changed, 12 insertions(+), 45 deletions(-) diff --git a/doc/info/attrs.html b/doc/info/attrs.html index a404dd581..e5b91a521 100644 --- a/doc/info/attrs.html +++ b/doc/info/attrs.html @@ -931,20 +931,12 @@ of the layout programs. orientation - N - double - 0.0 + NG + double
string + 0.0
"" 360.0 - - orientation - G - string - "" - - - outputorder G @@ -2388,10 +2380,9 @@ in the graph or subgraph. Note that the graph attribute takes precedence over the node attribute.
orientation -
Angle, in degrees, used to rotate polygon node shapes. For any number of polygon sides, 0 degrees rotation results in a flat base. - -
orientation -
If "[lL]*", set graph orientation to landscape +
When used on nodes: Angle, in degrees, used to rotate polygon node shapes. For any number of polygon sides, 0 degrees rotation results in a flat base. +

+When used on graphs: If "[lL]*", set graph orientation to landscape. Used only if rotate is not defined.

outputorder diff --git a/doc/infosrc/attrs b/doc/infosrc/attrs index c3707d261..d1f8182ac 100644 --- a/doc/infosrc/attrs +++ b/doc/infosrc/attrs @@ -872,10 +872,10 @@ the input. If defined as a graph or subgraph attribute, the value is applied to all nodes in the graph or subgraph. Note that the graph attribute takes precedence over the node attribute. -:orientation:N:double:0.0:360.0; -Angle, in degrees, used to rotate polygon node shapes. For any number of polygon sides, 0 degrees rotation results in a flat base. -:orientation:G:string:""; -If "[lL]*", set graph orientation to landscape +:orientation:NG:double/string:0.0/"":360.0; +When used on nodes: Angle, in degrees, used to rotate polygon node shapes. For any number of polygon sides, 0 degrees rotation results in a flat base. +

+When used on graphs: If "[lL]*", set graph orientation to landscape. Used only if rotate is not defined. :outputorder:G:outputMode:breadthfirst; Specify order in which nodes and edges are drawn. diff --git a/doc/infosrc/mkattrs.py b/doc/infosrc/mkattrs.py index afdfe22f2..0002fa170 100755 --- a/doc/infosrc/mkattrs.py +++ b/doc/infosrc/mkattrs.py @@ -25,10 +25,6 @@ class Attribute: html_description: str defaults: List[str] minimums: List[str] - # Anchor () for definition - d_anchor: str = "" - # Anchor () for table at the top - a_anchor: str = "" attrs: List[Attribute] = [] @@ -70,26 +66,6 @@ attrs.sort(key=lambda attr: attr.name) for attr in attrs: attr.html_description = markupsafe.Markup(attr.html_description) -# The specification allows items with the same attribute name. -# This creates unique anchor keys, which are n copies of 'a' and 'd'. -a_anchors_used = set() -d_anchors_used = set() -for attr in attrs: - a_key = 'a' - d_key = 'd' - a_anchor = a_key + ':' + attr.name - d_anchor = d_key + ':' + attr.name - while a_anchor in a_anchors_used: - a_key += 'a' - a_anchor = a_key + ':' + attr.name - while d_anchor in d_anchors_used: - d_key += 'd' - d_anchor = d_key + ':' + attr.name - a_anchors_used.add(a_anchor) - d_anchors_used.add(d_anchor) - attr.a_anchor = a_anchor - attr.d_anchor = d_anchor - ## # Parse `types` file ## diff --git a/doc/infosrc/templates/attrs.html.j2 b/doc/infosrc/templates/attrs.html.j2 index 85f88afa6..90c163bca 100644 --- a/doc/infosrc/templates/attrs.html.j2 +++ b/doc/infosrc/templates/attrs.html.j2 @@ -91,7 +91,7 @@ of the layout programs. {% for attr in attrs %} - {{ attr.name }} + {{ attr.name }} {{ attr.used_by }} {%- for type in attr.types -%} @@ -135,7 +135,7 @@ of the layout programs.

Attribute Descriptions

{% for attr in attrs %} -
{{ attr.name }} +
{{ attr.name }}
{{ attr.html_description }} {% endfor %}
-- 2.40.0