06ae79322a
Use Nathan Weizenbaum's "cleanup" branch of Maruku. There were a few evident problems with his branch, so please report any anomalies you see.
133 lines
3.1 KiB
Ruby
133 lines
3.1 KiB
Ruby
# Copyright (C) 2006 Andrea Censi <andrea (at) rubyforge.org>
|
|
#
|
|
# This file is part of Maruku.
|
|
#
|
|
# Maruku is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Maruku is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Maruku; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
dir = File.dirname(__FILE__)
|
|
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
|
|
|
require 'rexml/document'
|
|
|
|
module MaRuKu
|
|
module In
|
|
module Markdown
|
|
module SpanLevelParser; end
|
|
module BlockLevelParser; end
|
|
end
|
|
end
|
|
|
|
module Out
|
|
module Markdown; end
|
|
module HTML; end
|
|
module Latex; end
|
|
end
|
|
|
|
module Strings; end
|
|
|
|
module Helpers; end
|
|
|
|
module Errors; end
|
|
|
|
class MDElement
|
|
include REXML
|
|
include MaRuKu
|
|
include Out::Markdown
|
|
include Out::HTML
|
|
include Out::Latex
|
|
include Strings
|
|
include Helpers
|
|
include Errors
|
|
end
|
|
|
|
|
|
class MDDocument < MDElement
|
|
include In::Markdown
|
|
include In::Markdown::SpanLevelParser
|
|
include In::Markdown::BlockLevelParser
|
|
end
|
|
end
|
|
|
|
class Maruku < MaRuKu::MDDocument; end
|
|
|
|
|
|
# Structures definition
|
|
require 'maruku/structures'
|
|
require 'maruku/structures_inspect'
|
|
|
|
require 'maruku/defaults'
|
|
# Less typing
|
|
require 'maruku/helpers'
|
|
|
|
# Code for parsing whole Markdown documents
|
|
require 'maruku/input/parse_doc'
|
|
|
|
# Ugly things kept in a closet
|
|
require 'maruku/string_utils'
|
|
require 'maruku/input/linesource'
|
|
require 'maruku/input/type_detection'
|
|
|
|
# A class for reading and sanitizing inline HTML
|
|
require 'maruku/input/html_helper'
|
|
|
|
# Code for parsing Markdown block-level elements
|
|
require 'maruku/input/parse_block'
|
|
|
|
# Code for parsing Markdown span-level elements
|
|
require 'maruku/input/charsource'
|
|
require 'maruku/input/parse_span_better'
|
|
require 'maruku/input/rubypants'
|
|
|
|
require 'maruku/input/extensions'
|
|
|
|
require 'maruku/attributes'
|
|
|
|
require 'maruku/structures_iterators'
|
|
|
|
require 'maruku/errors'
|
|
|
|
# Code for creating a table of contents
|
|
require 'maruku/toc'
|
|
|
|
# Support for div Markdown extension
|
|
require 'maruku/ext/div'
|
|
# Support for fenced codeblocks extension
|
|
require 'maruku/ext/fenced_code'
|
|
|
|
# Version and URL
|
|
require 'maruku/version'
|
|
|
|
|
|
# Exporting to html
|
|
require 'maruku/output/to_html'
|
|
|
|
# Exporting to latex
|
|
require 'maruku/output/to_latex'
|
|
require 'maruku/output/to_latex_strings'
|
|
require 'maruku/output/to_latex_entities'
|
|
|
|
# Pretty print
|
|
require 'maruku/output/to_markdown'
|
|
|
|
# S5 slides
|
|
require 'maruku/output/s5/to_s5'
|
|
require 'maruku/output/s5/fancy'
|
|
|
|
# Exporting to text: strips all formatting (not complete)
|
|
require 'maruku/output/to_s'
|
|
|
|
# class Maruku is the global interface
|
|
require 'maruku/maruku'
|