course-renderer
Manages CA School Courses file system storage and HTML conversion
Last updated 3 months ago by tenshilyle .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install course-renderer 
SYNC missed versions from official npm registry.

course-renderer

CA School Course Renderer

Requirements

Installation

npm install course-renderer

Usage

  • render-course --raw /tmp/raw --dest /tmp/dest course1 will render /tmp/raw/course1 to /tmp/dest/course1
  • render-course --raw /tmp/raw --dest /tmp/dest will render all courses found at /tmp/raw and save it to /tmp/dest
  • render-course --raw /tmp/raw --dest /tmp/dest --content-only course1 will render course1 SUMMARY.md and content directory files only. Useful for validation.

Options

  • -r, --raw - (Optional, default to /tmp/courses-raw) The directory where the raw course will be located.
  • -d, --dest - (Optional, default to /tmp/courses-rendered) The directory where the rendered course will be save.
  • -c, --content-only - (Optional) will only render the SUMMARY.md and the content directory files.
  • -s, --silent - (Optional)render-course will be in silent mode. Only output errors to STDOUT

Arguments

  • Arguments passed to render-course are treated as Course Name. Passing a list of argument will render those courses.
  • If you do not pass anything, then render-course will render everything from the raw directory.

Custom Rendering

If you want to execute your custom rendering routines, you will need to import customRender function from this package. Then your custom rendering functions should expect a single parameter, a vinyl object. You will need to return that same object itself with the updated contents.

The example below will add the bootstrap btn and btn-primary class to the course buttons

import { customRender } from 'course-renderer';

function myCustomRenderer(file) {
    const ch = cheerio.load(file.contents.toString())

    ch('.ca-verify-button').addClass('btn btn-primary')

    file.contents = new Buffer(ch.html())
    return file
}

customRender('/path/to/your/course', myCustomRenderer, (error) => {
    // Do something after
})

Authors

Current Tags

  • 2.4.0                                ...           latest (3 months ago)

35 Versions

  • 2.4.0                                ...           3 months ago
  • 2.3.9                                ...           7 months ago
  • 2.3.8                                ...           7 months ago
  • 2.3.7                                ...           9 months ago
  • 2.3.6                                ...           a year ago
  • 2.3.3                                ...           a year ago
  • 2.3.1                                ...           a year ago
  • 2.3.0                                ...           a year ago
  • 2.2.26                                ...           2 years ago
  • 2.2.25                                ...           2 years ago
  • 2.2.23                                ...           2 years ago
  • 2.2.22                                ...           2 years ago
  • 2.2.21                                ...           2 years ago
  • 2.2.20                                ...           2 years ago
  • 2.2.19                                ...           2 years ago
  • 2.2.18                                ...           2 years ago
  • 2.2.17                                ...           2 years ago
  • 2.2.16                                ...           2 years ago
  • 2.2.14                                ...           2 years ago
  • 2.2.13                                ...           2 years ago
  • 2.2.12                                ...           2 years ago
  • 2.2.11                                ...           2 years ago
  • 2.2.10                                ...           2 years ago
  • 2.2.9                                ...           2 years ago
  • 2.2.8                                ...           2 years ago
  • 2.2.7                                ...           2 years ago
  • 2.2.5                                ...           2 years ago
  • 2.2.4                                ...           2 years ago
  • 2.2.3                                ...           2 years ago
  • 2.2.2                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.1.1                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 47
Last Day 0
Last Week 0
Last Month 5
Dependencies (31)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |