     # INCLUDES
     #.......................................................................................................
     write ""
-    write "\\input{#{content_locator}}"
+    write "\\input{#{S.layout_info[ 'content-locator' ]}}"
     write ""
     #-------------------------------------------------------------------------------------------------------
     write "\\end{document}"
     #-------------------------------------------------------------------------------------------------------
     text = lines.join '\n'
     # whisper text
-    njs_fs.writeFile master_locator, text, handler
+    njs_fs.writeFile S.layout_info[ 'master-locator'  ], text, handler
 
 
 #===========================================================================================================

@compile_options()

#-----------------------------------------------------------------------------------------------------------
@write_mkts_master = ( S, layout_info, handler ) ->
  self = @
  step ( resume ) ->
    lines             = []
    write             = lines.push.bind lines
    master_locator    = layout_info[ 'master-locator'  ]
    content_locator   = layout_info[ 'content-locator' ]
    help "writing #{master_locator}"
    #-------------------------------------------------------------------------------------------------------
    write ""
    write "% #{master_locator}"
    write "% do not edit this file"
    write "% generated from #{self.options[ 'locator' ]}"
    write "% on #{new Date()}"

  RPC_SERVER  = require './rpc-server'
  server      = await ( promisify RPC_SERVER.listen.bind RPC_SERVER )()
  process.on 'exit', -> server.close()
  #.......................................................................................................
  ### TAINT use method to produce new state ###
  S =
    options:              @options
    layout_info:          HELPERS.new_layout_info @options, source_route
    paragraph_nr:         0
    configuration:        {}
  await ( promisify @write_mkts_master.bind @ ) S
  file_output             = njs_fs.createWriteStream S.layout_info[ 'content-locator' ]
  #.......................................................................................................
  file_output.on 'close', =>
    HELPERS.write_pdf S.layout_info, ( error ) =>
      throw error if error?
      S.t1              = +new Date()
      dt_s              = ( S.t1 - S.t0 ) / 1000
      dt_s_txt          = dt_s.toFixed 3
      chrs_per_s_txt    = (   S.chr_count / dt_s ).toFixed 3
      events_per_s_txt  = ( S.event_count / dt_s ).toFixed 3
      chr_count_txt     = ƒ S.chr_count
      event_count_txt   = ƒ S.event_count
      help "#{TEXT.flush_right    chr_count_txt, 10}       chrs (approx.)"
      help "#{TEXT.flush_right  event_count_txt, 10}     events (approx.)"
      help "#{TEXT.flush_right         dt_s_txt, 14}          s"
      help "#{TEXT.flush_right   chrs_per_s_txt, 14}   chrs / s"
      help "#{TEXT.flush_right events_per_s_txt, 14} events / s"
      # debug '49984', S.aux
      # handler null if handler?
      process.exit 0
  #.......................................................................................................
  ### TAINT should read MD source stream ###
  md_source               = njs_fs.readFileSync S.layout_info[ 'source-locator'  ], encoding: 'utf-8'
  md_readstream           = MD_READER.create_md_read_tee S, md_source
  tex_writestream         = @create_tex_write_tee S
  md_input                = md_readstream.tee[    'input'  ]
  md_output               = md_readstream.tee[    'output' ]
  tex_input               = tex_writestream.tee[  'input'  ]
  tex_output              = tex_writestream.tee[  'output' ]
  #.......................................................................................................
  # S.aux                   = yield AUX.fetch_aux_data S, resume
  S.resend                = md_readstream.tee[ 'S' ].resend
  #.......................................................................................................
  md_output
    .pipe tex_input
  tex_output
    # .pipe $ ( event, send ) =>
    #   debug '33376', rpr event
    #   send event
    #   if event?
    #     send event
    #   if end?
    #     end() # setTimeout end, 1000
    .pipe file_output
  #.......................................................................................................
  md_input.resume()
  return null


#===========================================================================================================
