コード例 #1
0
        /// <summary>
        /// Preforms the post-parse procedure of the options.
        /// </summary>
        /// <param name="options">The raw options string to parse.</param>
        private void ParseOptions(string options)
        {
            if (options == null)
            {
                return;
            }
            var splittedOptions = options.Split(',');

            Options            = new ExpressionOptions();
            Options.AsKeyValue = new Dictionary <string, string>(splittedOptions.Length);
            foreach (var option in splittedOptions)
            {
                var keyValue = option.Split('=');
                Options.AsKeyValue.Add(keyValue[0].Trim(), keyValue.Length > 1? keyValue[1].Trim() : null);
            }
            Options.AsExpressions = new List <LatexExpression>();
            string          beginning = options;
            string          end;
            LatexExpression expr;
            int             index            = 0;
            bool            verbatimMode     = false;
            bool            whitespaceBefore = false;

            while ((expr = ReadFromTextReader(this, 0, ref index, ref verbatimMode,
                                              MathMode | ExprType == ExpressionType.InlineMath | ExprType == ExpressionType.BlockMath,
                                              Customization, beginning, null, out end, ref whitespaceBefore)) != null)
            {
                beginning = end;
                Options.AsExpressions.Add(expr);
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the ExpressionOptions class.
 /// </summary>
 /// <param name="options">The options to copy from.</param>
 public ExpressionOptions(ExpressionOptions options)
 {
     if (options != null)
     {
         if (options.AsKeyValue != null)
         {
             AsKeyValue = new Dictionary <string, string>(options.AsKeyValue);
         }
         if (options.AsExpressions != null)
         {
             AsExpressions = new List <LatexExpression>(options.AsExpressions);
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the ExpressionOptions class.
 /// </summary>
 /// <param name="options">The options to copy from.</param>
 public ExpressionOptions(ExpressionOptions options)
 {
     if (options != null)
     {
         if (options.AsKeyValue != null)
         {
             AsKeyValue = new Dictionary<string, string>(options.AsKeyValue);
         }
         if (options.AsExpressions != null)
         {
             AsExpressions = new List<LatexExpression>(options.AsExpressions);
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the LatexExpression class and copies the specified expression data to it.
 /// </summary>
 /// <param name="expression">The expression to clone.</param>
 public LatexExpression(LatexExpression expression)
 {
     Parent        = expression.Parent;
     Name          = expression.Name;
     ExprType      = expression.ExprType;
     MathMode      = expression.MathMode;
     Customization = expression.Customization;
     if (expression.Options != null)
     {
         Options = new ExpressionOptions();
     }
     if (expression.Expressions != null)
     {
         Expressions = new List <List <LatexExpression> >(expression.Expressions);
     }
 }
コード例 #5
0
 /// <summary>
 /// Preforms the post-parse procedure of the options.
 /// </summary>
 /// <param name="options">The raw options string to parse.</param>
 private void ParseOptions(string options)
 {
     if (options == null) { return; }
     var splittedOptions = options.Split(',');
     Options = new ExpressionOptions();
     Options.AsKeyValue = new Dictionary<string,string>(splittedOptions.Length);
     foreach (var option in splittedOptions)
     {
         var keyValue = option.Split('=');
         Options.AsKeyValue.Add(keyValue[0].Trim(), keyValue.Length > 1? keyValue[1].Trim() : null);
     }
     Options.AsExpressions = new List<LatexExpression>();
     string beginning = options;
     string end;
     LatexExpression expr;
     int index = 0;
     bool verbatimMode = false;
     bool whitespaceBefore = false;
     while ((expr = ReadFromTextReader(this, 0, ref index, ref verbatimMode,
         MathMode | ExprType == ExpressionType.InlineMath | ExprType == ExpressionType.BlockMath,
         Customization, beginning, null, out end, ref whitespaceBefore)) != null)
     {
         beginning = end;
         Options.AsExpressions.Add(expr);
     }
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the LatexExpression class and copies the specified expression data to it.
 /// </summary>
 /// <param name="expression">The expression to clone.</param>
 public LatexExpression(LatexExpression expression)
 {
     Parent = expression.Parent;
     Name = expression.Name;
     ExprType = expression.ExprType;
     MathMode = expression.MathMode;
     Customization = expression.Customization;
     if (expression.Options != null)
     {
         Options = new ExpressionOptions();
     }
     if (expression.Expressions != null)
     {
         Expressions = new List<List<LatexExpression>>(expression.Expressions);
     }
 }