1.0.14 • Published 2 years ago

wsxp v1.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Word Source XML Parser

Description

A node library that parses citation data into Microsoft Word's source XML format. The output data can be directly imported into Word to use as sources.

Usage

Start by creating a new document.

import {createDoc, finishDoc, parseBook} from 'wsxp'

let doc = createDoc()

This library exports a function for every type of source available in word. They are consistently named as parse_{type}(xml_root, ...params). For example to add a book to the sources:

doc = parseBook(
    doc: doc,
    title: "Cool book",
    authors: ["Alex J"], 
    year: "2022", 
    city: "London",
    publisher: "Me"
    )

Then close the document. This will return a complete XML string.

let source_xml = finishDoc(doc)

The example above would generate:

<?xml version="1.0"?>
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
  <b:Source>
    <b:SourceType>Book</b:SourceType>
    <b:Title>Cool book</b:Title>
    <b:Year>2022</b:Year>
    <b:City>London</b:City>
    <b:Publisher>Me</b:Publisher>
    <b:Author>
      <b:Author>
        <b:NameList>
          <b:Person>
            <b:Last>J</b:Last>
            <b:First>Alex</b:First>
          </b:Person>
        </b:NameList>
      </b:Author>
    </b:Author>
  </b:Source>
</b:Sources>

Save to a file then import to Word using References > Manage Sources > Browse...

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago