This is an automated email from the ASF dual-hosted git repository. harbs pushed a commit to branch feature/markdown in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit bccc0a87590180a58984d1630f55be4c4af2b510 Author: Harbs <[email protected]> AuthorDate: Sun Dec 12 16:42:59 2021 +0200 First commit of markdown classes --- frameworks/js/projects/MarkdownJS/build.xml | 136 ++++++++++++ .../src/main/config/compile-js-config.xml | 103 +++++++++ .../projects/MarkdownJS/src/test/royale/build.xml | 242 +++++++++++++++++++++ frameworks/projects/Markdown/asconfig.json | 34 +++ frameworks/projects/Markdown/build.xml | 177 +++++++++++++++ frameworks/projects/Markdown/pom.xml | 119 ++++++++++ .../src/main/config/compile-swf-config.xml | 96 ++++++++ .../Markdown/src/main/resources/basic-manifest.xml | 23 ++ .../Markdown/src/main/resources/defaults.css | 19 ++ .../Markdown/src/main/royale/MarkdownClasses.as | 33 +++ .../org/apache/royale/markdown/BlockParser.as | 28 +++ .../org/apache/royale/markdown/BlockState.as | 28 +++ .../org/apache/royale/markdown/CoreParser.as | 31 +++ .../royale/org/apache/royale/markdown/CoreState.as | 28 +++ .../org/apache/royale/markdown/Environment.as | 28 +++ .../royale/org/apache/royale/markdown/IParser.as | 25 +++ .../royale/org/apache/royale/markdown/IState.as | 25 +++ .../org/apache/royale/markdown/InlineParser.as | 28 +++ .../org/apache/royale/markdown/InlineState.as | 28 +++ .../org/apache/royale/markdown/MarkdownParser.as | 44 ++++ .../royale/FlexUnitRoyaleApplication-config.xml | 114 ++++++++++ .../src/test/royale/FlexUnitRoyaleApplication.mxml | 98 +++++++++ .../projects/Markdown/src/test/royale/build.xml | 116 ++++++++++ .../test/royale/flexUnitTests/MarkdownTester.as | 39 ++++ .../markdown/URLVariablesTesterTest.as | 129 +++++++++++ 25 files changed, 1771 insertions(+) diff --git a/frameworks/js/projects/MarkdownJS/build.xml b/frameworks/js/projects/MarkdownJS/build.xml new file mode 100644 index 0000000..168948c --- /dev/null +++ b/frameworks/js/projects/MarkdownJS/build.xml @@ -0,0 +1,136 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> + + +<project name="MarkdownJS" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../../.."/> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/local.properties"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + + <property name="target.name" value="${ant.project.name}.swc" /> + <tstamp> + <format property="royale.swc-date" pattern="MM/dd/yy HH:mm Z"/> + </tstamp> + <echo>swc-date is ${royale.swc-date}</echo> + + <echo file="${basedir}/${target.name}.properties">target.name.nojs=${ant.project.name}</echo> + <replaceregexp file="${basedir}/${target.name}.properties" match="(.*)JS$" replace="\1" flags="m" /> + <property file="${basedir}/${target.name}.properties"/> + <delete file="${basedir}/${target.name}.properties"/> + + <target name="main" depends="clean,check-compiler,compile" description="Full build of ${ant.project.name}.swc"> + </target> + + <target name="check-for-tests" > + <condition property="skip-tests" > + <not> + <available file="${basedir}/src/test/royale/build.xml" /> + </not> + </condition> + </target> + + <target name="test" depends="check-for-tests,check-compiler" unless="skip-tests"> + <ant dir="src/test/royale" /> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${ROYALE_HOME}/frameworks/js/libs"> + <include name="${target.name}"/> + </fileset> + </delete> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${basedir}/target"> + <include name="**/**"/> + </fileset> + </delete> + <antcall target="clean-tests" /> + </target> + + <target name="clean-tests" depends="check-for-tests" unless="skip-tests"> + <ant dir="src/test/royale" target="clean"/> + </target> + + <target name="compile" depends="check-compiler"> + <echo message="Cross-compiling ${target.name}"/> + <echo message="ROYALE_COMPILER_HOME: ${ROYALE_COMPILER_HOME}"/> + <mkdir dir="${basedir}/target/generated-sources/royale"/> + <java jar="${ROYALE_COMPILER_HOME}/lib/compc.jar" fork="true" > + <jvmarg value="-Xmx384m" /> + <jvmarg value="-Dsun.io.useCanonCaches=false" /> + <jvmarg value="-Droyalelib=${ROYALE_HOME}/frameworks" /> + <arg value="+royalelib=${ROYALE_HOME}/frameworks" /> + <arg value="-compiler.strict-xml=true" /> + <arg value="-compiler.targets=SWF,JSRoyale" /> + <arg line="-metadata.date="${royale.swc-date}"" /> + <arg line="-metadata.dateFormat="MM/dd/yy HH:mm Z"" /> + <arg line="-swf-debugfile-alias="/org/apache/royale/${release.version}"" /> + <arg value="-output=${basedir}/target/${target.name}" /> + <arg value="-load-config=${ROYALE_HOME}/frameworks/js-config.xml" /> + <arg value="-load-config+=${basedir}/src/main/config/compile-js-config.xml" /> + </java> + <copy file="${basedir}/target/${target.name}" tofile="${ROYALE_HOME}/frameworks/js/libs/${target.name}" /> + </target> + + <target name="copy-js" > + <mkdir dir="${ROYALE_HOME}/frameworks/js/generated-sources"/> + <copy todir="${ROYALE_HOME}/frameworks/js/generated-sources"> + <fileset dir="${basedir}/target/generated-sources/royale"> + <include name="**/**" /> + </fileset> + </copy> + </target> + + <target name="check-compiler" depends="check-compiler-home,check-transpiler-home"> + <path id="lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> + </path> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + </target> + + <target name="check-compiler-home" + description="Set ROYALE_SWF_COMPILER_HOME to point at the compiler."> + + <available file="${ROYALE_HOME}/lib/compiler-mxmlc.jar" + type="file" + property="ROYALE_SWF_COMPILER_HOME" + value="${ROYALE_HOME}"/> + + <fail message="ROYALE_SWF_COMPILER_HOME must be set to a folder with a lib sub-folder containing compiler-mxmlc.jar such as the compiler folder in royale-compiler repo or the root of a Royale SDK" + unless="ROYALE_SWF_COMPILER_HOME"/> + </target> + + <target name="check-transpiler-home" + description="Set ROYALE_COMPILER_HOME to point at the cross-compiler."> + + <available file="${ROYALE_HOME}/js/lib/jsc.jar" + type="file" + property="ROYALE_COMPILER_HOME" + value="${ROYALE_HOME}/js"/> + + <fail message="ROYALE_COMPILER_HOME must be set to a folder with a lib sub-folder containing jsc.jar such as the compiler-jx folder in royale-compiler repo or the js folder of a Royale SDK" + unless="ROYALE_COMPILER_HOME"/> + </target> + +</project> diff --git a/frameworks/js/projects/MarkdownJS/src/main/config/compile-js-config.xml b/frameworks/js/projects/MarkdownJS/src/main/config/compile-js-config.xml new file mode 100644 index 0000000..f695991 --- /dev/null +++ b/frameworks/js/projects/MarkdownJS/src/main/config/compile-js-config.xml @@ -0,0 +1,103 @@ +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> +<royale-config> + + <compiler> + <accessible>false</accessible> + + <!-- build both SWF and JS. --> + <targets> + <target>SWF</target> + <target>JSRoyale</target> + </targets> + <strict-xml>true</strict-xml> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.royale.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.royale.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <define> + <name>COMPILE::SWF</name> + <value>false</value> + </define> + <define> + <name>COMPILE::JS</name> + <value>true</value> + </define> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <external-library-path append="true"> + <path-element>../../../../../libs/LanguageJS.swc</path-element> + <path-element>../../../../../libs/CoreJS.swc</path-element> + <path-element>../../../../../libs/BasicJS.swc</path-element> + <path-element>../../../../../libs/ReflectionJS.swc</path-element> + </external-library-path> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/royale/basic</uri> + <manifest>../../../../../../projects/Markdown/src/main/resources/basic-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>../../../../../../projects/Markdown/src/main/royale</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + <!-- Use of the instanceof operator. --> + <warn-instance-of-changes>false</warn-instance-of-changes> + </compiler> + + <include-file> + <name>defaults.css</name> + <path>../../../../../../projects/Markdown/src/main/resources/defaults.css</path> + </include-file> + + <include-sources> + </include-sources> + + <include-classes> + <class>NetworkClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/royale/basic</uri> + </include-namespaces> + + <js-default-initializers>false</js-default-initializers> + + <js-complex-implicit-coercions>false</js-complex-implicit-coercions> + <js-resolve-uncertain>false</js-resolve-uncertain> + <js-vector-index-checks>false</js-vector-index-checks> + + +</royale-config> diff --git a/frameworks/js/projects/MarkdownJS/src/test/royale/build.xml b/frameworks/js/projects/MarkdownJS/src/test/royale/build.xml new file mode 100644 index 0000000..0940edf --- /dev/null +++ b/frameworks/js/projects/MarkdownJS/src/test/royale/build.xml @@ -0,0 +1,242 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> + + +<project name="MarkdownJS.test" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../../../../../.."/> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/local.properties"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${env.ROYALE_HOME}"/> + <property name="ROYALE_SWF_COMPILER_HOME" value="${env.ROYALE_SWF_COMPILER_HOME}"/> + <property name="target.name" value="MarkdownJS-${release.version}.swc" /> + + <!-- + Windows browser: + try chrome first because it's the most popular browser + otherwise, try to fall back to firefox + DON'T use internet explorer! it cannot run scripts in local pages + --> + <condition property="royaleunit.browser" value="${env.ProgramFiles}/Google/Chrome/Application/chrome.exe"> + <and> + <os family="windows"/> + <available file="${env.ProgramFiles}/Google/Chrome/Application/chrome.exe"/> + </and> + </condition> + <condition property="royaleunit.browser" value="${env.ProgramFiles(x86)}/Google/Chrome/Application/chrome.exe"> + <and> + <os family="windows"/> + <available file="${env.ProgramFiles(x86)}/Google/Chrome/Application/chrome.exe"/> + </and> + </condition> + <condition property="royaleunit.browser" value="${env.ProgramFiles}/Mozilla Firefox/firefox.exe"> + <and> + <os family="windows"/> + <available file="${env.ProgramFiles}/Mozilla Firefox/firefox.exe"/> + </and> + </condition> + <condition property="royaleunit.browser" value="${env.ProgramFiles(x86)}/Mozilla Firefox/firefox.exe"> + <and> + <os family="windows"/> + <available file="${env.ProgramFiles(x86)}/Mozilla Firefox/firefox.exe"/> + </and> + </condition> + + <!-- + macOS browser: + try chrome first because it's the most popular browser + otherwise, try to fall back to firefox + DON'T use safari! it asks the user to confirm opening local pages + --> + <condition property="royaleunit.browser" value="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"> + <and> + <os family="mac"/> + <available file="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"/> + </and> + </condition> + <condition property="royaleunit.browser" value="/Applications/Firefox.app/Contents/MacOS/firefox"> + <and> + <os family="mac"/> + <available file="/Applications/Firefox.app/Contents/MacOS/firefox"/> + </and> + </condition> + + <!-- + Linux/Unix browser + --> + <condition property="royaleunit.browser" value="/usr/bin/firefox"> + <and> + <os family="unix"/> + <available file="/usr/bin/firefox"/> + </and> + </condition> + + <property name="report.dir" value="${basedir}/out" /> + + <target name="main" depends="clean,compile,test" description="Clean test of ${target.name}"> + </target> + + <target name="clean"> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${basedir}/target"> + <include name="**/**"/> + </fileset> + </delete> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${report.dir}"> + <include name="**/**"/> + </fileset> + </delete> + </target> + + <path id="lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="royaleUnitTasks.jar"/> + </path> + + <target name="compile" description="Cross-compiles tests"> + <echo message="Cross-compiling tests"/> + <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> + <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/> + <echo message="playerglobal.version: ${playerglobal.version}"/> + + <!-- Load the <compc> task. We can't do this at the <project> level --> + <!-- because targets that run before flexTasks.jar gets built would fail. --> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + <!-- + Link in the classes (and their dependencies) for the MXML tags + listed in this project's manifest.xml. + Also link the additional classes (and their dependencies) + listed in RoyaleUIClasses.as, + because these aren't referenced by the manifest classes. + Keep the standard metadata when compiling. + Include the appropriate CSS files and assets in the SWC. + Don't include any resources in the SWC. + Write a bundle list of referenced resource bundles + into the file bundles.properties in this directory. + --> + <mxmlc fork="true" + file="${basedir}/../../../../../../projects/Markdown/src/test/royale/FlexUnitRoyaleApplication.mxml"> + <jvmarg line="${mxmlc.jvm.args}"/> + <!-- + <jvmarg value="-Xdebug" /> + <jvmarg value="-Xnoagent" /> + <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8763,server=y,suspend=y" /> + --> + <!--<arg value="-debug" />--> + <arg value="-compiler.targets=JSRoyale" /> + <arg value="-js-output=target" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.PLAYERGLOBAL_HOME=${PLAYERGLOBAL_HOME}" /> + </mxmlc> + </target> + + <target name="check-royaleunit-browser" if="royaleunit.browser" unless="skip-tests"> + <!-- + if the royaleunit.browser property was provided manually, + check if the file actually exists + --> + <condition property="royaleunit.browser.exists"> + <and> + <isset property="royaleunit.browser" /> + <available file="${royaleunit.browser}" type="file" /> + </and> + </condition> + + <fail unless="royaleunit.browser.exists" message="Invalid royaleunit.browser path: "${royaleunit.browser}". To skip RoyaleUnit tests, use -Dskip-tests." /> + </target> + + <target name="test" depends="check-royaleunit-browser" + if="royaleunit.browser.exists" unless="skip-tests" + xmlns:if="ant:if" xmlns:unless="ant:unless"> + + <macrodef name="debug.test"> + <attribute name="is.needed" default="false"/> + <sequential> + <echo if:true="@{is.needed}">JS-RELEASE TESTS FAILED</echo> + <echo if:true="@{is.needed}">Running backup tests in js-debug build, because release build tests failed</echo> + <royaleunit if:true="@{is.needed}" + player="html" + swf="${basedir}/target/bin/js-debug/index.html" + command="${royaleunit.browser}" + workingDir="${basedir}" + toDir="${report.dir}" + haltonfailure="false" + failureProperty="debugBuildFail" + verbose="true" + localTrusted="true" + timeout="90000" /> + <condition if:true="@{is.needed}" property="debugTestResult" value="PASSED" else="FAILED"> + <not> + <isset property="debugBuildFail"/> + </not> + </condition> + </sequential> + </macrodef> + + <!-- Load the <royaleunit> task. We can't do this at the <project> level --> + <!-- because targets that run before royaleUnitTasks.jar gets built would fail. --> + <taskdef resource="royaleUnitTasks.tasks" classpathref="lib.path"/> + + <mkdir dir="${report.dir}" /> + <royaleunit + player="html" + swf="${basedir}/target/bin/js-release/index.html" + command="${royaleunit.browser}" + workingDir="${basedir}" + toDir="${report.dir}" + haltonfailure="false" + failureProperty="releaseBuildFail" + verbose="true" + localTrusted="true" + timeout="90000" /> + + <condition property="releaseTestResult" value="PASSED" else="FAILED"> + <not> + <isset property="releaseBuildFail"/> + </not> + </condition> + + <!-- the above runs a test in release build. If it fails, try again in debug-build --> + <debug.test is.needed="${releaseBuildFail}"/> + <!-- if the debug test ran, it will had already set 'debugTestResult', otherwise set it to 'Not tested' below --> + <property name="debugTestResult" value="Not tested" /> + + <property name="testResult"> + ${ant.project.name} RoyaleUnit Release build tests: ${releaseTestResult} + ${ant.project.name} RoyaleUnit Debug build tests: ${debugTestResult} + </property> + + <!-- Generate readable JUnit-style reports --> + <junitreport todir="${report.dir}"> + <fileset dir="${report.dir}"> + <include name="TEST-*.xml" /> + </fileset> + <report format="frames" todir="${report.dir}/html" /> + </junitreport> + + <!-- fail now if release tests are broken (with debug test info as well) --> + <fail if="releaseBuildFail" message="Test Failure ${line.separator}RoyaleUnit Release Build Tests must pass: ${line.separator} ${testResult}" /> + <!-- otherwise just show test result --> + <echo>${testResult}</echo> + </target> +</project> diff --git a/frameworks/projects/Markdown/asconfig.json b/frameworks/projects/Markdown/asconfig.json new file mode 100644 index 0000000..84cf00b --- /dev/null +++ b/frameworks/projects/Markdown/asconfig.json @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + { + "config": "royale", + "type": "lib", + "compilerOptions": { + "debug": true, + "targets": [ + "JSRoyale", + "SWF" + ], + "include-classes": [ + "MarkdownClasses" + ], + "include-sources": [ + "src/main/royale" + ], + "output": "target/Markdown.swc" + } +} diff --git a/frameworks/projects/Markdown/build.xml b/frameworks/projects/Markdown/build.xml new file mode 100644 index 0000000..d2aab8d --- /dev/null +++ b/frameworks/projects/Markdown/build.xml @@ -0,0 +1,177 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> + + +<project name="Markdown" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../.."/> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/local.properties"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + <condition property="AIR_HOME" value="${env.AIR_HOME}"> + <isset property="env.AIR_HOME" /> + </condition> + <property name="AIR_HOME" value="${ROYALE_HOME}"/> + <condition property="PLAYERGLOBAL_HOME" value="${env.PLAYERGLOBAL_HOME}"> + <isset property="env.PLAYERGLOBAL_HOME" /> + </condition> + <property name="PLAYERGLOBAL_HOME" value="${ROYALE_HOME}/frameworks/libs/player"/> + + <property name="target.name" value="${ant.project.name}.swc" /> + + <tstamp> + <format property="royale.swc-date" pattern="MM/dd/yy HH:mm Z"/> + </tstamp> + <echo>swc-date is ${royale.swc-date}</echo> + + <target name="main" depends="clean,check-compiler,compile,compile-js,copy-swc,test" description="Full build of ${ant.project.name}.swc"> + </target> + + <target name="compile-js"> + <ant dir="${ROYALE_HOME}/frameworks/js/projects/${ant.project.name}JS/" inheritAll="false" > + <property name="ROYALE_SWF_COMPILER_HOME" value="${ROYALE_SWF_COMPILER_HOME}"/> + <property name="ROYALE_COMPILER_HOME" value="${ROYALE_COMPILER_HOME}"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + </ant> + </target> + + <target name="copy-swc" if="AIR_HOME"> + <copy file="${basedir}/target/${target.name}" tofile="${ROYALE_HOME}/frameworks/libs/${target.name}" /> + </target> + + <target name="check-for-tests" > + <condition property="skip-tests" > + <not> + <available file="${basedir}/src/test/royale/build.xml" /> + </not> + </condition> + <!-- exclude from js-only build --> + <condition property="skip-swf-tests"> + <or> + <isset property="skip-tests" /> + <not> + <!-- env.AIR_HOME is how we determine if it's a SWF distritbution --> + <isset property="env.AIR_HOME" /> + </not> + </or> + </condition> + </target> + + <target name="test" depends="check-for-tests,check-compiler" unless="skip-tests"> + <antcall target="test-swf" /> + <antcall target="test-js" /> + </target> + + <target name="test-swf" unless="skip-swf-tests"> + <ant dir="src/test/royale" /> + </target> + + <target name="test-js"> + <ant dir="${ROYALE_HOME}/frameworks/js/projects/${ant.project.name}JS/" inheritAll="false" target="test"> + <property name="ROYALE_SWF_COMPILER_HOME" value="${ROYALE_SWF_COMPILER_HOME}"/> + <property name="ROYALE_COMPILER_HOME" value="${ROYALE_COMPILER_HOME}"/> + <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> + <property name="AIR_HOME" value="${AIR_HOME}"/> + <property name="PLAYERGLOBAL_HOME" value="${PLAYERGLOBAL_HOME}"/> + </ant> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${ROYALE_HOME}/frameworks/libs"> + <include name="${target.name}"/> + </fileset> + </delete> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${basedir}/target"> + <include name="**/**"/> + </fileset> + </delete> + <antcall target="clean-tests" /> + </target> + + <target name="clean-tests" depends="check-for-tests" unless="skip-tests"> + <ant dir="src/test/royale" target="clean"/> + </target> + + <target name="compile" description="Compiles .as files into .swc" if="AIR_HOME"> + <echo message="Compiling libs/${ant.project.name}.swc"/> + <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> + <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/> + <echo message="ROYALE_COMPILER_HOME: ${ROYALE_COMPILER_HOME}"/> + + <java jar="${ROYALE_COMPILER_HOME}/lib/compc.jar" fork="true" > + <jvmarg value="-Xmx384m" /> + <jvmarg value="-Dsun.io.useCanonCaches=false" /> + <jvmarg value="-Droyalelib=${ROYALE_HOME}/frameworks" /> + <arg value="+royalelib=${ROYALE_HOME}/frameworks" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.AIR_HOME=${AIR_HOME}" /> + <arg value="-compiler.strict-xml=true" /> + <arg value="-compiler.targets=SWF,JSRoyale" /> + <arg line="-metadata.date="${royale.swc-date}"" /> + <arg line="-metadata.dateFormat="MM/dd/yy HH:mm Z"" /> + <arg line="-swf-debugfile-alias="/org/apache/royale/${release.version}"" /> + <arg value="-output=${basedir}/target/${target.name}" /> + <arg value="-load-config=${basedir}/src/main/config/compile-swf-config.xml" /> + <arg value="-js-load-config=${ROYALE_HOME}/frameworks/js-config.xml" /> + <arg value="-js-load-config+=${basedir}/../../js/projects/${ant.project.name}JS/src/main/config/compile-js-config.xml" /> + </java> + </target> + + <target name="check-compiler" depends="check-compiler-home,check-transpiler-home"> + <path id="lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> + </path> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + </target> + + <target name="check-compiler-home" + description="Set ROYALE_SWF_COMPILER_HOME to point at the compiler."> + + <available file="${ROYALE_HOME}/lib/compiler-mxmlc.jar" + type="file" + property="ROYALE_SWF_COMPILER_HOME" + value="${ROYALE_HOME}"/> + + <fail message="ROYALE_SWF_COMPILER_HOME must be set to a folder with a lib sub-folder containing compiler-mxmlc.jar such as the compiler folder in royale-compiler repo or the root of a Royale SDK" + unless="ROYALE_SWF_COMPILER_HOME"/> + </target> + + <target name="check-transpiler-home" + description="Set ROYALE_COMPILER_HOME to point at the cross-compiler."> + + <available file="${ROYALE_HOME}/js/lib/jsc.jar" + type="file" + property="ROYALE_COMPILER_HOME" + value="${ROYALE_HOME}/js"/> + + <available file="${env.ROYALE_COMPILER_HOME}/lib/jsc.jar" + type="file" + property="ROYALE_COMPILER_HOME" + value="${env.ROYALE_COMPILER_HOME}"/> + + <fail message="ROYALE_COMPILER_HOME must be set to a folder with a lib sub-folder containing jsc.jar such as the compiler-jx folder in royale-compiler repo or the js folder of a Royale SDK" + unless="ROYALE_COMPILER_HOME"/> + </target> + +</project> diff --git a/frameworks/projects/Markdown/pom.xml b/frameworks/projects/Markdown/pom.xml new file mode 100644 index 0000000..d66fbd3 --- /dev/null +++ b/frameworks/projects/Markdown/pom.xml @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.royale.framework</groupId> + <artifactId>projects</artifactId> + <version>0.9.9-SNAPSHOT</version> + </parent> + + <artifactId>Markdown</artifactId> + <version>0.9.9-SNAPSHOT</version> + <packaging>swc</packaging> + + <name>Apache Royale: Framework: Libs: Markdown</name> + + <build> + <sourceDirectory>src/main/royale</sourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.royale.compiler</groupId> + <artifactId>royale-maven-plugin</artifactId> + <version>${project.royale.compiler.version}</version> + <extensions>true</extensions> + <configuration> + <namespaces> + <namespace> + <uri>library://ns.apache.org/royale/basic</uri> + <manifest>${project.basedir}/src/main/resources/basic-manifest.xml</manifest> + </namespace> + </namespaces> + <includeClasses> + <includeClass>MarkdownClasses</includeClass> + </includeClasses> + <includeFiles> + <include-file> + <name>defaults.css</name> + <path>../src/main/resources/defaults.css</path> + </include-file> + </includeFiles> + <skipExtern>true</skipExtern> + <skipAS>${royale.skipAS}</skipAS> + <additionalCompilerOptions>${project.compiler.options};-warn-instance-of-changes=false</additionalCompilerOptions> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Core</artifactId> + <version>0.9.9-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Basic</artifactId> + <version>0.9.9-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Reflection</artifactId> + <version>0.9.9-SNAPSHOT</version> + <type>swc</type> + <classifier>js</classifier> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>option-with-swf</id> + <dependencies> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Core</artifactId> + <version>0.9.9-SNAPSHOT</version> + <type>swc</type> + <classifier>swf</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Basic</artifactId> + <version>0.9.9-SNAPSHOT</version> + <type>swc</type> + <classifier>swf</classifier> + </dependency> + <dependency> + <groupId>org.apache.royale.framework</groupId> + <artifactId>Reflection</artifactId> + <version>0.9.9-SNAPSHOT</version> + <type>swc</type> + <classifier>swf</classifier> + </dependency> + </dependencies> + </profile> + </profiles> + +<properties /></project> diff --git a/frameworks/projects/Markdown/src/main/config/compile-swf-config.xml b/frameworks/projects/Markdown/src/main/config/compile-swf-config.xml new file mode 100644 index 0000000..9e78bf9 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/config/compile-swf-config.xml @@ -0,0 +1,96 @@ +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> +<royale-config> + + <compiler> + <accessible>false</accessible> + + <!-- build both SWF and JS. --> + <targets> + <target>SWF</target> + <target>JSRoyale</target> + </targets> + <strict-xml>true</strict-xml> + + <external-library-path> + <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> + <path-element>../../../../../libs/Core.swc</path-element> + <path-element>../../../../../libs/Basic.swc</path-element> + <path-element>../../../../../libs/Reflection.swc</path-element> + </external-library-path> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.royale.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.royale.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <define> + <name>COMPILE::SWF</name> + <value>true</value> + </define> + <define> + <name>COMPILE::JS</name> + <value>false</value> + </define> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <library-path/> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/royale/basic</uri> + <manifest>../resources/basic-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>../royale</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + <name>defaults.css</name> + <path>../resources/defaults.css</path> + </include-file> + + <include-classes> + <class>MarkdownClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/royale/basic</uri> + </include-namespaces> + + <target-player>${playerglobal.version}</target-player> + + +</royale-config> diff --git a/frameworks/projects/Markdown/src/main/resources/basic-manifest.xml b/frameworks/projects/Markdown/src/main/resources/basic-manifest.xml new file mode 100644 index 0000000..d6ff788 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/resources/basic-manifest.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> + +<componentPackage> + <component id="MardownParser" class="org.apache.royale.markdown.MarkdownParser"/> +</componentPackage> diff --git a/frameworks/projects/Markdown/src/main/resources/defaults.css b/frameworks/projects/Markdown/src/main/resources/defaults.css new file mode 100644 index 0000000..b95f8f1 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/resources/defaults.css @@ -0,0 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + + @namespace "library://ns.apache.org/royale/basic"; + diff --git a/frameworks/projects/Markdown/src/main/royale/MarkdownClasses.as b/frameworks/projects/Markdown/src/main/royale/MarkdownClasses.as new file mode 100644 index 0000000..634a654 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/MarkdownClasses.as @@ -0,0 +1,33 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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 +{ + /** + * @private + * This class is used to link additional classes into Markdown.swc + * beyond those that are found by dependency analysis starting + * from the classes specified in manifest.xml. + */ + internal class MarkdownClasses + { + import org.apache.royale.net.URLLoader; URLLoader; + + } +} + diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockParser.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockParser.as new file mode 100644 index 0000000..81cd6b6 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockParser.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public class BlockParser implements IParser + { + public function BlockParser() + { + + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockState.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockState.as new file mode 100644 index 0000000..791cffe --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockState.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public class BlockState implements IState + { + public function BlockState() + { + + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/CoreParser.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/CoreParser.as new file mode 100644 index 0000000..67496df --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/CoreParser.as @@ -0,0 +1,31 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public class CoreParser implements IParser + { + public function CoreParser() + { + + } + public function process(state:CoreState):void{ + + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/CoreState.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/CoreState.as new file mode 100644 index 0000000..66dc189 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/CoreState.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public class CoreState implements IState + { + public function CoreState(parser:MarkDownParser,str:String,env:Environment) + { + + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/Environment.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/Environment.as new file mode 100644 index 0000000..3b86205 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/Environment.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public class Environment + { + public function Environment() + { + + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IParser.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IParser.as new file mode 100644 index 0000000..2bcd32b --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IParser.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public interface IParser + { + + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IState.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IState.as new file mode 100644 index 0000000..34960bd --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IState.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public interface IState + { + + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineParser.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineParser.as new file mode 100644 index 0000000..80f59b4 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineParser.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public class InlineParser implements IParser + { + public function InlineParser() + { + + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineState.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineState.as new file mode 100644 index 0000000..7600a18 --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineState.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public class InlineState implements IState + { + public function InlineState() + { + + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/MarkdownParser.as b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/MarkdownParser.as new file mode 100644 index 0000000..ea3882e --- /dev/null +++ b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/MarkdownParser.as @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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.apache.royale.markdown +{ + public class MarkdownParser implements IParser + { + /** + * The main parser class. + * + */ + public function MarkdownParser() + { + inlineParser = new InlineParser(); + blockParser = new BlockParser(); + coreParser = new CoreParser(); + } + + private var inlineParser:InlineParser; + private var blockParser:BlockParser; + private var coreParser:CoreParser; + + public function parse (str:String, env:Environment):void { + var state:CoreState = new CoreState(this, str, env); + coreParser.process(state); + // return state.tokens; + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Markdown/src/test/royale/FlexUnitRoyaleApplication-config.xml b/frameworks/projects/Markdown/src/test/royale/FlexUnitRoyaleApplication-config.xml new file mode 100644 index 0000000..9b1cc04 --- /dev/null +++ b/frameworks/projects/Markdown/src/test/royale/FlexUnitRoyaleApplication-config.xml @@ -0,0 +1,114 @@ +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> +<royale-config> + + <compiler> + <accessible>false</accessible> + + <targets> + <target>SWF</target> + </targets> + <strict-xml>true</strict-xml> + + <external-library-path> + <path-element>{playerglobalHome}/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}/playerglobal.swc</path-element> + </external-library-path> + + <js-external-library-path> + <path-element>../../../../../../js/libs/js.swc</path-element> + <path-element>../../../../../../js/libs/gcl.swc</path-element> + </js-external-library-path> + + <library-path> + <path-element>../../../../../libs/Basic.swc</path-element> + <path-element>../../../../../libs/Binding.swc</path-element> + <path-element>../../../../../libs/Core.swc</path-element> + <path-element>../../../../../libs/Graphics.swc</path-element> + <path-element>../../../../../libs/Collections.swc</path-element> + <path-element>../../../../../libs/Language.swc</path-element> + <path-element>../../../../../libs/Reflection.swc</path-element> + <path-element>../../../../../libs/Markdown.swc</path-element> + <path-element>../../../../../libs/RoyaleUnit.swc</path-element> + </library-path> + + <js-library-path> + <path-element>../../../../../js/libs/BasicJS.swc</path-element> + <path-element>../../../../../js/libs/BindingJS.swc</path-element> + <path-element>../../../../../js/libs/CoreJS.swc</path-element> + <path-element>../../../../../js/libs/GraphicsJS.swc</path-element> + <path-element>../../../../../js/libs/CollectionsJS.swc</path-element> + <path-element>../../../../../js/libs/LanguageJS.swc</path-element> + <path-element>../../../../../js/libs/ReflectionJS.swc</path-element> + <path-element>../../../../../js/libs/NetworkJS.swc</path-element> + <path-element>../../../../../js/libs/MarkdownJS.swc</path-element> + <path-element>../../../../../js/libs/XMLJS.swc</path-element> + <path-element>../../../../../js/libs/RoyaleUnitJS.swc</path-element> + </js-library-path> + + <allow-subclass-overrides>true</allow-subclass-overrides> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.royale.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.royale.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + <fxg-base-class>flash.display.Sprite</fxg-base-class> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + <name>SWFOverride</name> + + <!-- RoyaleUnit --> + <name>Test</name> + <name>Before</name> + <name>After</name> + <name>BeforeClass</name> + <name>AfterClass</name> + <name>Ignore</name> + <name>Suite</name> + <name>RunWith</name> + + </keep-as3-metadata> + + <locale/> + + <library-path/> + + <namespaces> + <namespace> + <uri>http://ns.adobe.com/mxml/2009</uri> + <manifest>../../../../../mxml-2009-manifest.xml</manifest> + </namespace> + <namespace> + <uri>library://ns.apache.org/royale/basic</uri> + <manifest>../../main/resources/basic-manifest.xml</manifest> + </namespace> + </namespaces> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <target-player>${playerglobal.version}</target-player> + +</royale-config> diff --git a/frameworks/projects/Markdown/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/Markdown/src/test/royale/FlexUnitRoyaleApplication.mxml new file mode 100644 index 0000000..d18b68a --- /dev/null +++ b/frameworks/projects/Markdown/src/test/royale/FlexUnitRoyaleApplication.mxml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You 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. + +--> + +<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/royale/basic" + xmlns:test="org.apache.royale.test.*" + applicationComplete="runTests()" + > + <fx:Declarations> + <test:RoyaleUnitCore id="core"/> + </fx:Declarations> + <fx:Script> + <![CDATA[ + COMPILE::SWF + { + import flash.system.fscommand; + } + + import flexUnitTests.NetworkTester; + + import org.apache.royale.events.Event; + import org.apache.royale.test.listeners.CIListener; + import org.apache.royale.test.listeners.BrowserConsoleListener; + import org.apache.royale.test.Runtime; + + //account for swf version variance in some test results due to fixed player bugs etc + public function getSwfVersion():uint{ + COMPILE::SWF{ + return this.stage.loaderInfo.bytes[3]; + + } + return 0; + } + + public function runLocal():Boolean{ + var ret:Boolean = false; + COMPILE::JS{ + ret = window.location.search.indexOf('local')!= -1; + if (!ret) { + console.log('For javascript you can run this locally with console output for debugging purposes, using "?local" appended to the url.\nIt may not work for all browsers with file:// protocol (works with Chrome), in which case you need a local http server') + } + } + return ret + } + + public function getPlayerVersion():String{ + COMPILE::SWF{ + import flash.system.Capabilities; + return Capabilities.version; + } + return ''; + } + + public function runTests():void + { + Runtime.swfVersion = getSwfVersion(); + if (runLocal()) { + core.addListener(new BrowserConsoleListener()); + } else{ + core.addListener(new CIListener()); + } + core.addEventListener(Event.COMPLETE, core_completeHandler); + core.runClasses(NetworkTester); + } + + private function core_completeHandler(event:Event):void + { + COMPILE::SWF + { + fscommand("quit"); + } + } + + ]]> + </fx:Script> + <js:valuesImpl> + <!-- for such a simple app, we just set values to an empty array so it thinks it doesn't have any values --> + <js:SimpleValuesImpl values="[]"/> + </js:valuesImpl> + +</js:Application> diff --git a/frameworks/projects/Markdown/src/test/royale/build.xml b/frameworks/projects/Markdown/src/test/royale/build.xml new file mode 100644 index 0000000..90eb3e7 --- /dev/null +++ b/frameworks/projects/Markdown/src/test/royale/build.xml @@ -0,0 +1,116 @@ +<?xml version="1.0"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You 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. + +--> + + +<project name="Markdown.test" default="main" basedir="."> + <property name="ROYALE_HOME" location="../../../../../.."/> + + <property file="${ROYALE_HOME}/env.properties"/> + <property environment="env"/> + <property file="${ROYALE_HOME}/local.properties"/> + <property file="${ROYALE_HOME}/build.properties"/> + <property name="ROYALE_HOME" value="${env.ROYALE_HOME}"/> + <property name="ROYALE_SWF_COMPILER_HOME" value="${env.ROYALE_SWF_COMPILER_HOME}"/> + <property name="target.name" value="Markdown-${release.version}.swc" /> + + <property name="report.dir" value="${basedir}/out" /> + + <target name="main" depends="clean,compile,test" description="Clean test of ${target.name}"> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="${basedir}"> + <include name="FlexUnitRoyaleApplication.swf"/> + </fileset> + </delete> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${report.dir}"> + <include name="**/**"/> + </fileset> + </delete> + </target> + + <path id="lib.path"> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> + <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="royaleUnitTasks.jar"/> + </path> + + <target name="compile" description="Compiles FlexUnitRoyaleApplication.swf"> + <echo message="Compiling FlexUnitRoyaleApplication.swf"/> + <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> + <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/> + <echo message="playerglobal.version: ${playerglobal.version}"/> + + <!-- Load the <compc> task. We can't do this at the <project> level --> + <!-- because targets that run before flexTasks.jar gets built would fail. --> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + <!-- + Link in the classes (and their dependencies) for the MXML tags + listed in this project's manifest.xml. + Also link the additional classes (and their dependencies) + listed in RoyaleUIClasses.as, + because these aren't referenced by the manifest classes. + Keep the standard metadata when compiling. + Include the appropriate CSS files and assets in the SWC. + Don't include any resources in the SWC. + Write a bundle list of referenced resource bundles + into the file bundles.properties in this directory. + --> + <mxmlc fork="true" + file="${basedir}/FlexUnitRoyaleApplication.mxml" + output="${basedir}/FlexUnitRoyaleApplication.swf"> + <jvmarg line="${mxmlc.jvm.args}"/> + <!-- + <jvmarg value="-Xdebug" /> + <jvmarg value="-Xnoagent" /> + <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8763,server=y,suspend=y" /> + --> + <arg value="-debug" /> + <arg value="-compiler.targets=SWF" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.PLAYERGLOBAL_HOME=${PLAYERGLOBAL_HOME}" /> + </mxmlc> + </target> + + <target name="test"> + <!-- Load the <royaleunit> task. We can't do this at the <project> level --> + <!-- because targets that run before royaleUnitTasks.jar gets built would fail. --> + <taskdef resource="royaleUnitTasks.tasks" classpathref="lib.path"/> + <mkdir dir="${report.dir}" /> + <royaleunit + swf="${basedir}/FlexUnitRoyaleApplication.swf" + workingDir="${basedir}" + toDir="${report.dir}" + haltonfailure="true" + verbose="true" + localTrusted="true" + timeout="90000" /> + + <!-- Generate readable JUnit-style reports --> + <junitreport todir="${report.dir}"> + <fileset dir="${report.dir}"> + <include name="TEST-*.xml" /> + </fileset> + <report format="frames" todir="${report.dir}/html" /> + </junitreport> + + </target> +</project> diff --git a/frameworks/projects/Markdown/src/test/royale/flexUnitTests/MarkdownTester.as b/frameworks/projects/Markdown/src/test/royale/flexUnitTests/MarkdownTester.as new file mode 100644 index 0000000..e39065e --- /dev/null +++ b/frameworks/projects/Markdown/src/test/royale/flexUnitTests/MarkdownTester.as @@ -0,0 +1,39 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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 flexUnitTests +{ + import flexUnitTests.markdown.* + + [Suite] + [RunWith("org.apache.royale.test.runners.SuiteRunner")] + /** + * @royalesuppresspublicvarwarning + */ + public class MarkdownTester + { + public function MarkdownTester() + { + // for JS, force-link these classes in the output + var arr:Array = []; + } + + // public var urlVariablesTesterTest:URLVariablesTesterTest; + + } +} diff --git a/frameworks/projects/Markdown/src/test/royale/flexUnitTests/markdown/URLVariablesTesterTest.as b/frameworks/projects/Markdown/src/test/royale/flexUnitTests/markdown/URLVariablesTesterTest.as new file mode 100644 index 0000000..622d6ec --- /dev/null +++ b/frameworks/projects/Markdown/src/test/royale/flexUnitTests/markdown/URLVariablesTesterTest.as @@ -0,0 +1,129 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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 flexUnitTests.markdown +{ + + + + + import org.apache.royale.test.asserts.*; + + + import org.apache.royale.net.URLVariables; + + + public class URLVariablesTesterTest + { + + [Before] + public function setUp():void + { + } + + [After] + public function tearDown():void + { + } + + [BeforeClass] + public static function setUpBeforeClass():void + { + } + + [AfterClass] + public static function tearDownAfterClass():void + { + } + + + private function encodedStringContentsMatch(string1:String, string2:String):Boolean{ + if (string1.length == string2.length) { + var content1:Array = string1.split('&'); + var content2:Array = string2.split('&'); + if (content1.length == content2.length) { + while(content1.length) { + if (content2.indexOf(content1.pop()) == -1) return false; + } + return true; + } + } + return false; + } + + + [Test] + public function testEncoding():void + { + var tester:URLVariables = new URLVariables(); + tester['test1'] = 'test1Value'; + assertEquals(tester.toString(), 'test1=test1Value', 'unexpected encoded string'); + + tester['test2'] = 'test2Value'; + //handle arbitrary order of encoded values when testing: + assertTrue(encodedStringContentsMatch(tester.toString(), 'test1=test1Value&test2=test2Value'), 'unexpected encoded string') + } + + [Test] + public function testDecoding():void + { + var tester:URLVariables = new URLVariables('test1=test1Value'); + assertEquals(tester['test1'], 'test1Value', 'unexpected decoded value'); + + tester.decode('test2=test2Value'); + + //cumulative: + assertEquals(tester['test1'], 'test1Value', 'unexpected decoded value'); + assertEquals(tester['test2'], 'test2Value', 'unexpected decoded value'); + + //test empty string as name in pair + tester = new URLVariables('=EmptyStringValue'); + assertEquals(tester[''], 'EmptyStringValue', 'unexpected decoded value'); + + } + + [Test] + public function testDecodingWithPlus():void + { + var tester:URLVariables = new URLVariables('test1=test1Value+with+spaces'); + assertEquals(tester['test1'], 'test1Value with spaces', 'unexpected decoded value'); + + } + + + + [Test] + public function testDecodingError():void + { + + var wasError:Boolean; + var tester:URLVariables = new URLVariables(); + try{ + //test2 name does not include a value: + tester.decode('test1=1&test2'); + }catch(e:Error){ + wasError = true; + } + assertTrue(wasError, 'Error should be thrown for incomplete name-value pair'); + assertEquals(tester['test1'], '1', 'partially decoded value should be present'); + + + } + + } +}
