Ejemplo n.º 1
0
        public bool TryAddReference(string reference, SourceSpan span, int line, SourceSpan?errorSpan = null,
                                    bool image = false, bool cleanUrl = false, bool autoLink = false, bool namedReferenceLink = false, string label = null)
        {
            var result = ProcessRelativePath(reference, out string relativePath);

            if (result == PathProcessingResult.NotInContext)
            {
                ReportPathOutOfContext(reference, errorSpan ?? span);
                return(false);
            }
            else if (result == PathProcessingResult.IsFsSpecific)
            {
                ReportPathIsFsSpecific(reference, errorSpan ?? span);
                return(false);
            }
            else
            {
                if (result == PathProcessingResult.IsUrl)
                {
                    ParsingResult.AddReference(
                        new LinkReference(
                            reference,
                            span,
                            line,
                            image,
                            cleanUrl,
                            autoLink,
                            namedReferenceLink,
                            autoLink ? reference : label));
                }
                else
                {
                    ParsingResult.AddReference(
                        new Reference(
                            reference,
                            relativePath,
                            span,
                            line));
                }
                return(true);
            }
        }
Ejemplo n.º 2
0
 public ParsingResult(ParsingResult parsingResult)
 {
     Source           = parsingResult.Source;
     SyntaxTree       = parsingResult.SyntaxTree;
     LineStartIndexes = parsingResult.LineStartIndexes;
 }
Ejemplo n.º 3
0
 private void Parse(string source)
 {
     ParsingResult = new ParsingResult(source, Configuration);
     Parse();
 }