diff --git a/platform/platform-api/src/com/intellij/ui/HighlightableComponent.java b/platform/platform-api/src/com/intellij/ui/HighlightableComponent.java index 704be5062416..8fd4b8b47bc3 100644 --- a/platform/platform-api/src/com/intellij/ui/HighlightableComponent.java +++ b/platform/platform-api/src/com/intellij/ui/HighlightableComponent.java @@ -20,6 +20,7 @@ import com.intellij.openapi.editor.markup.EffectType; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.util.ui.UIUtil; import gnu.trove.TIntObjectHashMap; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; @@ -347,6 +348,29 @@ public class HighlightableComponent extends JComponent { return myIcon.getIconWidth() + myIconTextGap; } + @Nullable + public HighlightedRegion findRegionByX(int x) { + FontMetrics defFontMetrics = getFontMetrics(getFont()); + + int width = getTextOffset(); + if (width > x) return null; + + if (myText.length() != 0 && myHighlightedRegions.size() != 0) { + int endIndex = 0; + for (HighlightedRegion hRegion : myHighlightedRegions) { + width += defFontMetrics.stringWidth(myText.substring(endIndex, hRegion.startOffset)); + endIndex = hRegion.endOffset; + if (width > x) return null; + + String text = getRegionText(hRegion); + FontMetrics fontMetrics = myFontMetrics.get(hRegion.textAttributes.getFontType()); + width += fontMetrics.stringWidth(text); + if (width > x) return hRegion; + } + } + return null; + } + public Dimension getPreferredSize() { FontMetrics defFontMetrics = getFontMetrics(getFont()); @@ -359,24 +383,10 @@ public class HighlightableComponent extends JComponent { else{ int endIndex = 0; for (HighlightedRegion hRegion : myHighlightedRegions) { - - String text = myText.substring(endIndex, hRegion.startOffset); + width += defFontMetrics.stringWidth(myText.substring(endIndex, hRegion.startOffset)); endIndex = hRegion.endOffset; - width += defFontMetrics.stringWidth(text); - - if (hRegion.endOffset > myText.length()) { - if (hRegion.startOffset < myText.length()) { - text = myText.substring(hRegion.startOffset); - } - else { - text = ""; - } - } - else { - text = myText.substring(hRegion.startOffset, hRegion.endOffset); - } - + String text = getRegionText(hRegion); FontMetrics fontMetrics = myFontMetrics.get(hRegion.textAttributes.getFontType()); width += fontMetrics.stringWidth(text); } @@ -392,4 +402,20 @@ public class HighlightableComponent extends JComponent { return new Dimension(width + 2, height); } + + private String getRegionText(HighlightedRegion hRegion) { + String text; + if (hRegion.endOffset > myText.length()) { + if (hRegion.startOffset < myText.length()) { + text = myText.substring(hRegion.startOffset); + } + else { + text = ""; + } + } + else { + text = myText.substring(hRegion.startOffset, hRegion.endOffset); + } + return text; + } } diff --git a/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java b/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java index 7370ec885bee..93c9dc5e301d 100644 --- a/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java +++ b/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java @@ -51,7 +51,7 @@ public class HyperlinkLabel extends HighlightableComponent { myTextEffectColor = textEffectColor; enforceBackgroundOutsideText(textBackgroundColor); setHyperlinkText(text); - enableEvents(AWTEvent.MOUSE_EVENT_MASK); + enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); } public void addNotify() { @@ -60,7 +60,11 @@ public class HyperlinkLabel extends HighlightableComponent { } public void setHyperlinkText(String text) { - prepareText(text, myTextForegroundColor, myTextBackgroundColor, myTextEffectColor); + setHyperlinkText("", text, ""); + } + + public void setHyperlinkText(String beforeLinkText, String linkText, String afterLinkText) { + prepareText(beforeLinkText, linkText, afterLinkText); revalidate(); adjustSize(); } @@ -72,24 +76,34 @@ public class HyperlinkLabel extends HighlightableComponent { protected void processMouseEvent(MouseEvent e) { - if (e.getID() == MouseEvent.MOUSE_ENTERED) { - setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } - else if (e.getID() == MouseEvent.MOUSE_EXITED) { + if (e.getID() == MouseEvent.MOUSE_EXITED) { setCursor(Cursor.getDefaultCursor()); } - else if (UIUtil.isActionClick(e, MouseEvent.MOUSE_PRESSED)) { + else if (UIUtil.isActionClick(e, MouseEvent.MOUSE_PRESSED) && isOnLink(e.getX())) { fireHyperlinkEvent(); } super.processMouseEvent(e); } - private void prepareText(String text, final Color textForegroundColor, final Color textBackgroundColor, final Color textEffectColor) { + @Override + protected void processMouseMotionEvent(MouseEvent e) { + if (e.getID() == MouseEvent.MOUSE_MOVED) { + setCursor(isOnLink(e.getX()) ? Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) : Cursor.getDefaultCursor()); + } + super.processMouseMotionEvent(e); + } + + private boolean isOnLink(int x) { + return findRegionByX(x) != null; + } + + private void prepareText(String beforeLinkText, String linkText, String afterLinkText) { setFont(UIUtil.getLabelFont()); myHighlightedText = new HighlightedText(); - myHighlightedText.appendText(text, new TextAttributes( - textForegroundColor, textBackgroundColor, textEffectColor, EffectType.LINE_UNDERSCORE, Font.PLAIN - )); + myHighlightedText.appendText(beforeLinkText, null); + myHighlightedText.appendText(linkText, new TextAttributes(myTextForegroundColor, myTextBackgroundColor, myTextEffectColor, + EffectType.LINE_UNDERSCORE, Font.PLAIN)); + myHighlightedText.appendText(afterLinkText, null); myHighlightedText.applyToComponent(this); adjustSize(); } diff --git a/platform/platform-impl/src/com/intellij/application/options/PathMacrosCollector.java b/platform/platform-impl/src/com/intellij/application/options/PathMacrosCollector.java index cef04a6b2f3d..f7445cbb5e4e 100644 --- a/platform/platform-impl/src/com/intellij/application/options/PathMacrosCollector.java +++ b/platform/platform-impl/src/com/intellij/application/options/PathMacrosCollector.java @@ -38,7 +38,7 @@ public class PathMacrosCollector extends PathMacroMap { private final Matcher myMatcher; private static final Set ourSystemMacroNames = new HashSet( - Arrays.asList(PathMacrosImpl.APPLICATION_HOME_MACRO_NAME, PathMacrosImpl.MODULE_DIR_MACRO_NAME, PathMacrosImpl.PROJECT_DIR_MACRO_NAME)); + Arrays.asList(PathMacrosImpl.APPLICATION_HOME_MACRO_NAME, PathMacrosImpl.MODULE_DIR_MACRO_NAME, PathMacrosImpl.PROJECT_DIR_MACRO_NAME, PathMacrosImpl.USER_HOME_MACRO_NAME)); private static final String FILE_PROTOCOL = "file:"; private static final String JAR_PROTOCOL = "jar:"; diff --git a/platform/platform-impl/src/com/intellij/application/options/PathMacrosImpl.java b/platform/platform-impl/src/com/intellij/application/options/PathMacrosImpl.java index 295fb019d99d..5ee5ba774134 100644 --- a/platform/platform-impl/src/com/intellij/application/options/PathMacrosImpl.java +++ b/platform/platform-impl/src/com/intellij/application/options/PathMacrosImpl.java @@ -24,6 +24,8 @@ import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.NamedJDOMExternalizable; import com.intellij.openapi.util.RoamingTypeDisabled; import com.intellij.openapi.util.WriteExternalException; +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.util.SystemProperties; import com.intellij.util.concurrency.JBReentrantReadWriteLock; import com.intellij.util.concurrency.LockFactory; import com.intellij.util.containers.HashMap; @@ -60,6 +62,8 @@ public class PathMacrosImpl extends PathMacros implements ApplicationComponent, public static final String PROJECT_DIR_MACRO_NAME = "PROJECT_DIR"; @NonNls public static final String MODULE_DIR_MACRO_NAME = "MODULE_DIR"; + @NonNls + public static final String USER_HOME_MACRO_NAME = "USER_HOME"; private static final Set ourSystemMacroNames = new HashSet(); @NonNls public static final String EXT_FILE_NAME = "path.macros"; @@ -68,6 +72,7 @@ public class PathMacrosImpl extends PathMacros implements ApplicationComponent, ourSystemMacroNames.add(APPLICATION_HOME_MACRO_NAME); ourSystemMacroNames.add(PROJECT_DIR_MACRO_NAME); ourSystemMacroNames.add(MODULE_DIR_MACRO_NAME); + ourSystemMacroNames.add(USER_HOME_MACRO_NAME); } private static final Set ourToolsMacros = new HashSet(); @@ -112,6 +117,10 @@ public class PathMacrosImpl extends PathMacros implements ApplicationComponent, ourToolsMacros.add("Sourcepath"); } + public PathMacrosImpl() { + setMacro(USER_HOME_MACRO_NAME, FileUtil.toSystemIndependentName(SystemProperties.getUserHome())); + } + public static PathMacrosImpl getInstanceEx() { return (PathMacrosImpl)ApplicationManager.getApplication().getComponent(PathMacros.class); } diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java index 67e395eef768..8f17489d1067 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java @@ -254,8 +254,8 @@ public class FileBasedStorage extends XmlElementStorage { private Document processReadException(final Exception e) { myBlockSavingTheContent = isProjectOrModuleFile(); - LOG.warn(e); if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) { + LOG.warn(e); SwingUtilities.invokeLater(new Runnable(){ public void run() { JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java index 973f0a894935..edd4a4dd1382 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java @@ -1264,4 +1264,8 @@ public class FSRecords implements Disposable, Forceable { dataInputStream.close(); } } + + public static RuntimeException handleError(Throwable e) { + return DbConnection.handleError(e); + } } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFS.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFS.java index 827ced1fc840..0c4581402a15 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFS.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFS.java @@ -432,7 +432,12 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent { return content; } else { - return FileUtil.loadBytes(contentStream, (int)file.getLength()); + try { + return FileUtil.loadBytes(contentStream, (int)file.getLength()); + } + catch (IOException e) { + throw FSRecords.handleError(e); + } } } diff --git a/plugins/relaxng/test/org/intellij/plugins/relaxNG/RngHtml5CompletionTest.java b/plugins/relaxng/test/org/intellij/plugins/relaxNG/RngHtml5CompletionTest.java new file mode 100644 index 000000000000..f1c813eeeab6 --- /dev/null +++ b/plugins/relaxng/test/org/intellij/plugins/relaxNG/RngHtml5CompletionTest.java @@ -0,0 +1,106 @@ +/* + * Copyright 2000-2010 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.intellij.plugins.relaxNG; + +import com.intellij.javaee.ExternalResourceManagerEx; + +/** + * @author Eugene.Kudelevsky + */ +@SuppressWarnings({"JUnitTestClassNamingConvention"}) +public class RngHtml5CompletionTest extends HighlightingTestBase { + + @Override + public String getTestDataPath() { + return "completion"; + } + + @Override + protected void init() { + super.init(); + + final ExternalResourceManagerEx m = ExternalResourceManagerEx.getInstanceEx(); + m.addResource("http://www.w3.org/1999/xhtml/html5", toAbsolutePath("/highlighting/html5/html5.rnc")); + } + + public void testHtml5_1() throws Throwable { + doTestCompletion("html5_1"); + } + + public void testHtml5_2() throws Throwable { + doTestCompletion("html5_2"); + } + + public void testHtml5_3() throws Throwable { + doTestCompletion("html5_3"); + } + + public void testHtml5_4() throws Throwable { + doTestCompletion("html5_4"); + } + + public void testHtml5_5() throws Throwable { + doTestCompletion("html5_5"); + } + + public void testHtml5_6() throws Throwable { + doTestCompletion("html5_6"); + } + + public void testHtml5_7() throws Throwable { + doTestCompletion("html5_7"); + } + + public void testHtml5_8() throws Throwable { + doTestCompletion("html5_8"); + } + + public void testHtml5_9() throws Throwable { + doTestCompletion("html5_9"); + } + + public void testHtml5_10() throws Throwable { + doTestCompletion("html5_10"); + } + + public void testHtml5_11() throws Throwable { + doTestCompletion("html5_11"); + } + + public void testHtml5_12() throws Throwable { + doTestCompletion("html5_12"); + } + + public void testHtml5_13() throws Throwable { + doTestCompletion("html5_13"); + } + + public void testHtml5_14() throws Throwable { + doTestCompletion("html5_14"); + } + + public void testHtml5_15() throws Throwable { + doTestCompletion("html5_15"); + } + + public void testHtml5_16() throws Throwable { + doTestCompletion("html5_16"); + } + + public void testHtml5_17() throws Throwable { + doTestCompletion("html5_17"); + } +} diff --git a/plugins/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java b/plugins/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java index 2b215902d373..57f6a875f0c2 100644 --- a/plugins/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java +++ b/plugins/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java @@ -43,6 +43,7 @@ public class RngXmlHighlightingTest extends HighlightingTestBase { m.addResource("http://www.w3.org/1999/XSL/Format", toAbsolutePath("highlighting/rnc/fo/main.rnc")); m.addResource("http://docbook.org/ns/docbook", toAbsolutePath("highlighting/docbook.rng")); m.addResource("urn:intelliForm:AttachmentFilter", toAbsolutePath("highlighting/attachment-filter.rng")); + m.addResource("http://www.w3.org/1999/xhtml/html5", toAbsolutePath("highlighting/html5/xhtml5.rnc")); m.addIgnoredResource("urn:intelliForm:Spaces"); m.addIgnoredResource("http://www.w3.org/1999/xlink"); @@ -163,4 +164,12 @@ public class RngXmlHighlightingTest extends HighlightingTestBase { public void testDocBookSchema() throws Throwable { doHighlightingTest("docbook.rng"); } + + public void testHtml5() throws Throwable { + doHighlightingTest("Html5.xml"); + } + + public void testHtml5_2() throws Throwable { + doHighlightingTest("Html5_2.xml"); + } } diff --git a/plugins/relaxng/testData/completion/html5_1.xml b/plugins/relaxng/testData/completion/html5_1.xml new file mode 100644 index 000000000000..7ee0c6e457a1 --- /dev/null +++ b/plugins/relaxng/testData/completion/html5_1.xml @@ -0,0 +1,8 @@ + + + + > + + + + \ No newline at end of file diff --git a/plugins/relaxng/testData/completion/html5_10.xml b/plugins/relaxng/testData/completion/html5_10.xml new file mode 100644 index 000000000000..e6d1b0392a5b --- /dev/null +++ b/plugins/relaxng/testData/completion/html5_10.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/plugins/relaxng/testData/completion/html5_10_after.xml b/plugins/relaxng/testData/completion/html5_10_after.xml new file mode 100644 index 000000000000..a726437c7c26 --- /dev/null +++ b/plugins/relaxng/testData/completion/html5_10_after.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/plugins/relaxng/testData/completion/html5_11.xml b/plugins/relaxng/testData/completion/html5_11.xml new file mode 100644 index 000000000000..e0f811a6ba61 --- /dev/null +++ b/plugins/relaxng/testData/completion/html5_11.xml @@ -0,0 +1,8 @@ + + + + + + +Fork me on GitHub + + + + \ No newline at end of file diff --git a/plugins/relaxng/testData/highlighting/Html5_2.xml b/plugins/relaxng/testData/highlighting/Html5_2.xml new file mode 100644 index 000000000000..b35a6a544d5b --- /dev/null +++ b/plugins/relaxng/testData/highlighting/Html5_2.xml @@ -0,0 +1,90 @@ + + + + + + +HTML5 Demo: Canvas + + +
+
+

Canvas

+
+
+ + +
+Fork me on GitHub + + + + diff --git a/plugins/relaxng/testData/highlighting/html5/LICENSE b/plugins/relaxng/testData/highlighting/html5/LICENSE new file mode 100644 index 000000000000..fd1093cc1c60 --- /dev/null +++ b/plugins/relaxng/testData/highlighting/html5/LICENSE @@ -0,0 +1,23 @@ +The RELAX NG Schema for (X)HTML 5 is licensed under the MIT open source license. +The following legal notice applies to all files in this directory: + +Copyright (c) 2005-2007 Elika J. Etemad (fantasai) and Henri Sivonen (hsivonen) +Copyright (c) 2007-2008 Mozilla Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/plugins/relaxng/testData/highlighting/html5/applications.rnc b/plugins/relaxng/testData/highlighting/html5/applications.rnc new file mode 100644 index 000000000000..921a55133ff0 --- /dev/null +++ b/plugins/relaxng/testData/highlighting/html5/applications.rnc @@ -0,0 +1,260 @@ +datatypes w = "http://whattf.org/datatype-draft" + +# ##################################################################### +## RELAX NG Schema for HTML 5: Web Application Features # +# ##################################################################### + +## Additions to Common Attributes + + common.attrs.interact &= + ( common.attrs.contextmenu? + & common.attrs.contenteditable? + & common.attrs.draggable? + & common.attrs.hidden? + & common.attrs.spellcheck? + ) + + common.attrs.other &= common.attrs.interact + +## Context Menu: contextmenu + + common.attrs.contextmenu = + attribute contextmenu { + common.data.idref + } + +## Editable Content: contenteditable + + common.attrs.contenteditable = + attribute contenteditable { + w:string "true" | w:string "false" | w:string "" + } + +## Draggable Element: draggable + + common.attrs.draggable = + attribute draggable { + w:string "true" | w:string "false" + } + +## Hidden Element: hidden + + common.attrs.hidden = + attribute hidden { + w:string "hidden" | w:string "" + } + +## Spellchecking and grammar checking: spellcheck + + common.attrs.spellcheck = + attribute spellcheck{ + w:string "true" | w:string "false" | w:string "" + } + +## Application Cache: manifest + + html.attrs.manifest = + attribute manifest { + common.data.uri + } + + html.attrs &= html.attrs.manifest? + +## Progess Indicator: + + progress.elem = + element progress { progress.inner & progress.attrs } + progress.attrs = + ( common.attrs + & progress.attrs.value? + & progress.attrs.max? + ) + progress.attrs.value = + attribute value { + common.data.float.non-negative + } + progress.attrs.max = + attribute max { + common.data.float.positive + } + progress.inner = + ( common.inner.phrasing ) #Cannot enforce textContent format here + + common.elem.phrasing |= progress.elem + +## Command with an associated action: + + command.command.elem = + element command { command.inner & command.command.attrs } + command.command.attrs = + ( common.attrs + & command.command.attrs.type? + & common-command.attrs + ) + command.command.attrs.type = + attribute type { + w:string "command" + } + command.elem = command.command.elem + +## Selection of one item from a list of items: + + command.radio.elem = + element command { command.inner & command.radio.attrs } + command.radio.attrs = + ( common.attrs + & ( command.radio.attrs.type + & command.radio.attrs.radiogroup #REVISIT taking liberties here + & command.radio.attrs.checked? + ) + & common-command.attrs + ) + command.radio.attrs.type = + attribute type { + w:string "radio" + } + command.radio.attrs.radiogroup = + attribute radiogroup { + string #REVISIT need special format here? + } + command.radio.attrs.checked = + attribute checked { + w:string "checked" | w:string "" + } + command.elem |= command.radio.elem + +## State or option that can be toggled: + + command.checkbox.elem = + element command { command.inner & command.checkbox.attrs } + command.checkbox.attrs = + ( common.attrs + & ( command.checkbox.attrs.type + & command.checkbox.attrs.checked? + ) + & common-command.attrs + ) + command.checkbox.attrs.type = + attribute type { + w:string "checkbox" + } + command.checkbox.attrs.checked = + attribute checked { + w:string "checked" | w:string "" + } + command.elem |= command.checkbox.elem + + common-command.attrs = + ( command.attrs.label? + & command.attrs.icon? + & command.attrs.disabled? + ) + command.attrs.label = + attribute label { + string + } + command.attrs.icon = + attribute icon { + common.data.uri + } + command.attrs.disabled = + attribute disabled { + w:string "disabled" | w:string "" + } + command.inner = + ( empty ) + + common.elem.metadata |= + ( command.elem & nonHTMLizable ) + common.elem.phrasing |= command.elem + +## Menu: + + menu.elem = + element menu { menu.inner & menu.attrs } + menu.attrs = + ( common.attrs + & menu.attrs.type? + & menu.attrs.label? + ) + menu.attrs.type = + attribute type { + w:string "toolbar" | w:string "context" + } + menu.attrs.label = + attribute label { + string + } + menu.inner = + ( mli.elem* + | common.inner.flow + ) + + common.elem.flow |= menu.elem + # REVISIT allow nested menus + +## Menu Item:
  • + + mli.elem = + element li { mli.inner & mli.attrs } + mli.attrs = + ( common.attrs ) + mli.inner = + ( common.inner.flow ) + +## Canvas for Dynamic Graphics: + + canvas.elem.flow = + element canvas { canvas.inner.flow & canvas.attrs } + canvas.elem.phrasing = + element canvas { canvas.inner.phrasing & canvas.attrs } + canvas.attrs = + ( common.attrs + & canvas.attrs.height? + & canvas.attrs.width? + & common.attrs.aria? + ) + canvas.attrs.height = + attribute height { + common.data.integer.non-negative + } + canvas.attrs.width = + attribute width { + common.data.integer.non-negative + } + canvas.inner.flow = + ( common.inner.flow ) + canvas.inner.phrasing = + ( common.inner.phrasing ) + + common.elem.flow |= canvas.elem.flow + common.elem.phrasing |= canvas.elem.phrasing + +## Additional On-Demand Information:
    + + details.elem = + element details { details.inner & details.attrs } + details.attrs = + ( common.attrs + & details.attrs.open? + & common.attrs.aria.implicit.region? + ) + details.attrs.open = + attribute open { + w:string "open" | w:string "" + } + details.inner = + ( summary.elem? + , common.inner.flow + ) + + common.elem.flow |= details.elem + +## Caption/summary for details element: + + summary.elem = + element summary { summary.inner & summary.attrs } + summary.attrs = + ( common.attrs ) + summary.inner = + ( common.inner.phrasing ) diff --git a/plugins/relaxng/testData/highlighting/html5/aria.rnc b/plugins/relaxng/testData/highlighting/html5/aria.rnc new file mode 100644 index 000000000000..9721d36e0fdb --- /dev/null +++ b/plugins/relaxng/testData/highlighting/html5/aria.rnc @@ -0,0 +1,1017 @@ +# ##################################################################### +## RELAX NG Schema for HTML 5: Accessible Rich Internet Applications # +# ##################################################################### + +# ##################################################################### +## ARIA + +## Global states and properties + +aria.global = + ( aria.prop.atomic? + & aria.state.busy? + & aria.prop.controls? + & aria.prop.describedby? + & aria.state.disabled? + & aria.state.dropeffect? + & aria.prop.flowto? + & aria.state.grabbed? + & aria.prop.haspopup? + & aria.state.hidden? + & aria.state.invalid? + & aria.prop.label? + & aria.prop.labelledby? + & aria.prop.live? + & aria.prop.owns? + & aria.prop.relevant? + & aria.prop.required? + ) + +common.attrs.other &= aria.global? + +## States and Properties for Native Roles + +# common.attrs.aria.implicit.button |= +# ( aria.prop.controls? +# ) + +# common.attrs.aria.implicit.input |= +# ( aria.prop.controls? +# & aria.state.invalid? +# & aria.prop.required? +# ) + +common.attrs.aria.implicit.region |= + ( aria.state.expanded? +# & aria.prop.level? + ) + +common.attrs.aria.implicit.group |= + ( aria.state.expanded? + & aria.prop.activedescendant? + ) + +common.attrs.aria.implicit.th |= + ( aria.prop.sort? + & aria.prop.level? + & aria.state.expanded? + & aria.prop.readonly? + & aria.state.selected? + ) + +# common.attrs.aria.implicit.structure |= +# ( aria.prop.atomic? +# & aria.state.busy? +# & aria.prop.channel? +# & aria.prop.live? +# & aria.prop.relevant? +# ) + +# common.attrs.aria.implicit.link |= +# ( aria.prop.controls? +# & aria.state.disabled? +# ) + +common.attrs.aria.implicit.listitem |= + ( aria.prop.posinset? + & aria.prop.setsize? +# & aria.prop.atomic? + ) + +# common.attrs.aria.implicit.img |= +# ( aria.prop.atomic? +# & aria.state.busy? +# & aria.prop.channel? +# & aria.prop.controls? +# & aria.prop.live? +# & aria.prop.relevant? +# ) + +#common.attrs.aria.implicit.select |= +# ( aria.state.invalid? +# & aria.prop.required? +# & aria.prop.atomic? +# & aria.state.busy? +# & aria.prop.channel? +# & aria.prop.controls? +# & aria.prop.live? +# & aria.prop.relevant? +# ) + +# ##################################################################### +## States + +## busy + aria.state.busy = + attribute aria-busy + { string "true" + | string "false" #default + } + +## checked + aria.state.checked = + attribute aria-checked + { string "true" + | string "false" + | string "mixed" + | string "undefined" #default + } + +## disabled + aria.state.disabled = + attribute aria-disabled + { string "true" + | string "false" #default + } + +## dropeffect + aria.state.dropeffect = + attribute aria-dropeffect + { token "none" #default + | token "popup" + | token "execute" + | list + { ( string "copy" ) + , ( string "execute" )? + } + | list + { ( string "move" ) + , ( string "execute" )? + } + | list + { ( string "reference" ) + , ( string "execute" )? + } + | list + { ( string "execute" ) + , ( string "copy" ) + } + | list + { ( string "execute" ) + , ( string "move" ) + } + | list + { ( string "execute" ) + , ( string "reference" ) + } + } + +## expanded + aria.state.expanded = + attribute aria-expanded + { string "true" + | string "false" + | string "undefined" #default + } + +## grabbed + aria.state.grabbed = + attribute aria-grabbed + { string "true" + | string "false" + | string "undefined" #default + } + +## hidden + aria.state.hidden = + attribute aria-hidden + { string "true" + | string "false" #default + } + +## invalid + aria.state.invalid = + attribute aria-invalid + { string "true" + | string "false" #default + | string "grammar" + | string "spelling" + } + +## pressed + aria.state.pressed = + attribute aria-pressed + { string "true" + | string "false" + | string "mixed" + | string "undefined" #default + } + +## selected + aria.state.selected = + attribute aria-selected + { string "true" + | string "false" + | string "undefined" #default + } + + + +# ##################################################################### +## Properties + +## activedescendant + aria.prop.activedescendant = + attribute aria-activedescendant { + common.data.idref #REVISIT add Schematron check + } + +## atomic + aria.prop.atomic = + attribute aria-atomic + { string "true" + | string "false" #default + } + +## autocomplete + aria.prop.autocomplete = + attribute aria-autocomplete + { string "inline" + | string "list" + | string "both" + | string "none" #default + } + +## controls + aria.prop.controls = + attribute aria-controls { + common.data.idrefs #REVISIT add Schematron check + } + +## describedby + aria.prop.describedby = + attribute aria-describedby { + common.data.idrefs #REVISIT add Schematron check + } + +## flowto + aria.prop.flowto = + attribute aria-flowto { + common.data.idrefs #REVISIT add Schematron check + } + +## haspopup + aria.prop.haspopup = + attribute aria-haspopup + { string "true" #REVISIT check owns or descendant + | string "false" #default + } + +## label + aria.prop.label = + attribute aria-label { + string + } + +## labelledby + aria.prop.labelledby = + attribute aria-labelledby { + common.data.idrefs #REVISIT add Schematron check + } + +## level + aria.prop.level = + attribute aria-level { + common.data.integer.positive + } + +## live + aria.prop.live = + attribute aria-live + { string "off" #default + | string "polite" + | string "assertive" + } + +## multiline + aria.prop.multiline = + attribute aria-multiline + { string "true" + | string "false" #default + } + +## multiselectable + aria.prop.multiselectable = + attribute aria-multiselectable + { string "true" + | string "false" #default + } + +## owns + aria.prop.owns = + attribute aria-owns { + common.data.idrefs #REVISIT add Schematron check + } + +## posinset + aria.prop.posinset = + attribute aria-posinset { + common.data.integer.positive + } + +## readonly + aria.prop.readonly = + attribute aria-readonly + { string "true" + | string "false" #default + } + +## relevant + aria.prop.relevant = + attribute aria-relevant + { token "all" + | list + { ( string "additions" ) + , ( string "removals" )? + , ( string "text" )? + } + | list + { ( string "additions" ) + , ( string "text" )? + , ( string "removals" )? + } + | list + { ( string "removals" ) + , ( string "additions" )? + , ( string "text" )? + } + | list + { ( string "removals" ) + , ( string "text" )? + , ( string "additions" )? + } + | list + { ( string "text" ) + , ( string "additions" )? + , ( string "removals" )? + } + | list + { ( string "text" ) + , ( string "removals" )? + , ( string "additions" )? + } + } + +## required + aria.prop.required = + attribute aria-required + { string "true" + | string "false" #default + } + +## setsize + aria.prop.setsize = + attribute aria-setsize { + common.data.integer.non-negative + } + +## sort + aria.prop.sort = + attribute aria-sort + { string "ascending" + | string "descending" + | string "none" #default + | string "other" + } + +## valuemax + aria.prop.valuemax = + attribute aria-valuemax { + common.data.float #REVISIT + } + +## valuemin + aria.prop.valuemin = + attribute aria-valuemin { + common.data.float #REVISIT + } + +## valuenow + aria.prop.valuenow = + attribute aria-valuenow { + common.data.float #REVISIT + } + +## valuetext + aria.prop.valuetext = + attribute aria-valuetext { + string + } + +# ##################################################################### +## Roles + +## alert + aria.alert = + ( aria.role.alert + & aria.state.expanded? + ) + aria.role.alert = + attribute role { string "alert" } + + common.attrs.aria |= aria.alert + +## alertdialog + aria.alertdialog = + ( aria.role.alertdialog + & aria.state.expanded? + ) + aria.role.alertdialog = + attribute role { string "alertdialog" } + + common.attrs.aria |= aria.alertdialog + +## application + aria.application = + ( aria.role.application + & aria.state.expanded? + ) + aria.role.application = + attribute role { string "application" } + + common.attrs.aria |= aria.application + common.attrs.aria.landmark.application |= aria.application + +## article + aria.article = + ( aria.role.article + & aria.state.expanded? + ) + aria.role.article = + attribute role { string "article" } + + common.attrs.aria |= aria.article + common.attrs.aria.landmark.article |= aria.article + +## banner + aria.banner = + ( aria.role.banner + & aria.state.expanded? + ) + aria.role.banner = + attribute role { string "banner" } + + common.attrs.aria |= aria.banner + common.attrs.aria.landmark.banner |= aria.banner + +## button + aria.button = + ( aria.role.button + & aria.state.pressed? # not inherited + ) + aria.role.button = + attribute role { string "button" } + + common.attrs.aria |= aria.button + +## checkbox + aria.checkbox = + ( aria.role.checkbox + & aria.state.checked #required! + ) + aria.role.checkbox = + attribute role { string "checkbox" } + + common.attrs.aria |= aria.checkbox + +# XXX columnheader + +## combobox + aria.combobox = + ( aria.role.combobox + & aria.prop.activedescendant? + & aria.state.expanded #required! + ) + aria.role.combobox = + attribute role { string "combobox" } + + common.attrs.aria |= aria.combobox + +## complementary + aria.complementary = + ( aria.role.complementary + & aria.state.expanded? + ) + aria.role.complementary = + attribute role { string "complementary" } + + common.attrs.aria |= aria.complementary + common.attrs.aria.landmark.complementary |= aria.complementary + +## contentinfo + aria.contentinfo = + ( aria.role.contentinfo + & aria.state.expanded? + ) + aria.role.contentinfo = + attribute role { string "contentinfo" } + + common.attrs.aria |= aria.contentinfo + common.attrs.aria.landmark.contentinfo |= aria.contentinfo + +## definition + aria.definition = + ( aria.role.definition + & aria.state.expanded? + ) + aria.role.definition = + attribute role { string "definition" } + + common.attrs.aria |= aria.definition + +## dialog + aria.dialog = + ( aria.role.dialog + & aria.state.expanded? + ) + aria.role.dialog = + attribute role { string "dialog" } + + common.attrs.aria |= aria.dialog + +## directory + aria.directory = + ( aria.role.directory + & aria.state.expanded? + ) + aria.role.directory = + attribute role { string "directory" } + + common.attrs.aria |= aria.directory + +## document + aria.document = + ( aria.role.document + & aria.state.expanded? + ) + aria.role.document = + attribute role { string "document" } + + common.attrs.aria |= aria.document + common.attrs.aria.landmark.document |= aria.document + +## grid + aria.grid = + ( aria.role.grid + & aria.prop.level? # not inherited + & aria.prop.multiselectable? # not inherited + & aria.prop.readonly? # not inherited + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.grid = + attribute role { string "grid" } + + common.attrs.aria |= aria.grid + +## gridcell + aria.gridcell = + ( aria.role.gridcell + & aria.prop.level? # net inherited + & aria.prop.readonly? # not inherited + & aria.state.selected? # not inherited + & aria.state.expanded? + ) + aria.role.gridcell = + attribute role { string "gridcell" } + + common.attrs.aria |= aria.gridcell + +## group + aria.group = + ( aria.role.group + & aria.prop.activedescendant? # not inherited + & aria.state.expanded? # not inherited + ) + aria.role.group = + attribute role { string "group" } + + common.attrs.aria |= aria.group + +## XXX heading + +## img + aria.img = + ( aria.role.img + & aria.state.expanded? + ) + aria.role.img = + attribute role { string "img" } + + common.attrs.aria |= aria.img + +## link + aria.link = + ( aria.role.link + ) + aria.role.link = + attribute role { string "link" } + + common.attrs.aria |= aria.link + +## list + aria.list = + ( aria.role.list + & aria.state.expanded? + ) + aria.role.list = + attribute role { string "list" } + + common.attrs.aria |= aria.list + +## listbox + aria.listbox = + ( aria.role.listbox + & aria.prop.multiselectable? # not inherited + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.listbox = + attribute role { string "listbox" } + + common.attrs.aria |= aria.listbox + +## listitem + aria.listitem = + ( aria.role.listitem + & aria.prop.posinset? # not inherited + & aria.prop.setsize? # not inherited + & aria.prop.level? # not inherited + & aria.state.expanded? + ) + aria.role.listitem = + attribute role { string "listitem" } + + common.attrs.aria |= aria.listitem + +## log + aria.log = + ( aria.role.log + & aria.state.expanded? + ) + aria.role.log = + attribute role { string "log" } + + common.attrs.aria |= aria.log + +## main + aria.main = + ( aria.role.main + & aria.state.expanded? + ) + aria.role.main = + attribute role { string "main" } + + common.attrs.aria |= aria.main + common.attrs.aria.landmark.main |= aria.main + +## marquee + aria.marquee = + ( aria.role.marquee + & aria.state.expanded? + ) + aria.role.marquee = + attribute role { string "marquee" } + + common.attrs.aria |= aria.marquee + +## math + aria.math = + ( aria.role.math + & aria.state.expanded? + ) + aria.role.math = + attribute role { string "math" } + + common.attrs.aria |= aria.math + +## menu + aria.menu = + ( aria.role.menu + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.menu = + attribute role { string "menu" } + + common.attrs.aria |= aria.menu + +## menubar + aria.menubar = + ( aria.role.menubar + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.menubar = + attribute role { string "menubar" } + + common.attrs.aria |= aria.menubar + +## menuitem + aria.menuitem = + ( aria.role.menuitem ) + aria.role.menuitem = + attribute role { string "menuitem" } + + common.attrs.aria |= aria.menuitem + +## menuitemcheckbox + aria.menuitemcheckbox = + ( aria.role.menuitemcheckbox + & aria.state.checked #required + ) + aria.role.menuitemcheckbox = + attribute role { string "menuitemcheckbox" } + + common.attrs.aria |= aria.menuitemcheckbox + +## menuitemradio + aria.menuitemradio = + ( aria.role.menuitemradio + & aria.state.checked #required + & aria.state.selected? + ) + aria.role.menuitemradio = + attribute role { string "menuitemradio" } + + common.attrs.aria |= aria.menuitemradio + +## navigation + aria.navigation = + ( aria.role.navigation + & aria.state.expanded? + ) + aria.role.navigation = + attribute role { string "navigation" } + + common.attrs.aria |= aria.navigation + common.attrs.aria.landmark.navigation |= aria.navigation + +## note + aria.note = + ( aria.role.note + & aria.state.expanded? + ) + aria.role.note = + attribute role { string "note" } + + common.attrs.aria |= aria.note + common.attrs.aria.landmark.note |= aria.note + +## option + aria.option = + ( aria.role.option + & aria.state.checked? # not inherited + & aria.state.selected? # not inherited + ) + aria.role.option = + attribute role { string "option" } + + common.attrs.aria |= aria.option + + +## presentation + aria.presentation = + ( aria.role.presentation + & aria.state.expanded? + ) + aria.role.presentation = + attribute role { string "presentation" } + + common.attrs.aria |= aria.presentation + +## progressbar + aria.progressbar = + ( aria.role.progressbar + & aria.prop.valuemax? # not inherited + & aria.prop.valuemin? # not inherited + & aria.prop.valuenow? # not inherited + & aria.prop.valuetext? # not inherited + ) + aria.role.progressbar = + attribute role { string "progressbar" } + + common.attrs.aria |= aria.progressbar + +## radio + aria.radio = + ( aria.role.radio + & aria.state.checked #required! + & aria.state.selected? + ) + aria.role.radio = + attribute role { string "radio" } + + common.attrs.aria |= aria.radio + +## radiogroup + aria.radiogroup = + ( aria.role.radiogroup + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.radiogroup = + attribute role { string "radiogroup" } + + common.attrs.aria |= aria.radiogroup + +## region + aria.region = + ( aria.role.region + & aria.state.expanded? + ) + aria.role.region = + attribute role { string "region" } + + common.attrs.aria |= aria.region + +## row + aria.row = + ( aria.role.row + & aria.prop.level? # not inherited + & aria.state.selected? # not inherited + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.row = + attribute role { string "row" } + + common.attrs.aria |= aria.row + +# XXX rowheader + +## search + aria.search = + ( aria.role.search + & aria.state.expanded? + ) + aria.role.search = + attribute role { string "search" } + + common.attrs.aria |= aria.search + common.attrs.aria.landmark.search |= aria.search + +## separator + aria.separator = + ( aria.role.separator + & aria.state.expanded? + ) + aria.role.separator = + attribute role { string "separator" } + + common.attrs.aria |= aria.separator + +## slider + aria.slider = + ( aria.role.slider + & aria.prop.valuemax + & aria.prop.valuemin + & aria.prop.valuenow + & aria.prop.valuetext + ) + aria.role.slider = + attribute role { string "slider" } + + common.attrs.aria |= aria.slider + +## spinbutton + aria.spinbutton = + ( aria.role.spinbutton + & aria.prop.activedescendant? + & aria.prop.valuemax + & aria.prop.valuemin + & aria.prop.valuenow + & aria.prop.valuetext + ) + aria.role.spinbutton = + attribute role { string "spinbutton" } + + common.attrs.aria |= aria.spinbutton + +## status + aria.status = + ( aria.role.status + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.status = + attribute role { string "status" } + + common.attrs.aria |= aria.status + +## tab + aria.tab = + ( aria.role.tab + & aria.state.selected? + & aria.state.expanded? + ) + aria.role.tab = + attribute role { string "tab" } + + common.attrs.aria |= aria.tab + +## tablist + aria.tablist = + ( aria.role.tablist + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.tablist = + attribute role { string "tablist" } + +## tabpanel + aria.tabpanel = + ( aria.role.tabpanel + & aria.state.expanded? + ) + aria.role.tabpanel = + attribute role { string "tabpanel" } + + common.attrs.aria |= aria.tabpanel + +## textbox + aria.textbox = + ( aria.role.textbox + & aria.prop.autocomplete? # not inherited + & aria.prop.multiline? # not inherited + & aria.prop.readonly? # not inherited + ) + aria.role.textbox = + attribute role { string "textbox" } + + common.attrs.aria |= aria.textbox + +## timer + aria.timer = + ( aria.role.timer + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.timer = + attribute role { string "timer" } + + common.attrs.aria |= aria.timer + +## toolbar + aria.toolbar = + ( aria.role.toolbar + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.toolbar = + attribute role { string "toolbar" } + + common.attrs.aria |= aria.toolbar + +## tooltip + aria.tooltip = + ( aria.role.tooltip + & aria.state.expanded? + ) + aria.role.tooltip = + attribute role { string "tooltip" } + + common.attrs.aria |= aria.tooltip + +## tree + aria.tree = + ( aria.role.tree + & aria.prop.multiselectable? # not inherited + & aria.prop.activedescendant? + & aria.state.expanded? + ) + aria.role.tree = + attribute role { string "tree" } + + common.attrs.aria |= aria.tree + +## treegrid + aria.treegrid = + ( aria.role.treegrid + & aria.prop.activedescendant? + & aria.state.expanded? + & aria.prop.level? + & aria.prop.multiselectable? + & aria.prop.readonly? + ) + aria.role.treegrid = + attribute role { string "treegrid" } + + common.attrs.aria |= aria.treegrid + +## treeitem + aria.treeitem = + ( aria.role.treeitem + & aria.state.checked? + & aria.state.expanded? + & aria.prop.level? + & aria.prop.posinset? + & aria.state.selected? + & aria.prop.setsize? + ) + aria.role.treeitem = + attribute role { string "treeitem" } + + common.attrs.aria |= aria.treeitem + + diff --git a/plugins/relaxng/testData/highlighting/html5/block.rnc b/plugins/relaxng/testData/highlighting/html5/block.rnc new file mode 100644 index 000000000000..8bfb86abedee --- /dev/null +++ b/plugins/relaxng/testData/highlighting/html5/block.rnc @@ -0,0 +1,196 @@ +datatypes w = "http://whattf.org/datatype-draft" + +# ##################################################################### +## RELAX NG Schema for HTML 5: Basic Prose Markup # +# ##################################################################### + +# ##################################################################### +## Paragraph-Level + +## Paragraph:

    + + p.elem = + element p { p.inner & p.attrs } + p.attrs = + ( common.attrs + & common.attrs.aria? + ) + p.inner = + ( common.inner.phrasing ) # REVISIT lists in span? + + common.elem.flow |= p.elem + +## Hint Transition:


    + + hr.elem = + element hr { hr.inner & hr.attrs } + hr.attrs = + ( common.attrs ) + hr.inner = + ( empty ) + + common.elem.flow |= hr.elem + +# ##################################################################### +## Preformatting Blocks + +## Preformatted Text:
    +
    +	pre.elem =
    +		element pre { pre.inner & pre.attrs }
    +	pre.attrs =
    +		(	common.attrs
    +		&	common.attrs.aria?
    +		)
    +	pre.inner =
    +		( common.inner.phrasing )
    +
    +	common.elem.flow |= pre.elem
    +
    +# #####################################################################
    +## Simple Lists
    +
    +## Unordered List: 
      + + ul.elem = + element ul { ul.inner & ul.attrs } + ul.attrs = + ( common.attrs + & ( common.attrs.aria + | common.attrs.aria.implicit.region + )? + ) + ul.inner = + ( li.elem* ) + + common.elem.flow |= ul.elem + +## Unordered List Item:
    • + + li.elem = + element li { li.inner & li.attrs } + li.attrs = + ( common.attrs + & ( common.attrs.aria + | common.attrs.aria.implicit.listitem + )? + ) + li.inner = + ( common.inner.flow ) + +## Ordered List:
        + + ol.elem = + element ol { ol.inner & ol.attrs } + ol.attrs = + ( common.attrs + & ol.attrs.start? + & ol.attrs.reversed? + & ( common.attrs.aria + | common.attrs.aria.implicit.region + )? + ) + ol.attrs.start = + attribute start { + common.data.integer + } + ol.attrs.reversed = + attribute reversed { + w:string "reversed" | w:string "" + } + ol.inner = + ( oli.elem* ) + + common.elem.flow |= ol.elem + +## Ordered List Item:
      1. + + oli.elem = + element li { oli.inner & oli.attrs } + oli.attrs = + ( common.attrs + & oli.attrs.value? + & ( common.attrs.aria + | common.attrs.aria.implicit.listitem + )? + ) + oli.attrs.value = + attribute value { + common.data.integer + } + oli.inner = + ( common.inner.flow ) + +# ##################################################################### +## Definition Lists + +## Definition List:
        + + dl.elem = + element dl { dl.inner & dl.attrs } + dl.attrs = + ( common.attrs + & common.attrs.aria? + ) + dl.inner = + ( ( dt.elem+ + , dd.elem+ + )* + ) + + common.elem.flow |= dl.elem + +## Definition Term:
        + + dt.elem = + element dt { dt.inner & dt.attrs } + dt.attrs = + ( common.attrs + & common.attrs.aria? + ) + dt.inner = + ( common.inner.phrasing ) + +## Definition Description:
        + + dd.elem = + element dd { dd.inner & dd.attrs } + dd.elem.phrasing = + element dd { dd.inner.phrasing & dd.attrs } + dd.attrs = + ( common.attrs + & common.attrs.aria? + ) + dd.inner = + ( common.inner.flow ) + dd.inner.phrasing = + ( common.inner.phrasing ) + +# ##################################################################### +## Miscellaneous Elements + +## Generic Container:
        + + div.elem = + element div { div.inner & div.attrs } + div.attrs = + ( common.attrs + & common.attrs.aria? + ) + div.inner = + ( style.elem.scoped* + , common.inner.flow + ) + + common.elem.flow |= div.elem + +## Title or Explanatory Caption: + + legend.elem = + element legend { legend.inner & legend.attrs } + legend.attrs = + ( common.attrs + & common.attrs.aria.implicit.region? + ) + legend.inner = + ( common.inner.phrasing ) diff --git a/plugins/relaxng/testData/highlighting/html5/common.rnc b/plugins/relaxng/testData/highlighting/html5/common.rnc new file mode 100644 index 000000000000..dada4b68d50b --- /dev/null +++ b/plugins/relaxng/testData/highlighting/html5/common.rnc @@ -0,0 +1,393 @@ +datatypes w = "http://whattf.org/datatype-draft" + +# ##################################################################### +## RELAX NG Schema for HTML 5: Common Definitions # +# ##################################################################### + + +# ##################################################################### +## Language Parameters - redefine in inclusion block as necessary # +# ##################################################################### + +## HTML vs. XHTML restrictions + + XMLonly = empty + HTMLonly = notAllowed + +## HTML 4 Compatibility - set to notAllowed to disallow markup introduced in HTML 5 +# (This only affects mixed-version modules; wholly HTML5 +# modules should simply be left out of the inclusion list.) + + v5only = empty + +## HTML Compatibility Switches - set to notAllowed to disallow + + ## XML features that can't be roundtripped HTML <-> XHTML + # (xml:base on elements other than ) + nonRoundtrippable = empty + + ## XML features that can't be serialized as HTML + nonHTMLizable = empty + +# ##################################################################### +## Wildcards # +# ##################################################################### + +## Any attribute from any namespace + + common.attr.anything = + attribute * { text }* + +## Any element from any namespace + + common.elem.anything = + element * { common.inner.anything & common.attr.anything } + +## Any content from any namespace + + common.inner.anything = + ( text + & common.elem.anything* + ) + +# ##################################################################### +## Common Element Classes # +# ##################################################################### + +## Metadata Elements + + common.elem.metadata = + ( notAllowed ) + +## Phrase Elements + + common.elem.phrasing = + ( notAllowed ) + +## Prose Elements + + common.elem.flow = + ( common.elem.phrasing ) + + +# ##################################################################### +## Common Content Models # +# ##################################################################### + +## Metadata Content + + common.inner.metadata = + ( common.elem.metadata* ) + +## Phrase Content + + common.inner.phrasing = + ( text & common.elem.phrasing* ) + +## Prose Content + + common.inner.flow = + ( text & common.elem.flow* ) # REVISIT