Giter Site home page Giter Site logo

vifito / asciidoctor-question Goto Github PK

View Code? Open in Web Editor NEW

This project forked from denkspuren/asciidoctor-question

0.0 1.0 1.0 98 KB

Asciidoctor Question is a set of Asciidoctor extensions that allows you to add questions as multiple choice and gap text. The questions are defined using plain text in your AsciiDoc document.

License: Other

Ruby 69.45% CSS 15.29% JavaScript 15.26%

asciidoctor-question's Introduction

Asciidoctor Question

Gem Version MIT License

Asciidoctor Question is a set of Asciidoctor extensions that allows you to add questions as multiple choice and gap text. The questions are defined using plain text in your AsciiDoc document.

Installation for asciidoctor 2.0

# Uninstall previous version
gem uninstall asciidoctor-question

# Clone repo
git clone https://github.com/vifito/asciidoctor-question.git

cd asciidoctor-question

# Build and install
rake build
rake install

# Usage
asciidoctor -r asciidoctor-question -r asciidoctor-pdf -b pdf sample.adoc
asciidoctor -r asciidoctor-question sample.adoc

Installation and Update

There are two options to install Asciidoctor Question. The first is to use gem install on the command line:

$ gem install asciidoctor-question

The second is to add the following entry to your project’s Gemfile.

Gemfile
gem 'asciidoctor-question', '~> 0.5'

and execute bundle in the command line.

$ bundle

To update asciidoctor-question type

$ gem update asciidoctor-question

Creating a Question

A question is written inside a literal block, which needs two attributes.

Anatomy of a question
[question, question-type] // (1) (2)
....                      // (3)
Question in appropriate syntax
....
  1. The first positional attribute in the attribute list specifies that this block is a question.

  2. The second positional attribute defines the type of this question (mc or gap)

  3. Place the attribute list directly on top of the delimited literal block (....). You can also use an example (====) or open block (--) as an alternative.

The following question types are available:

Question Type input output

mc

[question, mc]
....
Lorem ipsum dolor sit amet, consetetur
sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.

- [X] ipsum
- [ ] eltir
- [X] ut
....
mc

gap

[question, gap]
....
At vero eos et __accusam__ et justo
duo dolores et ea rebum. Stet clita
kasd gubergren, no sea __takimata
sanctus est Lorem__ ipsum dolor sit
amet. Lorem __ipsum dolor sit amet__,
consetetur sadipscing elitr, sed diam
nonumy __eirmod tempor invidunt__ ut
labore et dolore magna aliquyam erat,
sed diam voluptua.
....
gap

Generating a Question Document from a Terminal

You can load Asciidoctor question in a terminal using the -r flag.

$ asciidoctor -r asciidoctor-question sample.adoc

You can also use Asciidoctor question with other converters, such as Asciidoctor PDF. Asciidoctor-pdf is also loaded with the -r flag.

$ asciidoctor -r asciidoctor-question -r asciidoctor-pdf -b pdf sample.adoc

Or, you can invoke Asciidoctor and the PDF converter with the asciidoctor-pdf command. The command implicitly sets the -r and -b flags for PDF output.

$ asciidoctor-pdf -r asciidoctor-question sample.adoc

Advanced Usage

Generating PDF with solutions

With the attribute :solution: it is possible to generate a pdf file which contains the questions with its solutions.

$ asciidoctor -r asciidoctor-question -r asciidoctor-pdf -b pdf -a solution sample.adoc

You can also add the :solution: attribute to your asciidoc file.

asciidoctor-question's People

Contributors

denkspuren avatar hobbypunk90 avatar vifito avatar

Watchers

 avatar

Forkers

gbif

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.