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
The following commit(s) were added to refs/heads/feature/markdown by this push:
new 294e9e6 some work on tokens
294e9e6 is described below
commit 294e9e61cd7be04a00268a3869cff1b4cc23ccf0
Author: Harbs <[email protected]>
AuthorDate: Fri Jan 14 12:37:42 2022 +0200
some work on tokens
---
.../org/apache/royale/markdown/BlockToken.as | 99 ++++++++++++++++++++++
.../org/apache/royale/markdown/ContentToken.as | 60 +++++++++++--
.../royale/org/apache/royale/markdown/IToken.as | 2 +
.../org/apache/royale/markdown/InlineToken.as | 35 --------
.../royale/org/apache/royale/markdown/TagToken.as | 88 +++++++++++++++++--
5 files changed, 239 insertions(+), 45 deletions(-)
diff --git
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockToken.as
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockToken.as
new file mode 100644
index 0000000..e44e7da
--- /dev/null
+++
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/BlockToken.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 BlockToken implements IToken
+ {
+ public function BlockToken()
+ {
+ lineData = [-1,-1];
+ }
+ private var lineData:Array;
+
+ public function get firstLine():int
+ {
+ return lineData[0] as int;
+ }
+
+ public function set firstLine(value:int):void
+ {
+ lineData[0] = value;
+ }
+
+ public function get lastLine():int
+ {
+ return lineData[1];
+ }
+
+ public function set lastLine(value:int):void
+ {
+ lineData[1] = value;
+ }
+
+ public var children:Array;
+
+ private var _content:String;
+ /**
+ * The raw text content
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
+ public function get content():String
+ {
+ return _content;
+ }
+
+ public function set content(value:String):void
+ {
+ _content = value;
+ }
+ private var _type:String = "";
+ /**
+ * The token type
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
+ public function get type():String
+ {
+ return _type;
+ }
+
+ public function set type(value:String):void
+ {
+ _type = value;
+ }
+
+ private var _level:int = 0;
+ /**
+ * The level of nesting of the token
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
+ public function get level():int
+ {
+ return _level;
+ }
+
+ public function set level(value:int):void
+ {
+ _level = value;
+ }
+ }
+}
\ No newline at end of file
diff --git
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/ContentToken.as
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/ContentToken.as
index ac92031..9ff76cf 100644
---
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/ContentToken.as
+++
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/ContentToken.as
@@ -18,18 +18,68 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.markdown
{
+ /**
+ * ContentToken represent plain text. It is usually used for the
content of inline
+ * structures. Most of them will be generated automatically by the
inline
+ * parser. They are also sometimes generated explicitly by the
+ * inline parsing rules.
+ *
+ * A text token has a `content` property containing the text it
represents.
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
public class ContentToken implements IToken
{
public function ContentToken()
{
}
- public function get type():String{
- //TODO
- return "";
+
+ private var _content:String = "";
+ /**
+ * The raw text content
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
+ public function get content():String
+ {
+ return _content;
+ }
+
+ public function set content(value:String):void
+ {
+ _content = value;
+ }
+ private var _type:String = "";
+ /**
+ * The token type
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
+ public function get type():String
+ {
+ return _type;
}
- public function get level():int{
- return 0;
+
+ public function set type(value:String):void
+ {
+ _type = value;
+ }
+
+ private var _level:int = 0;
+ /**
+ * The level of nesting of the token
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
+ public function get level():int
+ {
+ return _level;
+ }
+
+ public function set level(value:int):void
+ {
+ _level = value;
}
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IToken.as
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IToken.as
index eab1222..b360004 100644
---
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IToken.as
+++
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/IToken.as
@@ -21,6 +21,8 @@ package org.apache.royale.markdown
public interface IToken
{
function get type():String;
+ function set type(value:String):void;
function get level():int;
+ function set level(value:int):void;
}
}
\ No newline at end of file
diff --git
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineToken.as
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineToken.as
deleted file mode 100644
index 6be0f67..0000000
---
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/InlineToken.as
+++ /dev/null
@@ -1,35 +0,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.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.royale.markdown
-{
- public class InlineToken implements IToken
- {
- public function InlineToken()
- {
-
- }
- public function get type():String{
- //TODO
- return "";
- }
- public function get level():int{
- return 0;
- }
- }
-}
\ No newline at end of file
diff --git
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/TagToken.as
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/TagToken.as
index b1660f5..175e788 100644
---
a/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/TagToken.as
+++
b/frameworks/projects/Markdown/src/main/royale/org/apache/royale/markdown/TagToken.as
@@ -18,18 +18,96 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.markdown
{
+ /**
+ * Tag tokens are used to represent markdown syntax. Each tag token
represents a
+ * special markdown syntax in the original markdown source. They are
usually used
+ * for the open and close tokens. For example the "\`\`\`" at the
begining of a
+ * fenced block code, the start of an item list or the end of a
emphasized part of
+ * a line.
+ *
+ * Tag tokens have a variety of types and each is associated to a
rendering rule.
+ *
+ */
public class TagToken implements IToken
{
+
+ /**
+ * blockquote (open/close)
+ * code
+ * fence
+ * heading (open/close)
+ * hr
+ * bullet_list (open/close)
+ * list_item (open/close)
+ * ordered_list (open/close)
+ * paragraph (open/close)
+ * link (open/close)
+ * image
+ * table (open/close)
+ * thead (open/close)
+ * tbody (open/close)
+ * tr (open/close)
+ * th (open/close)
+ * td (open/close)
+ * strong (open/close)
+ * em (open/close)
+ * del (open/close)
+ * in (open/close)
+ * mark (open/close)
+ * sub (open/close)
+ * hardbreak
+ * softbreak
+ * text (well, not really a tag...)
+ * htmlblock (not tag)
+ * htmltag (not tag -- what is this?)
+ * abbr (open/close)
+ * footnote_ref (is this a tag?)
+ * footnote_block (open/close)
+ * footnote (open/close)
+ * footnote_anchor
+ * dl (open/close)
+ * dt (open/close)
+ * dd (open/close)
+ *
+ */
public function TagToken()
{
}
- public function get type():String{
- //TODO
- return "";
+
+ public var openTag:Boolean;
+ public var closeTag:Boolean;
+
+ private var _type:String = "";
+ /**
+ * The token type
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
+ public function get type():String
+ {
+ return _type;
+ }
+
+ public function set type(value:String):void
+ {
+ _type = value;
}
- public function get level():int{
- return 0;
+
+ private var _level:int = 0;
+ /**
+ * The level of nesting of the token
+ * @langversion 3.0
+ * @productversion Royale 0.9.9
+ */
+ public function get level():int
+ {
+ return _level;
+ }
+
+ public function set level(value:int):void
+ {
+ _level = value;
}
}
}
\ No newline at end of file