]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - schemas/rakka-page-1.0.rng
merge branch origin/master
[Rakka.git] / schemas / rakka-page-1.0.rng
index 3fefe6ca38bff6a5fa7971f4405bf07b4fbae2d1..27d3cfa8dbd9b0a556aa3d5f74cd2f4cffc775e6 100644 (file)
@@ -1,17 +1,71 @@
 <?xml version="1.0" encoding="utf-8"?>
-<element name="page"
-         ns="http://cielonegro.org/schema/Rakka/Page/1.0"
+<grammar ns="http://cielonegro.org/schema/Rakka/Page/1.0"
          datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
          xmlns="http://relaxng.org/ns/structure/1.0">
 
-  <choice>
-    <!-- リダイレクトの場合 -->
+  <start>
+    <element name="page">
+      <optional>
+        <element name="updateInfo">
+          <!-- 旧リビジョン -->
+          <attribute name="oldRevision">
+            <data type="decimal">
+              <param name="minInclusive">0</param>
+              <param name="fractionDigits">0</param>
+            </data>
+          </attribute>
+
+          <!-- ページ移動 -->
+          <optional>
+            <element name="move">
+              <attribute name="from">
+                <ref name="pageName" />
+              </attribute>
+            </element>
+          </optional>
+        </element>
+
+        <!-- 猶、更新時に type 屬性を空欄にすると自動判別される。但し
+             binaryData の場合のみ許される。 -->
+      </optional>
+
+      <optional>
+        <!-- ログインしてゐないユーザーの編集を禁止するフラグ -->
+        <attribute name="isLocked">
+          <ref name="boolean" />
+        </attribute>
+      </optional>
+
+      <choice>
+        <!-- リダイレクトの場合 -->
+        <ref name="redirection" />
+    
+        <!-- リダイレクトでない場合 -->
+        <ref name="entity" />
+      </choice>
+    </element>
+  </start>
+
+  <define name="boolean">
+    <choice>
+      <value>yes</value>
+      <value>no</value>
+    </choice>
+  </define>
+
+  <define name="pageName">
+    <data type="string">
+      <param name="pattern">[^ a-z.|#\[\]][^ .|#\[\]]*</param>
+    </data>
+  </define>
+
+  <define name="redirection">
     <attribute name="redirect">
-      <!-- ページ名 -->
-      <data type="anyURI" />
+      <ref name="pageName" />
     </attribute>
-    
-    <!-- リダイレクトでない場合 -->
+  </define>
+
+  <define name="entity">
     <group>
       <attribute name="type">
         <!-- MIME Type -->
 
       <optional>
         <attribute name="lang">
-          <text />
+          <data type="language" />
         </attribute>
       </optional>
 
       <optional>
         <!-- text/css でなければ無視される -->
         <attribute name="isTheme">
-          <!-- これは HXT が對應してゐない。
-               <data type="string">
-               <param name="pattern">yes|no</param>
-               </data>
-          -->
-          <text />
+          <ref name="boolean" />
         </attribute>
       </optional>
 
       <optional>
         <!-- text/x-rakka でなければ無視される -->
         <attribute name="isFeed">
-          <!-- yes/no -->
-          <text />
-        </attribute>
-      </optional>
-
-      <optional>
-        <!-- ログインしてゐないユーザーの編集を禁止するフラグ -->
-        <attribute name="isLocked">
-          <!-- yes/no -->
-          <text />
-        </attribute>
-      </optional>
-
-      <optional>
-        <!-- 更新履歴や RSS から削除されるフラグ -->
-        <attribute name="isBoring">
-          <!-- yes/no -->
-          <text />
+          <ref name="boolean" />
         </attribute>
       </optional>
 
             <zeroOrMore>
               <element name="link">
                 <attribute name="lang">
-                  <!-- RFC 4646 言語コード -->
-                  <text />
+                  <data type="language" />
                 </attribute>
                 <attribute name="page">
-                  <!-- ページ名 -->
-                  <data type="anyURI" />
+                  <ref name="pageName" />
                 </attribute>
               </element>
             </zeroOrMore>
         </element>
 
         <element name="binaryData">
-          <!-- これは HXT が對應してゐない。
-               <data type="base64Binary" />
-          -->
-          <text />
+          <data type="base64Binary" />
         </element>
       </choice>
     </group>
-  </choice>
-</element>
+  </define>
+</grammar>