https://github.com/catalalang/rescript-docx
A ReScript wrapper for the docx lib
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.8%) to scientific vocabulary
Keywords
Repository
A ReScript wrapper for the docx lib
Basic Info
Statistics
- Stars: 1
- Watchers: 6
- Forks: 1
- Open Issues: 0
- Releases: 5
Topics
Metadata Files
README.md
rescript-docx
Report Bug • API docs • Contribute • docx.js
A ReScript wrapper for the [`docx`](https://docx.js.org/) JS/TS library.Table Of Contents
Usage
yarn add -D rescript-docx
Examples
Local
Some examples are available in
examples/.
To run them simply:
```bash
Compile the project with the dependencies
yarn && yarn build
Run the compiled JS file with Node
npx node examples/
The result is stored in the root with the corresponding name: .docx
```
Real world
catala-explain- A module for explicability from the trace of a catala program
API coverage
List of supported features:
- ✅ Document
- 🚧 Sections
- ✅ Paragraph
- 🚧 Text
- 🚧 Images (Missing correct modelization of the
ImageRun.options.datatype) - ✅ Headers & Footers
- ✅ Bullet Points
- ✅ Hyperlinks
- ✅ Numbering
- ✅ Tables
- ✅ Tabs
- ✅ Table Of Contents
- ✅ Page Numbers
- ❌ Change Tracking
- ❌ Math
- ❌ Comments
- ❌ Footnotes
- ❌ Fields
- ✅ Packers
Binding conventions
For the binding, several conventions has been used:
Primitives
By default JavaScript number are converted to float, but if it's expected
to be integers then to int.
Enums
Enums are bound to a polymorphic variant:
typescript
// In TypeScript
enum AlignmentType = {
START = "start",
CENTER = "center",
NUM_TAB = "numTab",
...
}
rescript
// Corresponding AlignmentType.res file
type t = [
| #start,
| #center,
| #numTab,
...
]
🔜 In the incoming ReScript 11.0, this could be done cleaner by using the new tagged variants.
Polymorphic constructors
Each docx classes has its corresponding ReScript module.
For example the
Paragraphclasses has its correspondingParapraphmodule in theParagraph.resfile.
To emulate polymorphic constructors call, the following convention has been taken:
typescript
// In TypeScript
const p = new Paragraph("Lorem ipsum")
const q = new Paragraph({
text: "Lorem ipsum",
heading: HeadingLevel.HEADING_1,
})
rescript
// In ReScript
let p = Paragraph.make("Lorem Ipsum")
let q = Paragraph.make'({
text: "Lorem ipsum",
heading: #Heading1,
})
Inline variant types
TypeScript inline variant types are encoded in a dedicated module in Util.Types as:
typescript
// TypeScript variant
type t = {
value: number | string
}
```rescript // In ReScript open Util
type t = { value: Types.NumberOrString.t }
let float: t = { value: Types.NumberOrString.fromFloat(10.0) }
let string: t = { value: Types.NumberOrString.fromString("Hello") } ```
🔜 In the incoming ReScript 11, this could be done more simply by using the new untagged variants.
Reserved keywords
Some used JavaScript attributes are reserved keywords in ReScript, consequently, they are
postfixed by _.
For example, the attribute type is type_.
Interface inheritance
🔜 In the incoming ReScript 11.0, using record type spread will allows to factorizes interface inheritance.
Sponsors
This library has been developed during a research project funded by the mission logiciels libres et communs numériques of the direction interministérielle du numérique in collaboration with the Catala project.
Owner
- Name: CatalaLang
- Login: CatalaLang
- Kind: organization
- Repositories: 4
- Profile: https://github.com/CatalaLang
GitHub Events
Total
Last Year
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Emile Rolley | e****y@t****o | 79 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 12 months ago
All Time
- Total issues: 0
- Total pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: 7 minutes
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- EmileRolley (4)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- docx ^8.2.2 development
- file-saver ^2.0.5 development
- rescript ^10.1.4 development
- rescript-nodejs ^15.0.0 development
- @types/node 20.4.8
- core-util-is 1.0.3
- docx 8.2.2
- file-saver 2.0.5
- immediate 3.0.6
- inherits 2.0.4
- isarray 1.0.0
- jszip 3.10.1
- lie 3.3.0
- nanoid 4.0.2
- pako 1.0.11
- process-nextick-args 2.0.1
- readable-stream 2.3.8
- rescript 10.1.4
- rescript-nodejs 15.0.0
- safe-buffer 5.1.2
- sax 1.2.4
- setimmediate 1.0.5
- string_decoder 1.1.1
- util-deprecate 1.0.2
- xml 1.0.1
- xml-js 1.6.11