Exemplo n.º 1
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is Multimedia x &&
            x.aloneInParagraph == this.aloneInParagraph &&
            AreEqual(x.items, this.items) &&
            base.SameMetaData(E));
 }
Exemplo n.º 2
0
        public Strong(MarkdownElement md)
        {
            if (md == null)
                throw new ArgumentNullException(nameof(md));

            _s = md.ToString();
        }
 /// <summary>
 /// Renders all of the children for the given element.
 /// </summary>
 /// <param name="rootElemnet">The root element to render children of</param>
 /// <param name="currentInlines">The inlines where they should go</param>
 /// <param name="trimTextStart">If true the first text box start will be trimed so there is no leading space</param>
 private void RenderInlineChildren(MarkdownElement rootElemnet, InlineCollection currentInlines, ref bool trimTextStart)
 {
     foreach (MarkdownInline element in rootElemnet.Children)
     {
         RendnerInline(element, currentInlines, ref trimTextStart);
     }
 }
Exemplo n.º 4
0
		/// <summary>
		/// If the current object has same meta-data as <paramref name="E"/>
		/// (but not necessarily same content).
		/// </summary>
		/// <param name="E">Element to compare to.</param>
		/// <returns>If same meta-data as <paramref name="E"/>.</returns>
		public override bool SameMetaData(MarkdownElement E)
		{
			return E is Sections x &&
				x.initialNrColumns	 == this.initialNrColumns &&
				x.initialRow == this.initialRow &&
				base.SameMetaData(E);
		}
Exemplo n.º 5
0
        /// <summary>
        /// Generates WPF XAML for the markdown element.
        /// </summary>
        /// <param name="Output">XAML will be output here.</param>
        /// <param name="TextAlignment">Alignment of text in element.</param>
        public override void GenerateXAML(XmlWriter Output, TextAlignment TextAlignment)
        {
            XamlSettings    Settings = this.Document.Settings.XamlSettings;
            MarkdownElement Last     = null;

            foreach (MarkdownElement Description in this.Children)
            {
                Last = Description;
            }

            foreach (MarkdownElement Description in this.Children)
            {
                if (Description.InlineSpanElement && !Description.OutsideParagraph)
                {
                    Output.WriteStartElement("TextBlock");
                    Output.WriteAttributeString("TextWrapping", "Wrap");
                }
                else
                {
                    Output.WriteStartElement("StackPanel");
                }

                Output.WriteAttributeString("Margin", Settings.DefinitionMargin.ToString() + ",0,0," +
                                            (Description == Last ? Settings.DefinitionSeparator : 0).ToString());

                Description.GenerateXAML(Output, TextAlignment);
                Output.WriteEndElement();
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is TaskItem x &&
            x.isChecked == this.isChecked &&
            x.checkPosition == this.checkPosition &&
            base.SameMetaData(E));
 }
Exemplo n.º 7
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is Link x &&
            x.url == this.url &&
            x.title == this.title &&
            base.SameMetaData(E));
 }
        public override void CreateSettingsUI(VisualElement rootElement)
        {
            MarkdownElement markdown = new MarkdownElement
            {
                Data             = $@"Welcome and Thank you for trying ThunderKit.  Please configure your ThunderKit project by first clicking the Locate Game button below!

If this is your first time using ThunderKit, [Click Here](menulink://Tools/ThunderKit/Documentation) to launch the documentation",
                MarkdownDataType = MarkdownDataType.Text
            };

#if UNITY_2018
            markdown.AddStyleSheetPath("Packages/com.passivepicasso.thunderkit/Documentation/uss/markdown.uss");
            markdown.AddStyleSheetPath("Packages/com.passivepicasso.thunderkit/Documentation/uss/thunderkit_documentation.uss");
#else
            markdown.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Packages/com.passivepicasso.thunderkit/Documentation/uss/markdown.uss"));
            markdown.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Packages/com.passivepicasso.thunderkit/Documentation/uss/thunderkit_documentation.uss"));
#endif
            markdown.RefreshContent();
            markdown.AddToClassList("m4");

            var child = CreateStandardField(nameof(ShowOnStartup));
            child.tooltip = "Uncheck this to stop showing this window on startup";
            rootElement.Add(child);
            rootElement.Add(markdown);

            rootElement.Bind(new SerializedObject(this));
        }
Exemplo n.º 9
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is SectionSeparator x &&
            this.nrColumns == x.nrColumns &&
            this.sectionNr == x.sectionNr &&
            this.row == x.row &&
            base.SameMetaData(E));
 }
Exemplo n.º 10
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is Header x &&
            x.level == this.level &&
            x.prefix == this.prefix &&
            x.row == this.row &&
            base.SameMetaData(E));
 }
Exemplo n.º 11
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is CodeBlock x &&
            this.indent == x.indent &&
            this.indentString == x.indentString &&
            this.language == x.language &&
            AreEqual(this.rows, x.rows) &&
            base.SameMetaData(E));
 }
Exemplo n.º 12
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is Table x &&
            this.caption == x.caption &&
            this.id == x.id &&
            this.columns == x.columns &&
            AreEqual(this.alignments, x.alignments) &&
            AreEqual(this.alignmentDefinitions, x.alignmentDefinitions) &&
            base.SameMetaData(E));
 }
Exemplo n.º 13
0
        public override void CreateSettingsUI(VisualElement rootElement)
        {
            MarkdownElement markdown = null;

            if (string.IsNullOrEmpty(GameExecutable) || string.IsNullOrEmpty(GamePath))
            {
                markdown = new MarkdownElement
                {
                    Data =
                        $@"
**_Warning:_**   No game configured. Click the Locate Game button to setup your ThunderKit Project before continuing
",
                    MarkdownDataType = MarkdownDataType.Text
                };

#if UNITY_2018
                markdown.AddStyleSheetPath("Packages/com.passivepicasso.thunderkit/Documentation/uss/markdown.uss");
#else
                markdown.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Packages/com.passivepicasso.thunderkit/Documentation/uss/markdown.uss"));
#endif
                markdown.AddToClassList("m4");
                markdown.RefreshContent();
                rootElement.Add(markdown);
            }

            rootElement.Add(CreateStandardField(nameof(GameExecutable)));

            rootElement.Add(CreateStandardField(nameof(GamePath)));

            var configureButton = new Button(() =>
            {
                ConfigureGame.Configure();
                if (!string.IsNullOrEmpty(GameExecutable) && !string.IsNullOrEmpty(GamePath))
                {
                    if (markdown != null)
                    {
                        markdown.RemoveFromHierarchy();
                    }
                }
            });
            configureButton.AddToClassList("configure-game-button");
            configureButton.text = "Locate Game";
            rootElement.Add(configureButton);

            if (thunderKitSettingsSO == null)
            {
                thunderKitSettingsSO = new SerializedObject(this);
            }
            rootElement.Bind(thunderKitSettingsSO);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Generates Xamarin.Forms XAML for the markdown element.
        /// </summary>
        /// <param name="Output">XAML will be output here.</param>
        /// <param name="TextAlignment">Alignment of text in element.</param>
        public override void GenerateXamarinForms(XmlWriter Output, TextAlignment TextAlignment)
        {
            XamlSettings    Settings = this.Document.Settings.XamlSettings;
            MarkdownElement Last     = null;

            foreach (MarkdownElement Description in this.Children)
            {
                Last = Description;
            }

            foreach (MarkdownElement Description in this.Children)
            {
                if (Description.InlineSpanElement && !Description.OutsideParagraph)
                {
                    Paragraph.GenerateXamarinFormsContentView(Output, TextAlignment, Settings);

                    Output.WriteStartElement("Label");
                    Output.WriteAttributeString("LineBreakMode", "WordWrap");
                    Output.WriteAttributeString("TextType", "Html");

                    StringBuilder Html = new StringBuilder();
                    Description.GenerateHTML(Html);
                    Output.WriteCData(Html.ToString());

                    Output.WriteEndElement();
                    Output.WriteEndElement();
                }
                else
                {
                    Output.WriteStartElement("ContentView");
                    Output.WriteAttributeString("Padding", Settings.DefinitionMargin.ToString() + ",0,0," +
                                                (Description == Last ? Settings.DefinitionSeparator : 0).ToString());

                    Output.WriteStartElement("StackLayout");
                    Description.GenerateXamarinForms(Output, TextAlignment);
                    Output.WriteEndElement();

                    Output.WriteEndElement();
                }
            }
        }
Exemplo n.º 15
0
 public void Append(MarkdownElement md)
 {
     _sb.Append(md.ToString());
 }
Exemplo n.º 16
0
 public Paragraph(MarkdownElement md) : this()
 {
     Append(md);
 }
Exemplo n.º 17
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is Abbreviation x &&
            x.description == this.description &&
            base.SameMetaData(E));
 }
Exemplo n.º 18
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is CommentBlock x &&
            AreEqual(this.rows, x.rows) &&
            base.SameMetaData(E));
 }
