]> granicus.if.org Git - graphviz/commitdiff
Combine `orientation` attr for graphs and nodes
authorMark Hansen <markhansen@google.com>
Fri, 23 Oct 2020 11:02:01 +0000 (22:02 +1100)
committerMark Hansen <markhansen@google.com>
Fri, 23 Oct 2020 11:02:01 +0000 (22:02 +1100)
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
doc/infosrc/attrs
doc/infosrc/mkattrs.py
doc/infosrc/templates/attrs.html.j2

index a404dd5812bf6ad5e83da3db0895560214b78067..e5b91a521182c40ac2ab1506e8675ae283009f13 100644 (file)
@@ -931,20 +931,12 @@ of the layout programs.
 </TR>
 <TR>
   <TD><A ID="a:orientation" HREF="#d:orientation">orientation</A></TD>
-  <TD>N</TD>
-  <TD><A HREF="#k:double">double</A></TD>
-  <TD ALIGN="CENTER">0.0</TD>
+  <TD>NG</TD>
+  <TD><A HREF="#k:double">double</A><BR><A HREF="#k:string">string</A></TD>
+  <TD ALIGN="CENTER">0.0<BR>&#34;&#34;</TD>
   <TD>360.0</TD>
   <TD></TD>
 </TR>
-<TR>
-  <TD><A ID="aa:orientation" HREF="#dd:orientation">orientation</A></TD>
-  <TD>G</TD>
-  <TD><A HREF="#k:string">string</A></TD>
-  <TD ALIGN="CENTER">&#34;&#34;</TD>
-  <TD></TD>
-  <TD></TD>
-</TR>
 <TR>
   <TD><A ID="a:outputorder" HREF="#d:outputorder">outputorder</A></TD>
   <TD>G</TD>
@@ -2388,10 +2380,9 @@ in the graph or subgraph. Note that the graph attribute takes
 precedence over the node attribute.
 
 <DT><A ID="d:orientation" HREF="#a:orientation"><STRONG>orientation</STRONG></A>
-<DD>Angle, in degrees, used to rotate polygon node shapes. For any number of polygon sides, 0 degrees rotation results in a flat base.
-
-<DT><A ID="dd:orientation" HREF="#aa:orientation"><STRONG>orientation</STRONG></A>
-<DD>If "[lL]*", set graph orientation to landscape
+<DD>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.
+<P>
+When used on graphs: If <CODE>"[lL]*"</CODE>, set graph orientation to landscape.
 Used only if <A HREF=#d:rotate><B>rotate</B></A> is not defined.
 
 <DT><A ID="d:outputorder" HREF="#a:outputorder"><STRONG>outputorder</STRONG></A>
index c3707d26114a62090ef809315325a37a8205a4d3..d1f8182acd7bd55e37e56c93cc6e38a5face2e44 100644 (file)
@@ -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.
+<P>
+When used on graphs: If <CODE>"[lL]*"</CODE>, set graph orientation to landscape.
 Used only if <A HREF=#d:rotate><B>rotate</B></A> is not defined.
 :outputorder:G:outputMode:breadthfirst;
 Specify order in which nodes and edges are drawn.
index afdfe22f207c662f2baece747be62492726ed65c..0002fa170022ce2252e22585edf2cbfb9ce5fadf 100755 (executable)
@@ -25,10 +25,6 @@ class Attribute:
     html_description: str
     defaults: List[str]
     minimums: List[str]
-    # Anchor (<a name="#">) for definition
-    d_anchor: str = ""
-    # Anchor (<a name="#">) 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
 ##
index 85f88afa6b07a0dd65f3bba6b07a0d5a14f4a91f..90c163bca1ec9c53f28e1aaf4e55341ddf756160 100644 (file)
@@ -91,7 +91,7 @@ of the layout programs.
 </TR>
 {% for attr in attrs %}
 <TR>
-  <TD><A ID="{{ attr.a_anchor }}" HREF="#{{ attr.d_anchor }}">{{ attr.name }}</A></TD>
+  <TD><A ID="a:{{ attr.name }}" HREF="#d:{{ attr.name }}">{{ attr.name }}</A></TD>
   <TD>{{ attr.used_by }}</TD>
   <TD>
   {%- for type in attr.types -%}
@@ -135,7 +135,7 @@ of the layout programs.
 <H1>Attribute Descriptions</H1>
 <DL>
 {% for attr in attrs %}
-<DT><A ID="{{attr.d_anchor}}" HREF="#{{attr.a_anchor}}"><STRONG>{{ attr.name }}</STRONG></A>
+<DT><A ID="d:{{attr.name}}" HREF="#a:{{attr.name}}"><STRONG>{{ attr.name }}</STRONG></A>
 <DD>{{ attr.html_description }}
 {% endfor %}
 </DL>