Git Product home page Git Product logo

text-formatting's Introduction

Text-Formatting

In this program we will write a simple text formatter that reads a text file with embedded formatting commands and writes a text file that contains the input file formatted according to the embedded formatting commands. The embedded commands begin with a . (period) and appear on a line by themselves.

.br Start a new line

.pp Start a new paragraph

.bp Start a new page

.nf Stop formatting -- copy input to output

.fi Resume formatting

.pn Put page numbers on bottom of each page

.po Don't put page numbers

.ls n Spacing between lines is n

.sp n Leave n blank lines

.rj Output is right justified

.nr Output is not right justified

.ce n Center the next n lines

.ll n Output line length is n characters

.pl n Page length is n lines

.pi n Paragraph indentation is n spaces

Assume the following commands are at the beginning of every input file (i.e. default settings): .ll 40

.pn

.ls 1

.pl 20

.pi 5

.fi

The program may have multiple input files that will all be given on the command line (i.e. formatter file1 file2 file3). The output file names are the input file names with extension out. (i.e. formatter file1 file2 file3 will produce files file1.out file2.out file3.out) If a given input file does not exist in the current directory, the program must give an error message but continue processing the other files (if any). If no input file is given in the command line, the program must read from the standard input and write to standard output. Assume that all input lines are less than 80 characters long.

text-formatting's People

Contributors

mebra005 avatar

Watchers

James Cloos avatar

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.