Coder Social home page Coder Social logo

aaigner / lammps-doc-utils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rbberger/lammps-doc-utils

0.0 2.0 0.0 113 KB

Utilities for converting LAMMPS txt docs to Sphinx ReStructuredText

License: GNU General Public License v3.0

Python 100.00%

lammps-doc-utils's Introduction

LAMMPS Documentation Utilities

Build Status

This repository contains a set of utilities to convert existing LAMMPS documentation text files into ReStructured Text. These files can then be used to generate documentation using Sphinx (www.sphinx-doc.org).

The goal of these tools is to simplify the transition to this new format by automatically transforming existing formatting and adding some semantic replacements.

Contents

  • A Python port of txt2html
  • A new txt2rst utility which transforms txt files directly into ReStructured Text for Sphinx
  • Unit tests

Prerequisites

  • Currently these tools only run on Python 3

Sphinx requirements

The generated ReStructured Text assumes you've installed both sphinx and sphinxcontrib-images. Both can be installed through pip:

pip3 install sphinx
pip3 install sphinxcontrib-images

Once Sphinx is set up adjust your configuration conf.py to use the sphinxcontrib-images extension:

extensions = [
              ...
              'sphinxcontrib.images',
              ...
]

Installation

  1. Clone this repository

  2. Add the bin folder to your PATH environment variable

    export PATH=/your/install/directory/bin:$PATH

Usage

Convert .txt files using txt2rst:

# single files
txt2rst Manual.txt > Manual.rst

# multiple files
txt2rst *.txt

Backwards compatibility with txt2html

RST portions

Since the original txt2html passes through HTML tags the following syntax can be used to invalidate RST code:

<!-- RST

.. toctree::
   :maxdepth: 2
   :numbered:
   
   Section_intro
   Section_start
   Section_commands

END_RST -->

HTML_ONLY portions

At the same time, some contents of the original txt files might no longer be needed when compiling the RST files using Sphinx. These regions can be marked using a HTML_ONLY region:

<!-- HTML_ONLY -->
<HEAD>
<TITLE>LAMMPS Users Manual</TITLE>
...
</HEAD>

<BODY>
<!-- END_HTML_ONLY -->

lammps-doc-utils's People

Contributors

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