Giter Site home page Giter Site logo

phil9l / man2html Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 21 KB

Simple console application for converting from man (nroff format) into html for my university python course.

Python 100.00%
man2html nroff html-format nroff-format converter university-python-course

man2html's Introduction

MAN2HTML

Simple console application (written for my university python course) for converting from man (nroff format) into html.

Description

Converts nroff data into html format.

Usage

./main.py --input FILE [--output FILE]

Example

./main.py --input tmp.txt --output output.html Or to convert from man directly use the following one:

zcat `man -w g++` > in.txt; ./main.py -i in.txt -o out.html

Options

  • --input FILE — input file in nroff format
  • --output FILE — output file (will have html format)

Structure

utils.py

Subsidiary functions.

  • man2html(text_lines) — converts nroff text into html one by one
  • modify_line(line) — converts one line from nroff into html
  • apply_part_tags(line) — modifies line with one kind of tags while possible
  • apply_part_tags_once(line) — modifies line with the same kind of tags one
  • apply_not_closing_tags(line) — modifies line with one kind of tags that doesn't have closing ones
  • change_font(line) — changes current font based on line tags
  • update_font(positions) — updates current font based on nroff rules

main.py

Small script using utils to convert data from nroff into html format.

man2html's People

Contributors

phil9l avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.