<commit_before><!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Midgard Create type-based example</title>
    <script src="../deps/jquery-1.7.1.min.js"></script>
    <script src="../deps/jquery-ui-1.8.18.custom.min.js"></script>
    <script src="../deps/underscore-min.js"></script>
    <script src="../deps/backbone-min.js"></script>
    <script src="../deps/vie-min.js"></script>

    <!-- Tags input is needed for the Tag widget -->
    <script src="../deps/jquery.tagsinput.min.js"></script>

    <!-- rdfQuery and annotate are only needed for the Hallo
    annotations plugin -->
    <script src="../deps/jquery.rdfquery.min.js"></script>
    <script src="../deps/annotate-min.js"></script>

    <script src="../deps/rangy-core-1.2.3.js"></script>
    <script src="../deps/hallo-min.js"></script>
    <script src="./create.js"></script>
    <script type="text/html" id="SectionText">
      <section typeof="Text" about="">
        <div property="content"></div>
      </section>
    </script>
    <script type="text/html" id="SectionQuote">
      <section typeof="Quote" about="">
        <blockquote property="quote"></blockquote>
        <p property="citation"></p>
      </section>
    </script>
    <script>
      jQuery(document).ready(function () {
        // Use a custom VIE instance so that we can feed it our type information
        var vie = new VIE();
        vie.use(new vie.RdfaService());

        vie.types.add('Text', [
          {
            id: 'content',
            range: 'Text',
            min: 1,
            max: 1
          }
        ]);

        vie.types.add('Quote', [
          {
            id: 'quote',
            range: 'Text',
            min: 1,
            max: 1
          },
          {
            id: 'citation',
            range: 'SimpleText',
            min: 0,
            max: 1
          }
        ]);

        vie.types.add('Page', [
          {
            id: 'title',
            range: 'SimpleText',
            min: 1,
            max: 1
          },
          {
            id: 'author',
            range: 'PersonName',
            min: 0,
            max: -1
          },
          {
            id: 'section',
            range: ['Text', 'Quote'],
            min: 0,
            max: 3
          }
        ]);

        vie.service('rdfa').setTemplate('Text', 'section', jQuery('#SectionText').html());
        vie.service('rdfa').setTemplate('Quote', 'section', jQuery('#SectionQuote').html());

        jQuery('body').midgardCreate({
          url: function () {
            return 'javascript:false;';
          },
          vie: vie,
          collectionWidgets: {
            default: 'midgardCollectionAddBetween'
          }
        });

        // Set a simpler editor for title fields
        jQuery('body').midgardCreate('configureEditor', 'simpleHallo', 'halloWidget', {
          plugins: {
            halloformat: {},
            halloblacklist: {
              tags: ['br']
            }
          }
        });
        jQuery('body').midgardCreate('setEditorForProperty', 'SimpleText', 'simpleHallo');

        // Disable editing of author fields
        jQuery('body').midgardCreate('setEditorForProperty', 'PersonName', null);
      });
      // Fake Backbone.sync since there is no server to communicate with
      Backbone.sync = function(method, model, options) {
        if (console && console.log) {
          console.log('Model contents', model.toJSONLD());
        }
        options.success(model);
      };
    </script>
    <link rel="stylesheet" href="./font-awesome/css/font-awesome.css"
    />
    <link rel="stylesheet" href="../themes/create-ui/css/create-ui.css"
    />
    <link rel="stylesheet" href="../themes/midgard-notifications/midgardnotif.css"
    />
    <link rel="stylesheet" href="demo.css" />

  </head>
  
  <body>
    <div about="http://example.net/page" typeof="Page">
      <h1 property="title">My page title</h1>
      <div property="author"><NAME></div>
      <div rel="section" rev="sectionOf">
      </div>
    </div>
  </body>
