TrialAndErrorOrg / parsers

Monorepo for a suite of `unified`-compatible converters for converting between, from, and to .docx, JATS XML, LaTeX, and PDF
https://convert.centeroftrialanderror.com
GNU General Public License v3.0
15 stars 0 forks source link

[ooxast-util-to-unified-latex] do something with the styles #87

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

[ooxast-util-to-unified-latex] do something with the styles

const styles = select('w\:styles', node)

if (styles) {

h.styles = all(h, styles)

}

https://github.com/TrialAndErrorOrg/parsers/blob/65d824f647013ef7fb7ac4a009b0e99970c7d8f7/libs/ooxast/ooxast-util-to-unified-latex/src/lib/handlers/document.ts#L25


import { all } from '../all'
import { H, Handle } from '../types'
import { Body, Document, Endnotes, Footnotes } from 'ooxast'
import { select } from 'xast-util-select'
import { notes } from '../util/notes'
import { convertElement } from 'xast-util-is-element'

const isFootnotes = convertElement<Footnotes>('w:footnotes')
const isEndnotes = convertElement<Endnotes>('w:endnotes')

export const document: Handle = (h: H, node: Document) => {
  h.simpleParagraph = true
  const body = select('w\\:body', node)

  const foots = select('w\\:footnotes', node)
  if (foots && isFootnotes(foots)) {
    h.footnotes = notes(h, foots)
  }

  const endnotes = select('w\\:endnotes', node)
  if (endnotes && isEndnotes(endnotes)) {
    h.endnotes = notes(h, endnotes)
  }

  // TODO: [ooxast-util-to-unified-latex] do something with the styles
  // const styles = select('w\\:styles', node)
  // if (styles) {
  //   h.styles = all(h, styles)
  // }

  const relations = select('w\\:relationships', node)

51dd9f72ae3918d8eed612857d20153c7db80d31