Git Product home page Git Product logo

lpmp's Introduction

lpmp - Leanpub Markdown Preprocessor

Usage

$ lpmp [-v|--verb] [-d|--dump] [-s sep] [-j] [-h]

The command reads Book.txt and *.lmp files and generates corresponding .txt or .md files. If Book.txt has a '01.txt' (or '01.md') entry, provide 01.lmp and run lpmp to produce 01.txt (or 01.md).

  • -s or --verb : display verbatim lines for debug
  • -d or --dump : display all lines under processing
  • -s sep : separator for section names in index (default .)
  • -j : enable joining lines by backslash at line end; this feature requires the 3rd pass
  • -h : show help

Commands available in .lmp files

In addition to the Leanpub Markdown syntax, the following commands are available in .lmp files.

  • @<kw>{word,yomi} : keyword to be indexed (in boldface); yomi can be omitted
  • @<idx>{word,yomi} : same as @<kw> but not boldface
  • @<hidx>{word,yomi} : hidden index, not appear as text

Giving any third argument to @<idx> or @<hidx> makes the index entry boldface. (e.g., @<idx>{foo,foo,1})

  • @<index>{} : generates index
  • @<ruby>{word,furigana} : give furigana
  • @<fig>{tag}[caption](file) : insert image
  • @<fig>(tag) : figure reference
  • @<tbl>{tag}[caption] ... @<tbl> : table block
  • @<tbl>(tag) : table reference
  • @<list>{tag}[caption](file) : insert code
  • @<list>{tag}[caption] ... @<list> : literal code block
  • @<list>(tag) : list reference
  • @<lists>{} : generates the list of lists
  • @<cmd>{option} ... @<cmd> : command-line session
  • @<slabel>{tag} : label the section
  • @<sref>(tag) : reference to section
  • @<bib>{tag} ... @<bib> : bibliography item
  • @<bib>(tag) : reference to bib item

Captions can include [...] to one level (nested ones not allowed).

@<fig>{, @<tbl>{ and @<list>{ can take options at end in {...} form: e.g., @<list>{...}[...]{linenos=off}

Do not add # in front of tags specified in @<...> commands; they automatically add one if necessary.

Other features

Joining lines : A single backslash (\) at end of line joins it with the next line (works in asides and footnotes as well). This feature is enabled by -j option. Note that this function is performed in the extra 3rd pass, which is after any lpmp commands are processed (i.e., it just joins Markdown lines).

Experimental

The following functions are experimental and may be changed or removed later:

  • @#, @##, and like make the heading unnumbered (with the small font, boldface)

lpmp's People

Contributors

kazutomi avatar

Watchers

James Cloos avatar  avatar

lpmp's Issues

Indexing

  • define syntax to specify words to be indexed, and create index
  • should process all files at once?
  • two pass?

Hard to find indexed term in footnote

In EPUB format, footnotes are collected and placed at the end of the book. Referencing sections (not pages) in the index makes readers go back and forth to the end of book after looking all around in the section to find the indexed term.

Indicating the term is in footnote in the index (like 2-15^footnote^) may alleviate their burdens.

list tag does not give id in EPUB

.lmp code like:

@<list>{foo}[Example 1: Hello, World]

generates:

{id="foo", title="List 1.1: Example 1: Hello, World"}
~~~~~~~~

but this text does not give HTML ID foo to the block; It generates:

<div class="code-block">
  <p class="codeblock-title">List 1.1: Example 1: Hello, World</p>

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.