</html><commit_msg>Simulate server delay<commit_after><!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Midgard Create type-based example</title>
    <script src="../deps/jquery-1.7.1.min.js"></script>
    <script src="../deps/jquery-ui-1.8.18.custom.min.js"></script>
    <script src="../deps/underscore-min.js"></script>
    <script src="../deps/backbone-min.js"></script>
    <script src="../deps/vie-min.js"></script>

    <!-- Tags input is needed for the Tag widget -->
    <script src="../deps/jquery.tagsinput.min.js"></script>

    <!-- rdfQuery and annotate are only needed for the Hallo
    annotations plugin -->
    <script src="../deps/jquery.rdfquery.min.js"></script>
    <script src="../deps/annotate-min.js"></script>

    <script src="../deps/rangy-core-1.2.3.js"></script>
    <script src="../deps/hallo-min.js"></script>
    <script src="./create.js"></script>
    <script type="text/html" id="SectionText">
      <section typeof="Text" about="">
        <div property="content"></div>
      </section>
    </script>
    <script type="text/html" id="SectionQuote">
      <section typeof="Quote" about="">
        <blockquote property="quote"></blockquote>
        <p property="citation"></p>
      </section>
    </script>
    <script>
      jQuery(document).ready(function () {
        // Use a custom VIE instance so that we can feed it our type information
        var vie = new VIE();
        vie.use(new vie.RdfaService());

        vie.types.add('Text', [
          {
            id: 'content',
            range: 'Text',
            min: 1,
            max: 1
          }
        ]);

        vie.types.add('Quote', [
          {
            id: 'quote',
            range: 'Text',
            min: 1,
            max: 1
          },
          {
            id: 'citation',
            range: 'SimpleText',
            min: 0,
            max: 1
          }
        ]);

        vie.types.add('Page', [
          {
            id: 'title',
            range: 'SimpleText',
            min: 1,
            max: 1
          },
          {
            id: 'author',
            range: 'PersonName',
            min: 0,
            max: -1
          },
          {
            id: 'section',
            range: ['Text', 'Quote'],
            min: 0,
            max: 3
          }
        ]);

        vie.service('rdfa').setTemplate('Text', 'section', jQuery('#SectionText').html());
        vie.service('rdfa').setTemplate('Quote', 'section', jQuery('#SectionQuote').html());

        jQuery('body').midgardCreate({
          url: function () {
            return 'javascript:false;';
          },
          vie: vie,
          collectionWidgets: {
            default: 'midgardCollectionAddBetween'
          }
        });

        // Set a simpler editor for title fields
        jQuery('body').midgardCreate('configureEditor', 'simpleHallo', 'halloWidget', {
          plugins: {
            halloformat: {},
            halloblacklist: {
              tags: ['br']
            }
          }
        });
        jQuery('body').midgardCreate('setEditorForProperty', 'SimpleText', 'simpleHallo');

        // Disable editing of author fields
        jQuery('body').midgardCreate('setEditorForProperty', 'PersonName', null);
      });
      // Fake Backbone.sync since there is no server to communicate with
      Backbone.sync = function(method, model, options) {
        var modelJson = model.toJSONLD();
        if (console && console.log) {
          console.log('Model contents', modelJson);
        }
        if (model.isNew()) {
          // Create fake subject
          modelJson['@subject'] = '<' + new Date().getTime() + '>';
        }

        // Simulate server delay
        var delay = Math.random() * 1000;
        window.setTimeout(function () {
          options.success(modelJson);
        }, delay);
      };
    </script>
    <link rel="stylesheet" href="./font-awesome/css/font-awesome.css"
    />
    <link rel="stylesheet" href="../themes/create-ui/css/create-ui.css"
    />
    <link rel="stylesheet" href="../themes/midgard-notifications/midgardnotif.css"
    />
    <link rel="stylesheet" href="demo.css" />

  </head>
  
  <body>
    <div about="http://example.net/page" typeof="Page">
      <h1 property="title">My page title</h1>
      <div property="author"><NAME></div>
      <div rel="section" rev="sectionOf">
      </div>
    </div>
  </body>
</html>
{'fraction_non_alphanumeric': 0.17215428033866415, 'fraction_numerical': 0.006349952963311383, 'mean_word_length': 1.7894391603804527, 'pattern_counts': {'":': 0, '<': 130, '<?xml version=': 0, '>': 130, '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': '7033719', 'n_tokens_mistral': 2588, 'n_tokens_neox': 2474, 'n_words': 503}