<commit_before><h1>JsonSchemaComponent demo</h1>

<h2>Textarea</h2>
<textarea id=demotextarea rows=25 cols=80 disabled=disabled>
{
  "title": "<NAME>",
  "abstract": "Something about a white whale and a man..",
  "public": true,
  "category": "politics"
}
</textarea>

<hr>

<h2>Form</h2>
<form id=demoform>

    <p> Blogpost title:
    <input type=text name=title />

    <p> Blogpost Teaser Text:
    <textarea name=abstract></textarea>

    <p> Public availability:
    <input type=checkbox name=public />

    <p> Category:
    <input type=radio value=local name=category /> Local
    <input type=radio value=filmcritics name=category /> Filmcritics
    <input type=radio value=politics name=category /> Politics

</form>

<script src=vendor/jquery-1.7.1.js></script>
<script src=vendor/jquery.tmpl.js></script>
<script src=src/json_schema_component.js></script>
<script>
new JsonSchemaComponent({
  schema: {
    "name" : "Blogpost",
    "properties" : {
      "title" : {
        "type" : "string",
        "description" : "Blogpost title",
        "required" : true
      },
      "abstract" : {
        "type" : "string",
        "description" : "Blogpost Teaser Text",
        "required": false
      },
      "public" : {
        "description" : "Public availability",
        "type" : "boolean",
      },
      "category" : {
        "description" : "Category",
        "type" : "string",
        "enum" : ["local", "politics", "filmcritics"]
      }
    }
  },
  textarea: $('#demotextarea'),
  form: $('#demoform'),
});
</script><commit_msg>Demo: Display schema in a second textarea<commit_after><h1>JsonSchemaComponent demo</h1>

<h2>Textarea</h2>
<textarea id=demotextarea rows=25 cols=80 disabled=disabled>
{
  "title": "<NAME>",
  "abstract": "Something about a white whale and a man..",
  "public": true,
  "category": "politics"
}
</textarea>

<hr>
<h2>Schema</h2>
<textarea id=schema rows=25 disabled=disabled style="width: 100%;">
{
  "name" : "Blogpost",
  "properties" : {
    "title" : {
      "type" : "string",
      "description" : "Blogpost title",
      "required" : true
    },
    "abstract" : {
      "type" : "string",
      "description" : "Blogpost Teaser Text",
      "required": false
    },
    "public" : {
      "description" : "Public availability",
      "type" : "boolean"
    },
    "category" : {
      "description" : "Category",
      "type" : "string",
      "enum" : ["local", "politics", "filmcritics"]
    }
  }
}
</textarea>
</div>

<h2>Form</h2>
<form id=demoform>

    <p> Blogpost title:
    <input type=text name=title />

    <p> Blogpost Teaser Text:
    <textarea name=abstract></textarea>

    <p> Public availability:
    <input type=checkbox name=public />

    <p> Category:
    <input type=radio value=local name=category /> Local
    <input type=radio value=filmcritics name=category /> Filmcritics
    <input type=radio value=politics name=category /> Politics

</form>

<script src=vendor/jquery-1.7.1.js></script>
<script src=vendor/jquery.tmpl.js></script>
<script src=src/json_schema_component.js></script>
<script>
new JsonSchemaComponent({
  schema: JSON.parse($('#schema').val()),
  textarea: $('#demotextarea'),
  form: $('#demoform'),
});
</script>
{'fraction_non_alphanumeric': 0.17623332299100217, 'fraction_numerical': 0.010238907849829351, 'mean_word_length': 3.2758620689655173, 'pattern_counts': {'":': 10, '<': 70, '<?xml version=': 0, '>': 70, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2512691', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1077, 'n_words': 243}