--- /dev/null
+{
+ "title": "Graphviz JSON",
+ "description": "JSON representation of a graph encoding xdot attributes",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The graph name"
+ },
+ "directed": {
+ "type": "boolean",
+ "description": "True if the graph is directed"
+ },
+ "strict": {
+ "type": "boolean",
+ "description": "True if the graph is strict"
+ },
+ "_subgraph_cnt": {
+ "type": "integer",
+ "description": "Number of subgraphs in the graph"
+ },
+ "objects": {
+ "type": "array",
+ "items": { "$ref": "#/definitions/metanode" },
+ "description": "The graph's subgraphs followed by the graph's nodes"
+ },
+ "edges": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/edge"
+ }
+ },
+ "_draw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "_ldraw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "name",
+ "directed",
+ "strict",
+ "_subgraph_cnt"
+ ],
+ "definitions": {
+ "edge": {
+ "title": "edge",
+ "type": "object",
+ "properties": {
+ "_gvid": {
+ "type": "integer"
+ },
+ "tail": {
+ "type": "integer",
+ "description": "_gvid of tail node"
+ },
+ "head": {
+ "type": "integer",
+ "description": "_gvid of tail head"
+ },
+ "_draw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "_ldraw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "_hdraw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "_tdraw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "_hldraw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "_tldraw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "_gvid",
+ "tail",
+ "head"
+ ]
+ },
+ "metanode": {
+ "title": "node or subgraph",
+ "type": "object",
+ "properties": {
+ "_gvid": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string",
+ "description": "The node or subgraph name"
+ },
+ "subgraphs": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ },
+ "description": "index of a child subgraph"
+ },
+ "nodes": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ },
+ "description": "index of a node in this subgraph"
+ },
+ "edges": {
+ "type": "array",
+ "items": {
+ "type": "integer"
+ },
+ "description": "index of an edge in this subgraph"
+ },
+ "_draw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "_ldraw_": {
+ "$ref": "#/definitions/drawops"
+ },
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "_gvid",
+ "name"
+ ]
+ },
+ "drawops": {
+ "type": "array",
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/ellipse"
+ },
+ {
+ "$ref": "#/definitions/polygon"
+ },
+ {
+ "$ref": "#/definitions/polyline"
+ },
+ {
+ "$ref": "#/definitions/bspline"
+ },
+ {
+ "$ref": "#/definitions/text"
+ },
+ {
+ "$ref": "#/definitions/font_style"
+ },
+ {
+ "$ref": "#/definitions/drawcolor"
+ },
+ {
+ "$ref": "#/definitions/font"
+ },
+ {
+ "$ref": "#/definitions/style"
+ }
+ ]
+ }
+ },
+ "ellipse": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "[eE]"
+ },
+ "rect": {
+ "$ref": "#/definitions/rectangle"
+ }
+ },
+ "required": [
+ "op",
+ "rect"
+ ]
+ },
+ "polygon": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "[pP]"
+ },
+ "points": {
+ "$ref": "#/definitions/pointlist"
+ }
+ },
+ "required": [
+ "op",
+ "points"
+ ]
+ },
+ "polyline": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "L"
+ },
+ "points": {
+ "$ref": "#/definitions/pointlist"
+ }
+ },
+ "required": [
+ "op",
+ "points"
+ ]
+ },
+ "bspline": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "[bB]"
+ },
+ "points": {
+ "$ref": "#/definitions/pointlist"
+ }
+ },
+ "required": [
+ "op",
+ "points"
+ ]
+ },
+ "text": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "T"
+ },
+ "pt": {
+ "$ref": "#/definitions/point"
+ },
+ "align": {
+ "type": "string",
+ "pattern": "[lcr]"
+ },
+ "text": {
+ "type": "string"
+ },
+ "width": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "op",
+ "pt",
+ "align",
+ "text",
+ "width"
+ ]
+ },
+ "font_style": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "t"
+ },
+ "fontchar": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 127
+ }
+ },
+ "required": [
+ "op",
+ "fontchar"
+ ]
+ },
+ "drawcolor": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "[cC]"
+ },
+ "p0": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/point"
+ },
+ {
+ "$ref": "#/definitions/point3"
+ }
+ ]
+ },
+ "p1": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/point"
+ },
+ {
+ "$ref": "#/definitions/point3"
+ }
+ ]
+ },
+ "grad": {
+ "type": "string",
+ "enum": [
+ "none",
+ "linear",
+ "radial"
+ ]
+ },
+ "color": {
+ "$ref": "#/definitions/color"
+ },
+ "stops": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/stop"
+ }
+ }
+ },
+ "required": [
+ "op",
+ "grad"
+ ]
+ },
+ "font": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "F"
+ },
+ "size": {
+ "type": "number",
+ "minimum": 0
+ },
+ "face": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "op",
+ "size",
+ "face"
+ ]
+ },
+ "style": {
+ "type": "object",
+ "properties": {
+ "op": {
+ "type": "string",
+ "pattern": "S"
+ },
+ "style": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "op",
+ "style"
+ ]
+ },
+ "pointlist": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/point"
+ }
+ },
+ "point": {
+ "type": "array",
+ "items": {
+ "type": "number"
+ },
+ "maxItems": 2,
+ "minItems": 2
+ },
+ "point3": {
+ "type": "array",
+ "items": {
+ "type": "number"
+ },
+ "maxItems": 3,
+ "minItems": 3
+ },
+ "rectangle": {
+ "type": "array",
+ "items": {
+ "type": "number"
+ },
+ "maxItems": 4,
+ "minItems": 4
+ },
+ "color": {
+ "type": "string",
+ "pattern": "(#[0-9a-f]*)|(#[0-9a-f]{8})"
+ },
+ "stop": {
+ "type": "object",
+ "properties": {
+ "frac": {
+ "type": "number"
+ },
+ "color": {
+ "$ref": "#/definitions/color"
+ }
+ },
+ "required": [
+ "frac",
+ "color"
+ ]
+ }
+ }
+}
background-color: beige;
}
</style>
-<script src="http://www.w3schools.com/lib/w3data.js"></script>
+<script src="w3data.js"></script>
</HEAD>
<BODY BGCOLOR=white>
<A NAME="top"></A>
--- /dev/null
+/* W3Data ver 1.31 by W3Schools.com */\r
+var w3DataObject = {};\r
+function w3DisplayData(id, data) {\r
+ var htmlObj, htmlTemplate, html, arr = [], a, l, rowClone, x, j, i, ii, cc, repeat, repeatObj, repeatX = "";\r
+ htmlObj = document.getElementById(id);\r
+ htmlTemplate = w3InitTemplate(id, htmlObj);\r
+ html = htmlTemplate.cloneNode(true);\r
+ arr = w3GetElementsByAttribute(html, "w3-repeat");\r
+ l = arr.length;\r
+ for (j = (l - 1); j >= 0; j -= 1) {\r
+ cc = arr[j].getAttribute("w3-repeat").split(" ");\r
+ if (cc.length == 1) {\r
+ repeat = cc[0];\r
+ } else {\r
+ repeatX = cc[0];\r
+ repeat = cc[2];\r
+ }\r
+ arr[j].removeAttribute("w3-repeat");\r
+ repeatObj = data[repeat];\r
+ if (repeatObj && typeof repeatObj == "object" && repeatObj.length != "undefined") {\r
+ i = 0;\r
+ for (x in repeatObj) {\r
+ i += 1;\r
+ rowClone = arr[j];\r
+ rowClone = w3NeedleInHaystack(rowClone, "element", repeatX, repeatObj[x]);\r
+ a = rowClone.attributes;\r
+ for (ii = 0; ii < a.length; ii += 1) {\r
+ a[ii].value = w3NeedleInHaystack(a[ii], "attribute", repeatX, repeatObj[x]).value;\r
+ }\r
+ (i === repeatObj.length) ? arr[j].parentNode.replaceChild(rowClone, arr[j]) : arr[j].parentNode.insertBefore(rowClone, arr[j]);\r
+ }\r
+ } else {\r
+ console.log("w3-repeat must be an array. " + repeat + " is not an array.");\r
+ continue;\r
+ }\r
+ }\r
+ html = w3NeedleInHaystack(html, "element");\r
+ htmlObj.parentNode.replaceChild(html, htmlObj);\r
+ function w3InitTemplate(id, obj) {\r
+ var template;\r
+ template = obj.cloneNode(true);\r
+ if (w3DataObject.hasOwnProperty(id)) {return w3DataObject[id];}\r
+ w3DataObject[id] = template;\r
+ return template;\r
+ }\r
+ function w3GetElementsByAttribute(x, att) {\r
+ var arr = [], arrCount = -1, i, l, y = x.getElementsByTagName("*"), z = att.toUpperCase();\r
+ l = y.length;\r
+ for (i = -1; i < l; i += 1) {\r
+ if (i == -1) {y[i] = x;}\r
+ if (y[i].getAttribute(z) !== null) {arrCount += 1; arr[arrCount] = y[i];}\r
+ }\r
+ return arr;\r
+ }\r
+ function w3NeedleInHaystack(elmnt, typ, repeatX, x) {\r
+ var value, rowClone, pos1, haystack, pos2, needle = [], needleToReplace, i, cc, r;\r
+ rowClone = elmnt.cloneNode(true);\r
+ pos1 = 0;\r
+ while (pos1 > -1) {\r
+ haystack = (typ == "attribute") ? rowClone.value : rowClone.innerHTML;\r
+ pos1 = haystack.indexOf("{{", pos1);\r
+ if (pos1 === -1) {break;}\r
+ pos2 = haystack.indexOf("}}", pos1 + 1);\r
+ needleToReplace = haystack.substring(pos1 + 2, pos2);\r
+ needle = needleToReplace.split("||");\r
+ value = undefined;\r
+ for (i = 0; i < needle.length; i += 1) {\r
+ needle[i] = needle[i].replace(/^\s+|\s+$/gm, ''); //trim\r
+ //value = ((x && x[needle[i]]) || (data && data[needle[i]]));\r
+ if (x) {value = x[needle[i]];}\r
+ if (value == undefined && data) {value = data[needle[i]];}\r
+ if (value == undefined) {\r
+ cc = needle[i].split(".");\r
+ if (cc[0] == repeatX) {value = x[cc[1]]; }\r
+ }\r
+ if (value == undefined) {\r
+ if (needle[i] == repeatX) {value = x;}\r
+ }\r
+ if (value == undefined) {\r
+ if (needle[i].substr(0, 1) == '"') {\r
+ value = needle[i].replace(/"/g, "");\r
+ } else if (needle[i].substr(0,1) == "'") {\r
+ value = needle[i].replace(/'/g, "");\r
+ }\r
+ }\r
+ if (value != undefined) {break;}\r
+ }\r
+ if (value != undefined) {\r
+ r = "{{" + needleToReplace + "}}";\r
+ if (typ == "attribute") {\r
+ rowClone.value = rowClone.value.replace(r, value);\r
+ } else {\r
+ w3ReplaceHTML(rowClone, r, value);\r
+ }\r
+ }\r
+ pos1 = pos1 + 1;\r
+ }\r
+ return rowClone;\r
+ }\r
+ function w3ReplaceHTML(a, r, result) {\r
+ var b, l, i, a, x, j;\r
+ if (a.hasAttributes()) {\r
+ b = a.attributes;\r
+ l = b.length;\r
+ for (i = 0; i < l; i += 1) {\r
+ if (b[i].value.indexOf(r) > -1) {b[i].value = b[i].value.replace(r, result);}\r
+ }\r
+ }\r
+ x = a.getElementsByTagName("*");\r
+ l = x.length;\r
+ a.innerHTML = a.innerHTML.replace(r, result);\r
+ }\r
+}\r
+function w3IncludeHTML() {\r
+ var z, i, elmnt, file, xhttp;\r
+ z = document.getElementsByTagName("*");\r
+ for (i = 0; i < z.length; i++) {\r
+ elmnt = z[i];\r
+ file = elmnt.getAttribute("w3-include-html");\r
+ if (file) {\r
+ xhttp = new XMLHttpRequest();\r
+ xhttp.onreadystatechange = function() {\r
+ if (this.readyState == 4 && this.status == 200) {\r
+ elmnt.innerHTML = this.responseText;\r
+ elmnt.removeAttribute("w3-include-html");\r
+ w3IncludeHTML();\r
+ }\r
+ } \r
+ xhttp.open("GET", file, true);\r
+ xhttp.send();\r
+ return;\r
+ }\r
+ }\r
+}\r
+function w3Http(target, readyfunc, xml, method) {\r
+ var httpObj;\r
+ if (!method) {method = "GET"; }\r
+ if (window.XMLHttpRequest) {\r
+ httpObj = new XMLHttpRequest();\r
+ } else if (window.ActiveXObject) {\r
+ httpObj = new ActiveXObject("Microsoft.XMLHTTP");\r
+ }\r
+ if (httpObj) {\r
+ if (readyfunc) {httpObj.onreadystatechange = readyfunc;}\r
+ httpObj.open(method, target, true);\r
+ httpObj.send(xml);\r
+ }\r
+}
\ No newline at end of file
DOTS = html2.gv html3.gv html4.gv tee.gv
HTML = attrs.html colors.html command.html lang.html output.html shapes.html \
arrows.html schema.html
-INSTALL_FILES = $(HTML) $(DOTS) $(SGIF) $(AGIF) $(A2GIF) $(MGIF) $(XGIF) $(MJPG) $(MPNG)
+MISC = graphviz_json_schema.json w3data.js
+INSTALL_FILES = $(HTML) $(DOTS) $(SGIF) $(AGIF) $(A2GIF) $(MGIF) $(XGIF) $(MJPG) $(MPNG) $(MISC)
.SUFFIXES: .gv .gif .dot .png
--- /dev/null
+#!/usr/bin/env python
+
+import json
+from json2html import *
+
+def main():
+ with open(sys.argv[1]) as inf:
+ inputs = inf.read()
+ input = json.loads(inputs)
+ output = json2html.convert(json = input, table_attributes="class=\"jsontable\"")
+ with open(sys.argv[2], 'w') as outf:
+ outf.write(output)
+
+main()
background-color: beige;
}
</style>
-<script src="http://www.w3schools.com/lib/w3data.js"></script>
+<script src="w3data.js"></script>
</HEAD>
<BODY BGCOLOR=white>
<A NAME="top"></A>
--- /dev/null
+/* W3Data ver 1.31 by W3Schools.com */\r
+var w3DataObject = {};\r
+function w3DisplayData(id, data) {\r
+ var htmlObj, htmlTemplate, html, arr = [], a, l, rowClone, x, j, i, ii, cc, repeat, repeatObj, repeatX = "";\r
+ htmlObj = document.getElementById(id);\r
+ htmlTemplate = w3InitTemplate(id, htmlObj);\r
+ html = htmlTemplate.cloneNode(true);\r
+ arr = w3GetElementsByAttribute(html, "w3-repeat");\r
+ l = arr.length;\r
+ for (j = (l - 1); j >= 0; j -= 1) {\r
+ cc = arr[j].getAttribute("w3-repeat").split(" ");\r
+ if (cc.length == 1) {\r
+ repeat = cc[0];\r
+ } else {\r
+ repeatX = cc[0];\r
+ repeat = cc[2];\r
+ }\r
+ arr[j].removeAttribute("w3-repeat");\r
+ repeatObj = data[repeat];\r
+ if (repeatObj && typeof repeatObj == "object" && repeatObj.length != "undefined") {\r
+ i = 0;\r
+ for (x in repeatObj) {\r
+ i += 1;\r
+ rowClone = arr[j];\r
+ rowClone = w3NeedleInHaystack(rowClone, "element", repeatX, repeatObj[x]);\r
+ a = rowClone.attributes;\r
+ for (ii = 0; ii < a.length; ii += 1) {\r
+ a[ii].value = w3NeedleInHaystack(a[ii], "attribute", repeatX, repeatObj[x]).value;\r
+ }\r
+ (i === repeatObj.length) ? arr[j].parentNode.replaceChild(rowClone, arr[j]) : arr[j].parentNode.insertBefore(rowClone, arr[j]);\r
+ }\r
+ } else {\r
+ console.log("w3-repeat must be an array. " + repeat + " is not an array.");\r
+ continue;\r
+ }\r
+ }\r
+ html = w3NeedleInHaystack(html, "element");\r
+ htmlObj.parentNode.replaceChild(html, htmlObj);\r
+ function w3InitTemplate(id, obj) {\r
+ var template;\r
+ template = obj.cloneNode(true);\r
+ if (w3DataObject.hasOwnProperty(id)) {return w3DataObject[id];}\r
+ w3DataObject[id] = template;\r
+ return template;\r
+ }\r
+ function w3GetElementsByAttribute(x, att) {\r
+ var arr = [], arrCount = -1, i, l, y = x.getElementsByTagName("*"), z = att.toUpperCase();\r
+ l = y.length;\r
+ for (i = -1; i < l; i += 1) {\r
+ if (i == -1) {y[i] = x;}\r
+ if (y[i].getAttribute(z) !== null) {arrCount += 1; arr[arrCount] = y[i];}\r
+ }\r
+ return arr;\r
+ }\r
+ function w3NeedleInHaystack(elmnt, typ, repeatX, x) {\r
+ var value, rowClone, pos1, haystack, pos2, needle = [], needleToReplace, i, cc, r;\r
+ rowClone = elmnt.cloneNode(true);\r
+ pos1 = 0;\r
+ while (pos1 > -1) {\r
+ haystack = (typ == "attribute") ? rowClone.value : rowClone.innerHTML;\r
+ pos1 = haystack.indexOf("{{", pos1);\r
+ if (pos1 === -1) {break;}\r
+ pos2 = haystack.indexOf("}}", pos1 + 1);\r
+ needleToReplace = haystack.substring(pos1 + 2, pos2);\r
+ needle = needleToReplace.split("||");\r
+ value = undefined;\r
+ for (i = 0; i < needle.length; i += 1) {\r
+ needle[i] = needle[i].replace(/^\s+|\s+$/gm, ''); //trim\r
+ //value = ((x && x[needle[i]]) || (data && data[needle[i]]));\r
+ if (x) {value = x[needle[i]];}\r
+ if (value == undefined && data) {value = data[needle[i]];}\r
+ if (value == undefined) {\r
+ cc = needle[i].split(".");\r
+ if (cc[0] == repeatX) {value = x[cc[1]]; }\r
+ }\r
+ if (value == undefined) {\r
+ if (needle[i] == repeatX) {value = x;}\r
+ }\r
+ if (value == undefined) {\r
+ if (needle[i].substr(0, 1) == '"') {\r
+ value = needle[i].replace(/"/g, "");\r
+ } else if (needle[i].substr(0,1) == "'") {\r
+ value = needle[i].replace(/'/g, "");\r
+ }\r
+ }\r
+ if (value != undefined) {break;}\r
+ }\r
+ if (value != undefined) {\r
+ r = "{{" + needleToReplace + "}}";\r
+ if (typ == "attribute") {\r
+ rowClone.value = rowClone.value.replace(r, value);\r
+ } else {\r
+ w3ReplaceHTML(rowClone, r, value);\r
+ }\r
+ }\r
+ pos1 = pos1 + 1;\r
+ }\r
+ return rowClone;\r
+ }\r
+ function w3ReplaceHTML(a, r, result) {\r
+ var b, l, i, a, x, j;\r
+ if (a.hasAttributes()) {\r
+ b = a.attributes;\r
+ l = b.length;\r
+ for (i = 0; i < l; i += 1) {\r
+ if (b[i].value.indexOf(r) > -1) {b[i].value = b[i].value.replace(r, result);}\r
+ }\r
+ }\r
+ x = a.getElementsByTagName("*");\r
+ l = x.length;\r
+ a.innerHTML = a.innerHTML.replace(r, result);\r
+ }\r
+}\r
+function w3IncludeHTML() {\r
+ var z, i, elmnt, file, xhttp;\r
+ z = document.getElementsByTagName("*");\r
+ for (i = 0; i < z.length; i++) {\r
+ elmnt = z[i];\r
+ file = elmnt.getAttribute("w3-include-html");\r
+ if (file) {\r
+ xhttp = new XMLHttpRequest();\r
+ xhttp.onreadystatechange = function() {\r
+ if (this.readyState == 4 && this.status == 200) {\r
+ elmnt.innerHTML = this.responseText;\r
+ elmnt.removeAttribute("w3-include-html");\r
+ w3IncludeHTML();\r
+ }\r
+ } \r
+ xhttp.open("GET", file, true);\r
+ xhttp.send();\r
+ return;\r
+ }\r
+ }\r
+}\r
+function w3Http(target, readyfunc, xml, method) {\r
+ var httpObj;\r
+ if (!method) {method = "GET"; }\r
+ if (window.XMLHttpRequest) {\r
+ httpObj = new XMLHttpRequest();\r
+ } else if (window.ActiveXObject) {\r
+ httpObj = new ActiveXObject("Microsoft.XMLHTTP");\r
+ }\r
+ if (httpObj) {\r
+ if (readyfunc) {httpObj.onreadystatechange = readyfunc;}\r
+ httpObj.open(method, target, true);\r
+ httpObj.send(xml);\r
+ }\r
+}
\ No newline at end of file