コード例 #1
0
        private IEnumerable <XmlBlock> ExtractInternal(TextReader textReader, string fileName = null)
        {
            var reader = new LineReader(textReader);

            while (reader.Read())
            {
                if (!reader.Current.StartsWith("```"))
                {
                    continue;
                }

                var location   = new ConfigurationLocation(fileName, reader.LineNumber);
                var isXmlTyped = reader.Current.StartsWith("```xml", StringComparison.OrdinalIgnoreCase);

                var text  = ReadBlock(reader);
                var block = new XmlBlock(text, location);
                try
                {
                    var elements = block.GetElements();
                    if (!isXmlTyped && !elements.Any())
                    {
                        continue;
                    }
                }
                catch (XmlException)
                {
                    if (!isXmlTyped)
                    {
                        continue;
                    }
                }
                yield return(block);
            }
        }
コード例 #2
0
        private IEnumerable <Link> ExtractInternal(TextReader textReader, string fileName = null)
        {
            var reader = new LineReader(textReader);

            while (reader.Read())
            {
                var location = new ConfigurationLocation(fileName, reader.LineNumber);
                foreach (Match match in rxMarkdownLink.Matches(reader.Current))
                {
                    if (!match.Success)
                    {
                        continue;                   // Can this happen?
                    }
                    var caption = match.Groups[1].Value;
                    var path    = match.Groups[2].Value;
                    yield return(new Link(caption, path, location));
                }
            }
        }
コード例 #3
0
 public XmlBlock(string originalText, ConfigurationLocation location)
 {
     OriginalText = originalText;
     Location     = location;
 }
コード例 #4
0
 /// <summary>
 /// This attribute is used to specify where a command should get their settings from.
 /// </summary>
 /// <param name="configType">The configuration type.</param>
 /// <param name="configLocation">The configuration location.</param>
 public XimuraAppConfigurationAttribute(ConfigurationLocation configType, string configLocation)
 {
     mConfigType = configType;
     mConfigLocation = configLocation;
 }
コード例 #5
0
ファイル: Link.cs プロジェクト: alex-davidson/caber
 public Link(string caption, string path, ConfigurationLocation location)
 {
     Caption  = caption;
     Path     = new NormalisedPath(path);
     Location = location;
 }