Ver código fonte

Add documentation references

Lutz Roeder 8 anos atrás
pai
commit
bceb2880ff
2 arquivos alterados com 19 adições e 1 exclusões
  1. 7 0
      src/keras-model.js
  2. 12 1
      src/view-template.js

+ 7 - 0
src/keras-model.js

@@ -682,6 +682,13 @@ class KerasOperatorMetadata {
                     }
                 });
             }
+            if (schema.references) {
+                schema.references.forEach((reference) => {
+                    if (reference) {
+                        reference.description = marked(reference.description);
+                    }
+                });                
+            }
             var template = Handlebars.compile(operatorTemplate, 'utf-8');
             return template(schema);
         }

+ 12 - 1
src/view-template.js

@@ -69,6 +69,8 @@ var operatorTemplate = `
 .documentation tt { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-weight: 600; font-size: 85%; background-color: rgba(27, 31, 35, 0.05); border-radius: 3px; padding: 0.2em 0.4em; margin: 0; }
 .documentation dl dt { font-size: 12px; font-weight: 600; padding: 0; margin-top: 16px; }
 .documentation dd { padding: 0 16px; margin-left: 0; margin-bottom: 16px; }
+.documentation ul { margin-top: 6px; margin-bottom: 6px; padding-left: 20px; }
+.documentation li { }
 </style>
 
 <div id='documentation' class='documentation'>
@@ -123,11 +125,20 @@ var operatorTemplate = `
 
 {{#if examples}}
 <h2>Examples</h2>
-{{/if}}
 {{#examples}}
 <h3>{{{summary}}}</h3>
 <pre>{{{code}}}</pre>
 {{/examples}}
+{{/if}}
+
+{{#if references}}
+<h2>References</h2>
+<ul>
+{{#references}}
+<li>{{{description}}}</li>
+{{/references}}
+</ul>
+{{/if}}
 
 {{#if domain}}{{#if since_version}}{{#if support_level}}
 <h2>Support</h2>