import:
  ui:
    path: $GRAMEXAPPS/ui/gramex.yaml
    YAMLURL: $YAMLURL/ui/
  languagetool:
    path: $GRAMEXAPPS/languagetool/gramex.yaml
    YAMLURL: $YAMLURL/languagetool/

url:
  nlg-data-selector-$*:
    pattern: /$YAMLURL/initform
    handler: FunctionHandler
    kwargs:
      headers:
        Cache-Control: no-store
      xsrf_cookies: false
      function: gramex.apps.nlg.nlgapp.init_form
      redirect:
        url: /$YAMLURL/../?tab=nlg&action=edit
  tablepreview-$*:
    pattern: /$YAMLURL/preview/(.*)/(.*)
    handler: FormHandler
    kwargs:
      url: $GRAMEXDATA/nlg/{_0}/{_1}
      headers:
        Cache-Control: no-store
  nlg-static_files-$*:
    pattern: /$YAMLURL/nlg.js
    handler: FileHandler
    kwargs:
      path: $YAMLPATH/js/nlg.js
  nlg-config-handler-$*:
    pattern: /$YAMLURL/initconf
    handler: FunctionHandler
    kwargs:
      function: gramex.apps.nlg.nlgapp.get_init_config
      headers:
        Content-Type: application/json
  textproc-$*:
    pattern: /$YAMLURL/textproc
    handler: FunctionHandler
    kwargs:
      function: gramex.apps.nlg.nlgapp.process_template
      xsrf_cookies: false
      headers:
        Content-Type: application/json
  rendertmpl-$*:
    pattern: /$YAMLURL/render-template
    handler: FunctionHandler
    kwargs:
      function: gramex.apps.nlg.nlgapp.render_template
      xsrf_cookies: false
      headers:
        Content-Type: application/json
  nlg_gramopts-$*:
    pattern: /$YAMLURL/get-gramopts
    handler: FunctionHandler
    kwargs:
      function: gramex.apps.nlg.nlgapp.get_gramopts
      xsrf_cookies: false
      headers:
        Content-Type: application/json
  save-config-$*:
    pattern: /$YAMLURL/save-config
    handler: FunctionHandler
    kwargs:
      function: gramex.apps.nlg.nlgapp.save_config
      xsrf_cookies: false
  edit-narrative-$*:
    pattern: /$YAMLURL/edit-narrative
    handler: FunctionHandler
    kwargs:
      function: gramex.apps.nlg.nlgapp.edit_narrative
      auth:
        login_url: /$YAMLURL/../../login/
      redirect:
        url: /$YAMLURL/../?tab=nlg&action=edit
  render-live-template-$*:
    pattern: /$YAMLURL/render-live-template
    handler: FunctionHandler
    kwargs:
      function: gramex.apps.nlg.nlgapp.render_live_template
