public void Export(JekyllExporter exporter, View view, StreamWriter writer)
        {
            var guid = Guid.NewGuid();

            writer.WriteLine($"<div id='{guid}' class='cy'></div>");
            writer.WriteLine(@"
            <script>
            var cy = cytoscape({
            ");
            writer.WriteLine($"container: document.getElementById('{guid}'),");
            writer.WriteLine("elements: [");

            var nodes = view.Elements.Select(e => "{ data: { id: '" + e.Name + "', width: '"+ e.Name.Length * 10 +"px' } }");
            var edges = view.Relationships.Select(r => "{ data: { id: '" + r.Source.Name + "_to_" + r.Target.Name + "', source: '"+ r.Source.Name +"', target: '"+r.Target.Name+"' } }");

            writer.WriteLine(string.Join(",", nodes.Union(edges)));

            writer.WriteLine(@"
              ],

              style: cyto_" + view.ViewType.ToString().ToLowerInvariant() + @",

              layout: {
            name: 'cola',
            fit: true,
            nodeSpacing: 5,
            edgeLengthVal: 45
              }

            });
            </script>");
        }
        public void Export(JekyllExporter exporter, View view, StreamWriter writer)
        {
            var guid = Guid.NewGuid();

            writer.WriteLine(@"
            {% xdot png  w=2048 %}
            digraph finite_state_machine {
            rankdir=TB;
            size=""6"";
            "
            + BoilerPlate()
            + string.Join(Environment.NewLine, view.Elements.Select(e => $"{e.QualifiedName.Dotify()} [ label = \"{e.Name}\"]"))
            + string.Join(Environment.NewLine, view.Relationships.Select(r => $"{r.Source.QualifiedName.Dotify()} -> {r.Target.QualifiedName.Dotify()} [ label = \"{r.Label}\"]"))
            +
            @"
            }
            {% endxdot %}");
        }
 public static StreamWriter AppendViewBlock(this StreamWriter writer, JekyllExporter exporter, View view,
     IJekyllViewExporter viewExporter)
 {
     viewExporter.Export(exporter, view, writer);
     return writer;
 }
 public static StreamWriter AppendViewBlock(this StreamWriter writer, JekyllExporter exporter, View view,
                                            IJekyllViewExporter viewExporter)
 {
     viewExporter.Export(exporter, view, writer);
     return(writer);
 }
Пример #5
0
 /// <summary>
 /// Export all views
 /// </summary>
 /// <param name="destination"></param>
 public void Export(string destination)
 {
     var exporter = new JekyllExporter(this, destination);
     foreach (var view in Set.Views)
     {
         exporter.Export(view);
     }
 }