Exemplo n.º 19
0
        internal static void GenerateInlineFormattedTextXamarinForms(XmlWriter Output, MarkdownElement FormattedText)
        {
            Output.WriteStartElement("Label");
            Output.WriteAttributeString("LineBreakMode", "WordWrap");
            Output.WriteAttributeString("TextType", "Html");

            StringBuilder Html = new StringBuilder();

            FormattedText.GenerateHTML(Html);
            Output.WriteCData(Html.ToString());

            Output.WriteEndElement();
        }
Exemplo n.º 20
0
 /// <summary>
 /// Represents an unnumbered item in an ordered list.
 /// </summary>
 /// <param name="Document">Markdown document.</param>
 /// <param name="Prefix">Prefix, in plain text mode.</param>
 /// <param name="Child">Child element.</param>
 public UnnumberedItem(MarkdownDocument Document, string Prefix, MarkdownElement Child)
     : base(Document, Child)
 {
     this.prefix = Prefix;
 }
Exemplo n.º 21
0
 /// <summary>
 /// Abstract base class for block elements with one child.
 /// </summary>
 /// <param name="Document">Markdown document.</param>
 /// <param name="Child">Child element.</param>
 public BlockElementSingleChild(MarkdownDocument Document, MarkdownElement Child)
     : base(Document, Child)
 {
 }
Exemplo n.º 22
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is HorizontalRule x &&
            x.row == this.row &&
            base.SameMetaData(E));
 }
Exemplo n.º 23
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is NumberedItem x &&
            x.number == this.number &&
            base.SameMetaData(E));
 }
Exemplo n.º 24
0
 /// <summary>
 /// Represents a task item in a task list.
 /// </summary>
 /// <param name="Document">Markdown document.</param>
 /// <param name="IsChecked">If the item is checked or not.</param>
 /// <param name="Child">Child element.</param>
 public TaskItem(MarkdownDocument Document, bool IsChecked, MarkdownElement Child)
     : base(Document, Child)
 {
     this.isChecked = IsChecked;
 }
Exemplo n.º 25
0
 /// <summary>
 /// Represents a numbered item in an ordered list.
 /// </summary>
 /// <param name="Document">Markdown document.</param>
 /// <param name="Number">Number associated with item.</param>
 /// <param name="Child">Child element.</param>
 public NumberedItem(MarkdownDocument Document, int Number, MarkdownElement Child)
     : base(Document, Child)
 {
     this.number = Number;
 }
Exemplo n.º 26
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is InvisibleBreak x &&
            x.row == this.row &&
            base.SameMetaData(E));
 }
Exemplo n.º 27
0
 /// <summary>
 /// Creates an object of the same type, and meta-data, as the current object,
 /// but with content defined by <paramref name="Child"/>.
 /// </summary>
 /// <param name="Child">New content.</param>
 /// <param name="Document">Document that will contain the element.</param>
 /// <returns>Object of same type and meta-data, but with new content.</returns>
 public override MarkdownElementSingleChild Create(MarkdownElement Child, MarkdownDocument Document)
 {
     return(new UnnumberedItem(Document, this.prefix, Child));
 }
Exemplo n.º 28
0
 protected void AppendLine(MarkdownElement element)
 {
     MdElements.Add(element);
 }
Exemplo n.º 29
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is Footnote x &&
            x.key == this.key &&
            base.SameMetaData(E));
 }
Exemplo n.º 30
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is LinkReference x &&
            x.label == this.label &&
            base.SameMetaData(E));
 }
Exemplo n.º 31
0
 /// <summary>
 /// Represents a task item in a task list.
 /// </summary>
 /// <param name="Document">Markdown document.</param>
 /// <param name="IsChecked">If the item is checked or not.</param>
 /// <param name="CheckPosition">Position of the checkmark in the original markdown text document.</param>
 /// <param name="Child">Child element.</param>
 public TaskItem(MarkdownDocument Document, bool IsChecked, int CheckPosition, MarkdownElement Child)
     : base(Document, Child)
 {
     this.isChecked     = IsChecked;
     this.checkPosition = CheckPosition;
 }
Exemplo n.º 32
0
 /// <summary>
 /// Creates an object of the same type, and meta-data, as the current object,
 /// but with content defined by <paramref name="Child"/>.
 /// </summary>
 /// <param name="Child">New content.</param>
 /// <param name="Document">Document that will contain the element.</param>
 /// <returns>Object of same type and meta-data, but with new content.</returns>
 public override MarkdownElementSingleChild Create(MarkdownElement Child, MarkdownDocument Document)
 {
     return(new TaskItem(Document, this.isChecked, this.checkPosition, Child));
 }
Exemplo n.º 33
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public override bool SameMetaData(MarkdownElement E)
 {
     return(E is UnnumberedItem x &&
            x.prefix == this.prefix &&
            base.SameMetaData(E));
 }