@@ -17,7 +17,9 @@ public class IncludeBlock(DirectiveBlockParser parser, Dictionary<string, string
1717
1818 public string ? IncludePath { get ; private set ; }
1919
20- public bool Literal { get ; private set ; }
20+ public bool Literal { get ; protected set ; }
21+
22+ public string ? Language { get ; private set ; }
2123
2224 public bool Found { get ; private set ; }
2325
@@ -26,22 +28,34 @@ public class IncludeBlock(DirectiveBlockParser parser, Dictionary<string, string
2628 public override void FinalizeAndValidate ( )
2729 {
2830 var includePath = Arguments ; //todo validate
29- Literal = bool . TryParse ( Properties . GetValueOrDefault ( "literal" ) , out var b ) && b ;
31+ Literal |= bool . TryParse ( Properties . GetValueOrDefault ( "literal" ) , out var b ) && b ;
32+ Language = Properties . GetValueOrDefault ( "language" ) ;
3033 if ( includePath is null )
3134 {
3235 //TODO emit empty error
3336 }
3437 else
3538 {
36- IncludePath = Path . Combine ( IncludeFromPath . Directory ! . FullName , includePath ) ;
39+ var includeFrom = IncludeFromPath . Directory ! . FullName ;
40+ if ( includePath . StartsWith ( '/' ) )
41+ includeFrom = DocumentationSourcePath . FullName ;
42+
43+ IncludePath = Path . Combine ( includeFrom , includePath . TrimStart ( '/' ) ) ;
3744 if ( FileSystem . File . Exists ( IncludePath ) )
3845 Found = true ;
46+ else
47+ {
48+ //TODO emit error
49+ }
3950 }
4051
4152
4253 }
4354}
4455
4556
46- public class LiteralIncludeBlock ( DirectiveBlockParser parser , Dictionary < string , string > properties , ParserContext context )
47- : IncludeBlock ( parser , properties , context ) ;
57+ public class LiteralIncludeBlock : IncludeBlock
58+ {
59+ public LiteralIncludeBlock ( DirectiveBlockParser parser , Dictionary < string , string > properties , ParserContext context )
60+ : base ( parser , properties , context ) => Literal = true ;
61+ }
0 commit comments