How to use the orga.parseTimestamp function in orga

To help you get started, we’ve selected a few orga examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github orgapp / orgajs / packages / gatsby-transformer-orga / src / on-node-create.ts View on Github external
if (d && d.end) { metadata.end = d.end }

          const absolutePath = `${orgFileNode.fileAbsolutePath}::*${title}`
          return {
            metadata,
            getAST: () => ast.parent, // we need the secion of the headline
            absolutePath,
          }
        })
    } else { // root
        const metadata = {
          export_file_name: orgFileNode.fileName,
          ...ast.meta }
      metadata.title = metadata.title || 'Untitled'
      const absolutePath = `${orgFileNode.fileAbsolutePath}`
      const d = parseTimestamp(metadata.date) ||
            parseTimestamp(metadata.export_date)
      if (d && d.date) { metadata.date = d.date }
      content = [ {
        metadata,
        getAST: () => ast,
        absolutePath,
      } ]
    }

    content.forEach((node, index) => {
      const id = `${orgFileNode.id} >>> OrgContent[${index}]`
      const ast = node.getAST()
      const contentDigest =
            crypto.createHash(`md5`)
                  .update(JSON.stringify(ast, getCircularReplacer()))
                  .digest(`hex`)
github orgapp / orgajs / packages / gatsby-transformer-orga / src / on-node-create.ts View on Github external
const absolutePath = `${orgFileNode.fileAbsolutePath}::*${title}`
          return {
            metadata,
            getAST: () => ast.parent, // we need the secion of the headline
            absolutePath,
          }
        })
    } else { // root
        const metadata = {
          export_file_name: orgFileNode.fileName,
          ...ast.meta }
      metadata.title = metadata.title || 'Untitled'
      const absolutePath = `${orgFileNode.fileAbsolutePath}`
      const d = parseTimestamp(metadata.date) ||
            parseTimestamp(metadata.export_date)
      if (d && d.date) { metadata.date = d.date }
      content = [ {
        metadata,
        getAST: () => ast,
        absolutePath,
      } ]
    }

    content.forEach((node, index) => {
      const id = `${orgFileNode.id} >>> OrgContent[${index}]`
      const ast = node.getAST()
      const contentDigest =
            crypto.createHash(`md5`)
                  .update(JSON.stringify(ast, getCircularReplacer()))
                  .digest(`hex`)
      const n = {
github orgapp / orgajs / packages / gatsby-transformer-orga / src / on-node-create.ts View on Github external
.map(ast => {
          const { date, export_date, export_title, ...properties } = getProperties(ast)
          const title = export_title || select(`text`, ast).value

          const d = parseTimestamp(date) ||
                parseTimestamp(export_date) ||
                select(`timestamp`, ast) ||
                select(`planning[keyword=CLOSED]`, ast)

          const metadata = {
            title,
            export_file_name: sanitise(title),
            category: category || orgFileNode.fileName,
            keyword: ast.keyword,
            tags: ast.tags,
            ...properties,
          }

          if (d && d.date) { metadata.date = d.date }
          if (d && d.end) { metadata.end = d.end }
github orgapp / orgajs / packages / gatsby-transformer-orga / src / on-node-create.ts View on Github external
.map(ast => {
          const { date, export_date, export_title, ...properties } = getProperties(ast)
          const title = export_title || select(`text`, ast).value

          const d = parseTimestamp(date) ||
                parseTimestamp(export_date) ||
                select(`timestamp`, ast) ||
                select(`planning[keyword=CLOSED]`, ast)

          const metadata = {
            title,
            export_file_name: sanitise(title),
            category: category || orgFileNode.fileName,
            keyword: ast.keyword,
            tags: ast.tags,
            ...properties,
          }

          if (d && d.date) { metadata.date = d.date }
          if (d && d.end) { metadata.end = d.end }

          const absolutePath = `${orgFileNode.fileAbsolutePath}::*${title}`

orga

org-mode parser

MIT
Latest version published 9 months ago

Package Health Score

61 / 100
Full package analysis