Domain-Specific text markup parser.
Ruby
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
lib
test
testfiles
CHANGELOG.rdoc
COPYING
README.rdoc
Rakefile
TODO.rdoc
VERSION

README.rdoc

Semantic Text

Semantic Text is a Domain-Specific text markup parser. It takes a file or sequence of lines and returns an object model of the document, including document metadata (e.g. doc creation time and title) and a tree of interconnected objects describing the document structure.

How to use it

  • You need to have installed gemcutter.org into your gem locations.

  • Install with:

    gem install semantictext
  • Parse like this:

    require 'rubygems'
    require 'semantictext'
    
    p = SemanticText::Document.new
    p.parse 'title: my happy document'
    p.parse ''
    p.parse "!I'm a title"
    p.parse "I'm a paragraph..."
    p.parse "... yep, I'm still that paragraph."
    p.parse ''
    p.parse "* I'm a bullet point"
    p.parse "* I'm another bullet point"
    
    puts p.export_html           # this is how to export as a HTML fragment
  • rdoc www.greenbarsoft.co.uk/software/semantictext/rdoc/

  • source github.com/dafydd/semantictext

  • To build me, set an environment variable called SANDBOX to the directory above your semantictext directory. The tests need this to access test data.

Semantic Markup

Semantic text supports:

  • document metadata

  • section headers

  • nested bullet points

  • paragraphs that contain markup tags

  • inline hyperlinks for http: mailto: and ftp:

  • markup tags within bullet points

  • custom markup tags e.g. postal code, youtube video embed, … whatever you define in a subclass of SemanticText::DefaultTagFactory

  • verbatim code blocks delimited by lines marked “{{{” and “}}}” respectively

Compatibility

This project is being developed on OS X. Automated testing for Linux will be included in future releases.

Licence

This is open source software and comes with no warranty. See COPYING for details.

www.greenbarsoft.co.uk

Copyright 2009 Green Bar Software Limited, UK