@ -153,7 +153,9 @@ class TransformProcessor(NOPProcessor):
pwd = os . path . abspath ( " . " )
if os . path . commonpath ( [ full_path , pwd ] ) != os . path . commonpath ( [ pwd ] ) :
return nullify ( e )
text = open ( self . context . dir + " / " + e . attributes [ " partial " ] , " r " ) . read ( )
filename = self . context . dir + " / " + e . attributes [ " partial " ]
self . context . add_dep ( filename )
text = open ( filename , " r " ) . read ( )
path = self . context . dir + " / " + e . attributes [ " partial " ]
if e . attributes [ " type " ] == " md " :
includedDoc = import_md ( text )
@ -217,7 +219,9 @@ class TransformProcessor(NOPProcessor):
if not " type " in e . attributes :
e . attributes [ " type " ] = " module "
if e . attributes [ " type " ] == " md " :
importedDoc = import_md ( open ( self . context . dir + " / " + e . content [ 0 ] . text [ 1 : ] , " r " ) . read ( ) )
filename = self . context . dir + " / " + e . content [ 0 ] . text [ 1 : ]
self . context . add_dep ( filename )
importedDoc = import_md ( open ( filename , " r " ) . read ( ) )
self . transform ( importedDoc . content )
elif e . attributes [ " type " ] == " module " :
matches = re . match ( r " ^( \ w+)(?: as ( \ w+))?$ " , e . content [ 0 ] . text [ 1 : ] )
@ -227,7 +231,9 @@ class TransformProcessor(NOPProcessor):
module_name = matches . group ( 1 ) if matches . group ( 2 ) is None else matches . group ( 2 )
self . context . add_commands_from_module ( module , module_name )
elif e . attributes [ " type " ] == " metadata " :
data = json . load ( open ( self . context . dir + " / " + e . content [ 0 ] . text [ 1 : ] , " r " ) )
filename = self . context . dir + " / " + e . content [ 0 ] . text [ 1 : ]
self . context . add_dep ( filename )
data = json . load ( open ( filename , " r " ) )
key = " " if not " key " in e . attributes else e . attributes [ " key " ]
self . context . import_metadata ( data , key )
else :