all repos — NoPaste @ 29b774f090102303e43cf939b38ac2083e62d9f1

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/protobuf/index.html (view raw)

  1<!doctype html>
  2
  3<title>CodeMirror: ProtoBuf mode</title>
  4<meta charset="utf-8"/>
  5<link rel=stylesheet href="../../doc/docs.css">
  6
  7<link rel="stylesheet" href="../../lib/codemirror.css">
  8<script src="../../lib/codemirror.js"></script>
  9<script src="protobuf.js"></script>
 10<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
 11<div id=nav>
 12  <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
 13
 14  <ul>
 15    <li><a href="../../index.html">Home</a>
 16    <li><a href="../../doc/manual.html">Manual</a>
 17    <li><a href="https://github.com/codemirror/codemirror">Code</a>
 18  </ul>
 19  <ul>
 20    <li><a href="../index.html">Language modes</a>
 21    <li><a class=active href="#">ProtoBuf</a>
 22  </ul>
 23</div>
 24
 25<article>
 26<h2>ProtoBuf mode</h2>
 27<form><textarea id="code" name="code">
 28package addressbook;
 29
 30message Address {
 31   required string street = 1;
 32   required string postCode = 2;
 33}
 34
 35message PhoneNumber {
 36   required string number = 1;
 37}
 38
 39message Person {
 40   optional int32 id = 1;
 41   required string name = 2;
 42   required string surname = 3;
 43   optional Address address = 4;
 44   repeated PhoneNumber phoneNumbers = 5;
 45   optional uint32 age = 6;
 46   repeated uint32 favouriteNumbers = 7;
 47   optional string license = 8;
 48   enum Gender {
 49      MALE = 0;
 50      FEMALE = 1;
 51   }
 52   optional Gender gender = 9;
 53   optional fixed64 lastUpdate = 10;
 54   required bool deleted = 11 [default = false];
 55}
 56
 57</textarea>
 58  <textarea id="code2" name="code2">
 59syntax = "proto3";
 60package tutorial;
 61
 62import "google/protobuf/timestamp.proto";
 63option java_package = "com.example.tutorial";
 64option java_outer_classname = "AddressBookProtos";
 65option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
 66
 67message Person {
 68  string name = 1;
 69  int32 id = 2;  // Unique ID number for this person.
 70  string email = 3;
 71
 72  enum PhoneType {
 73    MOBILE = 0;
 74    HOME = 1;
 75    WORK = 2;
 76  }
 77
 78  message PhoneNumber {
 79    string number = 1;
 80    PhoneType type = 2;
 81  }
 82
 83  repeated PhoneNumber phones = 4;
 84
 85  google.protobuf.Timestamp last_updated = 5;
 86}
 87
 88// Our address book file is just one of these.
 89message AddressBook {
 90  repeated Person people = 1;
 91}
 92service Test {
 93  rpc SayHello (HelloRequest) returns (HelloReply) {}
 94  rpc SayHelloAgain (HelloRequest) returns (HelloReply) {}
 95}</textarea>
 96</form>
 97    <script>
 98      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
 99      var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {});
100    </script>
101
102    <p><strong>MIME types defined:</strong> <code>text/x-protobuf</code>.</p>
103
104  </article>