Wgraph:Demo label

From FollowTheScore
Revision as of 08:04, 3 November 2007 by Gero (talk | contribs) (New page: Node or edge lables are strings. * Strings can be written as plain tokens without quotes if they do not contain spaces. Strings can be written as plain tokens with underscores instead of...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Node or edge lables are strings.

  • Strings can be written as plain tokens without quotes if they do not contain spaces. Strings can be written as plain tokens with underscores instead of spaces; underscores are always converted to spaces.
  • The default label for a node is its ID.
  • Strings can be quoted with single or double quotes. Within one type of quotes you can use the other one without escaping.
  • Within labels you can use wiki syntax for underlining, bold and italic. Double quotes around your label are necessary if you want to use single quotes (and spaces) within the label.
  • "----" will create a horizontal line
  • Even if strings are quoted, they will be trimmed (i.e. spaces and newlines will be removed from both ends). This is useful because template calls tend to introduce unwanted whitespaces into arguments. If you really want leading or trailing white space, use underscores. So, if you use the concatenation mechanism for strings and you want a space between the concatenated parts, you must terminate the first part with an underscore or start the second part with asn underscore. See the example below.
  • Sequences of quoted strings with the same delimiter symbols will be concatenated (pasted) if they are separated by space or newline. So, "ab cd" "ef" will give one string "ab cdef" (note that there is no space between d and e. 'Ab_' 'cd' or "Ab " "cd" will result in "Ab cd" whereas 'Ab ' "cd" are two separate string arguments. Ab cd is the string "Ab" followed by a token named cd.
  • When used as node or edge labels strings are broken into lines.
    • "breakable characters" are space/underscore, dash, semicolon, colon, comma and brackets.
    • Strings will be broken at the first breakable character position which has a distance of at least 'textwidth' positions from the last line break
    • In addition the character sequence '\n' or <br> or <p> will always trigger a linebreak
  • Labels can be redefined in a node type definition or an edge type definition; The special symbol "%%" can be used to referr to the current contents of the label within such redefinitions. See the subgraph in the followeing example.
  • Note that there are some minor differences between png and svg output in this example. Line break in node B is different, the png version does not show bold text.
  • Note that the label of "Y_ypsilon" gets broken although the shpae is wide enough to take the whole text as one line. This is due to the text_width default value.

See also Wgraph:Demo align and Wgraph:Demo font and Wgraph:Demo icon.

{{#wgraph: svg | thumb=60 | wgl | gdl |

 node A {
   label       "This node demonstrates_"
               "the use of various_"
               "layout properties which ----"
               "can be used in WGL alone or together."
   textmode    left_justify
   textwidth   20
   color       #ddccff
   textcolor   blue
   bordercolor magenta
   width       250
   height      180
 }
 node B { 
   label       "in a ----special font"
   fontname    courBO18
 }
 edge from A to B { label . }
 node C { label "This\n is a long text, which_is broken into_" "several lines" }
 subgraph s1 { state boxed label "This is a boxed subgraph" text_width 10}
 node X s1 {loc 20;30  type s}
 node Y_ypsilon s1 {loc 120;30 type s width 200 }
 node_type s { label "This is  %% " }
 edge C s1 {}

}}