gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/000077500000000000000000000000001317564624300217755ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/.gitignore000066400000000000000000000000501317564624300237600ustar00rootroot00000000000000*.pyc pkg/ .bundle Gemfile.lock vendor/ gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/.gitlab-ci.yml000066400000000000000000000006241317564624300244330ustar00rootroot00000000000000variables: LANG: "C.UTF-8" .specs: &specs cache: paths: - vendor/ruby before_script: - apt update - apt install python-pip git build-essential -y - pip install 'docutils==0.13.1' - bundle install --jobs $(nproc) script: - bundle exec rake test ruby-21: image: ruby:2.1 <<: *specs ruby-22: image: ruby:2.2 <<: *specs ruby-23: image: ruby:2.3 <<: *specs gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/.kick000066400000000000000000000010621317564624300227160ustar00rootroot00000000000000# take control of the growl notifications module GrowlHacks def growl(type, subject, body, *args, &block) case type when Kicker::GROWL_NOTIFICATIONS[:succeeded] puts subject = "Success" body = body.split("\n").last when Kicker::GROWL_NOTIFICATIONS[:failed] subject = "Failure" puts body body = body.split("\n").last else return nil end super(type, subject, body, *args, &block) end end Kicker.send :extend, GrowlHacks # no logging Kicker::Utils.module_eval do def log(message) nil end endgitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/.travis.yml000066400000000000000000000004471317564624300241130ustar00rootroot00000000000000language: ruby rvm: - 2.0.0 - 2.1.1 - jruby-19mode jdk: - oraclejdk8 notifications: email: false git: depth: 10 before_install: sudo pip install docutils cache: - bundler - pip env: global: - "JRUBY_OPTS=-Xcext.enabled=true" matrix: allow_failures: - rvm: jruby-19mode gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/CONTRIBUTING.md000066400000000000000000000070611317564624300242320ustar00rootroot00000000000000# Contributing Thank you for your interest in contributing to this GitLab project! We welcome all contributions. By participating in this project, you agree to abide by the [code of conduct](#code-of-conduct). This library's only job is to decide which markup format to use and call out to an external library to convert the markup to HTML (see the [README](README.md) for more information on how markup is rendered) ## Contributor license agreement By submitting code as an individual you agree to the [individual contributor license agreement][individual-agreement]. By submitting code as an entity you agree to the [corporate contributor license agreement][corporate-agreement]. ## Code of conduct As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Instances of abusive, harassing, or otherwise unacceptable behavior can be reported by emailing contact@gitlab.com. This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant], version 1.1.0, available at [http://contributor-covenant.org/version/1/1/0/](http://contributor-covenant.org/version/1/1/0/). [contributor-covenant]: http://contributor-covenant.org [individual-agreement]: https://docs.gitlab.com/ee/legal/individual_contributor_license_agreement.html [corporate-agreement]: https://docs.gitlab.com/ee/legal/corporate_contributor_license_agreement.html ## Submitting a Merge Request 1. Fork it. 2. Create a branch (`git checkout -b my_markup`) 3. Commit your changes (`git commit -am "Added Snarkdown"`) 4. Push to the branch (`git push origin my_markup`) 5. Open a [Merge Request][1] 6. Enjoy a refreshing Diet Coke and wait ## Testing To run the tests: $ rake If nothing complains, congratulations! ## Releasing a new version If you are the current maintainer of this gem: 0. Bump the version number in `lib/github-markup.rb`, adhering to [Semantic Versioning](http://semver.org/) 0. Update `HISTORY.md` 0. Test the latest version on GitHub 0. Build the new version with `rake build` 0. Copy `pkg/gitlab-markup*.gem` to `vendor/cache` in your local checkout of GitHub 0. Update the version for `gitlab-markup` in the `Gemfile` 0. Run `bundle update --local gitlab-markup` 0. Run any relevant tests and test it manually from the browser. 0. Push the new gem release with `rake release`. If you don't have permission to release to rubygems.org, contact one of the existing owners (`gem owners gitlab-markup`) and ask them to add you. [1]: https://gitlab.com/gitlab-org/gitlab-markup/merge_requests gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/Gemfile000066400000000000000000000005021317564624300232650ustar00rootroot00000000000000source "http://rubygems.org" gemspec gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" gem "rdoc", "~>3.6" gem "org-ruby", "~> 0.9" gem "creole", "~>0.5.0" gem "wikicloth", "=0.8.1", :platforms => :ruby gem "asciidoctor", "= 1.5.2" gem "rake" gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/HISTORY.md000066400000000000000000000067161317564624300234720ustar00rootroot00000000000000## 1.6.3 (2017-10-30) * Support PlantUML caption option and `uml::` directive ## 1.6.2 (2017-09-20) * Support PlantUML blocks in reStructuredText ## 1.6.0 (2017-05-01) * Updated docutils support (now requires 0.13.1) ## 1.5.1 (2017-01-09) * Disable rendering from `.. raw::` content block ## 1.5.0 (2016-10-13) * GitLab CI support * Fixed `.pod` test files to use newer syntax. * Changes to support Python 3 (it's not out-of-the box yet, you still need to patch code) * Gem published as 'gitlab-markup' ## 1.3.3 (2015-02-17) * Address a slight typo with `POSIX` [#456](https://github.com/github/markup/pull/456) [Full changelog](https://github.com/github/markup/compare/v1.3.2...v1.3.3) ## 1.3.2 (2015-02-17) * RST: Output code instead of tt for inline literals [#370](https://github.com/github/markup/pull/370) * RST: Add IDs to headers so that `.. contents` works with `.. sectnum` [#391](https://github.com/github/markup/pull/391) [Full changelog](https://github.com/github/markup/compare/v1.3.1...v1.3.2) ## 1.3.1 (2014-11-13) * Fix name error when trying to use newer versions of RedCarpet [#387](https://github.com/github/markup/pull/387) [Full changelog](https://github.com/github/markup/compare/v1.3.0...v1.3.1) ## 1.3.0 (2014-09-11) * Extend the field limit for tables to 50 characters for RST [#306](https://github.com/github/markup/pull/306) * Add `.mkdn` as a supported markdown extension [#308](https://github.com/github/markup/pull/308) * Upgrade wikicloth to 0.8.1 [#317](https://github.com/github/markup/pull/317) * Force encoding of posix-spawn output [#338](https://github.com/github/markup/pull/338) * Add `.rmd` as a supported markdown extension [#343](https://github.com/github/markup/pull/343) [Full changelog](https://github.com/github/markup/compare/v1.2.1...v1.3.0) ## 1.2.1 (2014-04-23) * Disable RST warnings [#290](https://github.com/github/markup/pull/290) [Full changelog](https://github.com/github/markup/compare/v1.2.0...v1.2.1) ## 1.1.1 (2014-04-03) * Upgrade to org-ruby 0.9.1 * Set default encoding to UTF-8 for Python 2 ## 1.1.0 (2014-03-10) * Raise GitHub::Markup::CommandError if external command exits with a non-zero status. * Remove support for literate Haskell (see #266) ## 0.5.1 (2010-09-30) * Support relative path links in rdoc ## 0.5.0 (2010-07-07) * Added creole support ## 0.4.0 (2010-04-23) * Removed man page support until it's ready. ## 0.3.3 (2010-03-29) * UTF-8 works with ReST now. ## 0.3.2 (2010-03-25) * Improved test runner * Forgive ReST problems that aren't user errors. ## 0.3.1 (2010-03-22) * Add .rst.txt extension * Fix ASCII encoding error while using print u'\u010c' non-ASCII char and similar. ## 0.3.0 (2010-03-11) * man rendering * `github-markup` command line runner ## 0.2.2 (2010-02-09) * pod fixes from Ricardo Signes ## 0.2.1 (2010-01-25) * ReST fixes from Michael Jones ## 0.2.0 (2010-01-10) * org-mode support ## 0.1.7 (2009-11-17) * Ditch asciidoc2html, call asciidoc directly ## 0.1.6 (2009-11-17) * mdown ## 0.1.5 (2009-11-17) * Actually, if we can't render a thing then don't. Not once, not never. ## 0.1.4 (2009-11-17) * Bugfix: Missing commands return the input (instead of nothing) ## 0.1.3 (2009-11-02) * Strip the INDEX comments from POD ## 0.1.2 (2009-11-02) * Renamed to `github-markup` * Bugfix: POD rendering works now, not just index ## 0.1.1 (2009-11-02) * Added `GitHub::Markup.can_render?` helper. * Bugfix: Actually check file extensions ## 0.1.0 (2009-11-02) * First release gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/LICENSE000066400000000000000000000020321317564624300227770ustar00rootroot00000000000000Copyright (c) 2009 GitHub Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/README.md000066400000000000000000000057621317564624300232660ustar00rootroot00000000000000GitLab Markup ============= [![build status](https://gitlab.com/gitlab-org/gitlab-markup/badges/master/build.svg)](https://gitlab.com/gitlab-org/gitlab-markup/commits/master) This library is a fork of GitHub Markup, which is used to render all non Markdown markups: 0. This library converts the raw markup to HTML. See the list of [supported markup formats](#markups) below. 0. The HTML is sanitized, aggressively removing things that could harm you and your kin—such as `script` tags, inline-styles, and `class` or `id` attributes. See the [sanitization filter](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb) for the full whitelist. 0. Syntax highlighting is performed on code blocks. See [github/linguist](https://github.com/github/linguist#syntax-highlighting) for more information about syntax highlighting. 0. The HTML is passed through other filters in the [html-pipeline](https://github.com/jch/html-pipeline) that add special sauce, such as [emoji](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/emoji_filter.rb), [task lists](https://github.com/github/task_list/blob/master/lib/task_list/filter.rb), [named anchors](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/toc_filter.rb), [CDN caching for images](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/camo_filter.rb), and [autolinking](https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/autolink_filter.rb). 0. The resulting HTML is rendered. Please see our [contributing guidelines](CONTRIBUTING.md) before reporting an issue. Markups ------- The following markups are supported. The dependencies listed are required if you wish to run the library. You can also run `script/bootstrap` to fetch them all. * [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet) * [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth` * [.rdoc](http://rdoc.sourceforge.net/) -- `gem install rdoc -v 3.6.1` * [.org](http://orgmode.org/) -- `gem install org-ruby` * [.creole](http://wikicreole.org/) -- `gem install creole` * [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` * [.rst](http://docutils.sourceforge.net/rst.html) -- `pip install docutils==0.13.1` * [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org) * [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install [Pod::Simple](http://search.cpan.org/~dwheeler/Pod-Simple-3.28/lib/Pod/Simple.pod) from CPAN. Installation ----------- ``` gem install gitlab-markup ``` Usage ----- ```ruby require 'github/markup' GitHub::Markup.render('README.markdown', "* One\n* Two") ``` Or, more realistically: ```ruby require 'github/markup' GitHub::Markup.render(file, File.read(file)) ``` Contributing ------------ See [Contributing](CONTRIBUTING.md) gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/Rakefile000066400000000000000000000005451317564624300234460ustar00rootroot00000000000000#!/usr/bin/env rake require "bundler/gem_tasks" require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = true end desc "Open an irb session preloaded with this library" task :console do sh "irb -I lib -r bundler/setup -r github/markup" end task :default => :test gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/bin/000077500000000000000000000000001317564624300225455ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/bin/github-markup000077500000000000000000000003241317564624300252510ustar00rootroot00000000000000#!/usr/bin/env ruby $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" require 'github/markup' if ARGV[0] && File.exists?(file = ARGV[0]) puts GitHub::Markup.render(file) else puts "usage: #$0 FILE" end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/gitlab-markup.gemspec000066400000000000000000000021421317564624300261000ustar00rootroot00000000000000require File.expand_path("../lib/github-markup", __FILE__) Gem::Specification.new do |s| s.name = "gitlab-markup" s.version = GitHub::Markup::VERSION s.summary = "The code GitHub uses to render README.markup" s.description = "This gem is used by GitHub to render any fancy markup such " + "as Markdown, Textile, Org-Mode, etc. Fork it and add your own!" s.authors = ["Chris Wanstrath"] s.email = "chris@ozmm.org" s.homepage = "https://gitlab.com/gitlab-org/gitlab-markup" s.license = "MIT" s.files = `git ls-files`.split($\) s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = %w[lib] s.add_development_dependency 'activesupport', '~> 4.0' s.add_development_dependency 'minitest', '~> 5.4.3' s.add_development_dependency 'html-pipeline', '~> 1.0' s.add_development_dependency 'sanitize', '~> 2.1.0' s.add_development_dependency 'nokogiri', '~> 1.6.1' s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/000077500000000000000000000000001317564624300225435ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github-markup.rb000066400000000000000000000001241317564624300256440ustar00rootroot00000000000000module GitHub module Markup VERSION = '1.6.3' Version = VERSION end end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/000077500000000000000000000000001317564624300240255ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/commands/000077500000000000000000000000001317564624300256265ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/commands/rest2html000077500000000000000000000173041317564624300275050ustar00rootroot00000000000000#!/usr/bin/env python """ rest2html - A small wrapper file for parsing ReST files at GitHub. Written in 2008 by Jannis Leidel Brandon Keepers Bryan Veloso Chris Wanstrath Dave Abrahams Garen Torikian Gasper Zejn Michael Jones Sam Whited Tyler Chung Vicent Marti To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see . """ __author__ = "Jannis Leidel" __license__ = "CC0" __version__ = "0.2" import sys import os # This fixes docutils failing with unicode parameters to CSV-Table. The -S # switch and the following 3 lines can be removed after upgrading to python 3. if sys.version_info[0] < 3: reload(sys) sys.setdefaultencoding('utf-8') import site try: import locale locale.setlocale(locale.LC_ALL, '') except: pass import codecs import io from docutils import nodes, statemachine from docutils.parsers.rst import directives, roles from docutils.parsers.rst.directives.body import CodeBlock from docutils.core import publish_parts from docutils.writers.html4css1 import Writer, HTMLTranslator SETTINGS = { 'cloak_email_addresses': False, 'file_insertion_enabled': False, 'raw_enabled': False, 'strip_comments': True, 'doctitle_xform': True, 'sectsubtitle_xform': True, 'initial_header_level': 2, 'report_level': 5, 'syntax_highlight': 'none', 'math_output': 'latex', 'field_name_limit': 50, } class DoctestDirective(CodeBlock): """Render Sphinx 'doctest:: [group]' blocks as 'code:: python' """ def run(self): """Discard any doctest group argument, render contents as python code """ self.arguments = ['python'] return super(DoctestDirective, self).run() class PlantumlDirective(CodeBlock): """ Render 'plantuml::' blocks as 'code:: plantuml', so they will be picked up in GitLab by the generic Banzai::Filter::PlantumlFilter """ option_spec = CodeBlock.option_spec.copy() option_spec.update({ 'caption': directives.unchanged }) def run(self): self.arguments = ['plantuml'] node = super(PlantumlDirective, self).run() if 'caption' in self.options: # create an anonymous container to parse the caption content container = nodes.Element() content = statemachine.StringList([self.options['caption']]) self.state.nested_parse(content, self.content_offset, container) caption = nodes.caption(self.options['caption'], '', *container) node.append(caption) return node class GitHubHTMLTranslator(HTMLTranslator, object): # removes the
tag wrapped around docs # see also: http://bit.ly/1exfq2h (warning! sourceforge link.) def depart_document(self, node): HTMLTranslator.depart_document(self, node) self.html_body.pop(0) # pop the starting
off self.html_body.pop() # pop the ending
off # technique for visiting sections, without generating additional divs # see also: http://bit.ly/NHtyRx # the a is to support ::contents with ::sectnums: http://git.io/N1yC def visit_section(self, node): id_attribute = node.attributes['ids'][0] self.body.append('\n' % id_attribute) self.section_level += 1 def depart_section(self, node): self.section_level -= 1 def visit_literal_block(self, node): classes = node.attributes['classes'] if len(classes) >= 2 and classes[0] == 'code': language = classes[1] del classes[:] self.body.append(self.starttag(node, 'pre')) self.body.append(self.starttag(node, 'code', lang=language)) else: self.body.append(self.starttag(node, 'pre')) self.body.append(self.starttag(node, 'code')) def depart_literal_block(self, node): self.body.append('') return super(GitHubHTMLTranslator, self).depart_literal_block(node) # always wrap two-backtick rst inline literals in , not # this also avoids the generation of superfluous tags def visit_literal(self, node): self.body.append(self.starttag(node, 'code', suffix='')) def depart_literal(self, node): self.body.append('') def visit_table(self, node): classes = ' '.join(['docutils', self.settings.table_style]).strip() self.body.append( self.starttag(node, 'table', CLASS=classes)) def depart_table(self, node): self.body.append('\n') def depart_image(self, node): uri = node['uri'] ext = os.path.splitext(uri)[1].lower() # we need to swap RST's use of `object` with `img` tags # see http://git.io/5me3dA if ext == ".svg": # preserve essential attributes atts = {} for attribute, value in node.attributes.items(): # we have no time for empty values if value: if attribute == "uri": atts['src'] = value else: atts[attribute] = value # toss off `object` tag self.body.pop() # add on `img` with attributes self.body.append(self.starttag(node, 'img', **atts)) HTMLTranslator.depart_image(self, node) def kbd(name, rawtext, text, lineno, inliner, options=None, content=None): return [nodes.raw('', '%s' % text, format='html')], [] def main(): """ Parses the given ReST file or the redirected string input and returns the HTML body. Usage: rest2html < README.rst rest2html README.rst """ try: text = codecs.open(sys.argv[1], 'r', 'utf-8').read() except IOError: # given filename could not be found return '' except IndexError: # no filename given if sys.version_info[0] < 3: # python 2.x text = sys.stdin.read() else: # python 3 input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') text = input_stream.read() writer = Writer() writer.translator_class = GitHubHTMLTranslator roles.register_canonical_role('kbd', kbd) # Render source code in Sphinx doctest blocks directives.register_directive('doctest', DoctestDirective) # Render source code in Sphinx plantuml blocks # Also support uml:: directive for compatibility with sphinxcontrib-plantuml directives.register_directive('plantuml', PlantumlDirective) directives.register_directive('uml', PlantumlDirective) parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS) if 'html_body' in parts: html = parts['html_body'] # publish_parts() in python 2.x return dict values as Unicode type # in py3k Unicode is unavailable and values are of str type if isinstance(html, str): return html else: return html.encode('utf-8') return '' if __name__ == '__main__': if sys.version_info[0] < 3: # python 2.x sys.stdout.write("%s%s" % (main(), "\n")) else: # python 3 output_stream = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') output_stream.write("%s%s" % (main(), "\n")) sys.stdout.flush() gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/markup.rb000066400000000000000000000021661317564624300256560ustar00rootroot00000000000000require "github/markup/command_implementation" require "github/markup/gem_implementation" module GitHub module Markup extend self @@markups = [] def markups @@markups end def preload! markups.each do |markup| markup.load end end def render(filename, content = nil) content ||= File.read(filename) if impl = renderer(filename) impl.render(content) else content end end def markup(file, pattern, opts = {}, &block) markups << GemImplementation.new(pattern, file, &block) end def command(command, regexp, name, &block) if File.exist?(file = File.dirname(__FILE__) + "/commands/#{command}") command = file end markups << CommandImplementation.new(regexp, command, name, &block) end def can_render?(filename) !!renderer(filename) end def renderer(filename) markups.find { |impl| impl.match?(filename) } end # Define markups markups_rb = File.dirname(__FILE__) + '/markups.rb' instance_eval File.read(markups_rb), markups_rb end end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/markup/000077500000000000000000000000001317564624300253245ustar00rootroot00000000000000command_implementation.rb000066400000000000000000000033061317564624300323170ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/markupbegin require "posix-spawn" rescue LoadError require "open3" end require "github/markup/implementation" module GitHub module Markup class CommandError < RuntimeError end class CommandImplementation < Implementation attr_reader :command, :block, :name def initialize(regexp, command, name, &block) super regexp @command = command.to_s @block = block @name = name end def render(content) rendered = execute(command, content) rendered = rendered.to_s.empty? ? content : rendered call_block(rendered, content) end private def call_block(rendered, content) if block && block.arity == 2 block.call(rendered, content) elsif block block.call(rendered) else rendered end end if defined?(POSIX::Spawn) def execute(command, target) spawn = POSIX::Spawn::Child.new(*command, :input => target) if spawn.status.success? sanitize(spawn.out, target.encoding) else raise CommandError.new(spawn.err.strip) end end else def execute(command, target) output = Open3.popen3(*command) do |stdin, stdout, stderr, wait_thr| stdin.puts target stdin.close if wait_thr.value.success? stdout.readlines else raise CommandError.new(stderr.readlines.join('').strip) end end sanitize(output.join(''), target.encoding) end end def sanitize(input, encoding) input.gsub("\r", '').force_encoding(encoding) end end end end gem_implementation.rb000066400000000000000000000010351317564624300314460ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/markuprequire "github/markup/implementation" module GitHub module Markup class GemImplementation < Implementation attr_reader :gem_name, :renderer def initialize(regexp, gem_name, &renderer) super regexp @gem_name = gem_name.to_s @renderer = renderer end def load return if @loaded require gem_name @loaded = true end def render(content) load renderer.call(content) end def name gem_name end end end end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/markup/implementation.rb000066400000000000000000000010161317564624300306740ustar00rootroot00000000000000module GitHub module Markup class Implementation attr_reader :regexp def initialize(regexp) @regexp = regexp end def load # no-op by default end def render(content) raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render" end def match?(filename) file_ext_regexp =~ filename end private def file_ext_regexp @file_ext_regexp ||= /\.(#{regexp})\z/ end end end end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/markup/markdown.rb000066400000000000000000000025321317564624300274750ustar00rootroot00000000000000require "github/markup/implementation" module GitHub module Markup class Markdown < Implementation MARKDOWN_GEMS = { "github/markdown" => proc { |content| GitHub::Markdown.render(content) }, "redcarpet" => proc { |content| Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(content) }, "rdiscount" => proc { |content| RDiscount.new(content).to_html }, "maruku" => proc { |content| Maruku.new(content).to_html }, "kramdown" => proc { |content| Kramdown::Document.new(content).to_html }, "bluecloth" => proc { |content| BlueCloth.new(content).to_html }, } def initialize super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i) end def load return if @renderer MARKDOWN_GEMS.each do |gem_name, renderer| if try_require(gem_name) @renderer = renderer return end end raise LoadError, "no suitable markdown gem found" end def render(content) load @renderer.call(content) end def name "markdown" end private def try_require(file) require file true rescue LoadError false end end end end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/markup/rdoc.rb000066400000000000000000000007471317564624300266100ustar00rootroot00000000000000require "github/markup/implementation" require "rdoc" require "rdoc/markup/to_html" module GitHub module Markup class RDoc < Implementation def initialize super /rdoc/ end def render(content) if ::RDoc::VERSION.to_i >= 4 h = ::RDoc::Markup::ToHtml.new(::RDoc::Options.new) else h = ::RDoc::Markup::ToHtml.new end h.convert(content) end def name "rdoc" end end end end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/lib/github/markups.rb000066400000000000000000000030121317564624300260300ustar00rootroot00000000000000require "github/markup/markdown" require "github/markup/rdoc" require "shellwords" markups << GitHub::Markup::Markdown.new markup(:redcloth, /textile/) do |content| RedCloth.new(content).to_html end markups << GitHub::Markup::RDoc.new markup('org-ruby', /org/) do |content| Orgmode::Parser.new(content, { :allow_include_files => false, :skip_syntax_highlight => true }).to_html end markup(:creole, /creole/) do |content| Creole.creolize(content) end markup(:wikicloth, /mediawiki|wiki/) do |content| wikicloth = WikiCloth::WikiCloth.new(:data => content) WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' wikicloth.to_html(:noedit => true) end markup(:asciidoctor, /adoc|asc(iidoc)?/) do |content| Asciidoctor::Compliance.unique_id_start_index = 1 Asciidoctor.convert(content, :safe => :secure, :attributes => %w(showtitle=@ idprefix idseparator=- env=github env-github source-highlighter=html-pipeline)) end command( "python2 -S #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html", /re?st(\.txt)?/, "restructuredtext" ) # pod2html is nice enough to generate a full-on HTML document for us, # so we return the favor by ripping out the good parts. # # Any block passed to `command` will be handed the command's STDOUT for # post processing. command('/usr/bin/env perl -MPod::Simple::HTML -e Pod::Simple::HTML::go', /pod/, "pod") do |rendered| if rendered =~ /\s*(.+)\s*/mi $1 end end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/script/000077500000000000000000000000001317564624300233015ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/script/bootstrap000077500000000000000000000001211317564624300252360ustar00rootroot00000000000000#!/bin/bash set -e cd $(dirname "$0")/.. bundle install easy_install docutils gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/script/cibuild000077500000000000000000000006271317564624300246470ustar00rootroot00000000000000#!/bin/bash set -e # GC customizations export RUBY_GC_MALLOC_LIMIT=79000000 export RUBY_HEAP_MIN_SLOTS=800000 export RUBY_HEAP_FREE_MIN=100000 export RUBY_HEAP_SLOTS_INCREMENT=400000 export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 export PATH="/usr/share/rbenv/shims:$PATH" export RBENV_VERSION="1.9.3" # bootstrap gem environment changes echo "Bootstrapping gem environment ..." script/bootstrap --local rake gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/000077500000000000000000000000001317564624300227545ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/fixtures/000077500000000000000000000000001317564624300246255ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/fixtures/fail.sh000077500000000000000000000000701317564624300260740ustar00rootroot00000000000000#!/usr/bin/env bash echo "failure message">&2 && false gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markup_test.rb000066400000000000000000000076721317564624300256530ustar00rootroot00000000000000# encoding: UTF-8 $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" require 'github/markup' require 'minitest/autorun' require 'html/pipeline' require 'nokogiri' require 'nokogiri/diff' def normalize_html(text) text.strip! text.gsub!(/\s\s+/,' ') text.gsub!(/\p{Pi}|\p{Pf}|&quot;/u,'"') text.gsub!("\u2026",'...') text end def assert_html_equal(expected, actual, msg = nil) assertion = Proc.new do expected_doc = Nokogiri::HTML(expected) {|config| config.noblanks} actual_doc = Nokogiri::HTML(actual) {|config| config.noblanks} expected_doc.search('//text()').each {|node| node.content = normalize_html node.content} actual_doc.search('//text()').each {|node| node.content = normalize_html node.content} ignore_changes = {"+" => Regexp.union(/^\s*id=".*"\s*$/), "-" => nil} expected_doc.diff(actual_doc) do |change, node| if change != ' ' && !node.blank? then break unless node.to_html =~ ignore_changes[change] end end end assert(assertion.call, msg) end class MarkupTest < Minitest::Test class MarkupFilter < HTML::Pipeline::Filter def call filename = context[:filename] GitHub::Markup.render(filename, File.read(filename)).strip.force_encoding("utf-8") end end Pipeline = HTML::Pipeline.new [ MarkupFilter, HTML::Pipeline::SanitizationFilter ] Dir['test/markups/README.*'].each do |readme| next if readme =~ /html$/ markup = readme.split('/').last.gsub(/^README\./, '') define_method "test_#{markup}" do skip "Skipping MediaWiki test because wikicloth is currently not compatible with JRuby." if markup == "mediawiki" && RUBY_PLATFORM == "java" source = File.read(readme) expected_file = "#{readme}.html" expected = File.read(expected_file).rstrip actual = Pipeline.to_html(nil, :filename => readme) if source != expected assert(source != actual, "#{markup} did not render anything") end diff = IO.popen("diff -u - #{expected_file}", 'r+') do |f| f.write actual f.close_write f.read end assert_html_equal expected, actual, < e assert_equal "failure message", e.message else fail "an exception was expected but was not raised" end end def test_preserve_markup content = "Noël" assert_equal content.encoding.name, GitHub::Markup.render('Foo.rst', content).encoding.name end end gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/000077500000000000000000000000001317564624300244365ustar00rootroot00000000000000gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.asciidoc000066400000000000000000000003631317564624300270750ustar00rootroot00000000000000= Document Title == First Section * One * Two Refer to <> or <>. == Another Section NOTE: Here is some source code. ```ruby puts "Hello, World!" ``` * [ ] todo * [x] done == Another Section content gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.asciidoc.html000066400000000000000000000012321317564624300300340ustar00rootroot00000000000000

Document Title

First Section

  • One

  • Two

Another Section

Note
Here is some source code.
puts "Hello, World!"
  • ❏ todo

  • ✓ done

Another Section

content

gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.creole000066400000000000000000000017711317564624300265740ustar00rootroot00000000000000= H1 = == H2 == paragraph of text that will be turned into a paragraph element. It can go over several lines with line breaks, it will be turned into a contiguous paragraph element. You can force a linebreak in your paragraph text\\thusly. * a list element ** sub list element * 2nd list element {{{ pre formatted text $ ls -la total 56 drwxr-xr-x 6 nferrier users 4096 Jul 5 23:10 . drwxr-x--- 120 nferrier users 12288 Jul 5 19:36 .. drwxr-xr-x 2 nferrier users 4096 Jul 5 18:19 bin -rw-r--r-- 1 nferrier users 6 Jul 5 18:19 .gitignore drwxr-xr-x 4 nferrier users 4096 Jul 5 23:10 .hg -rw-r--r-- 1 nferrier users 1182 Jul 5 18:19 HISTORY.md -rw-r--r-- 1 nferrier users 562 Jul 5 18:19 .kick drwxr-xr-x 3 nferrier users 4096 Jul 5 18:19 lib -rw-r--r-- 1 nferrier users 1050 Jul 5 18:19 LICENSE -rw-r--r-- 1 nferrier users 1312 Jul 5 18:19 Rakefile -rw-r--r-- 1 nferrier users 3390 Jul 5 18:19 README.md drwxr-xr-x 3 nferrier users 4096 Jul 5 18:19 test }}} gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.creole.html000066400000000000000000000020541317564624300275320ustar00rootroot00000000000000

H1

H2

paragraph of text that will be turned into a paragraph element. It can go over several lines with line breaks, it will be turned into a contiguous paragraph element.

You can force a linebreak in your paragraph text
thusly.

  • a list element
    • sub list element
  • 2nd list element
pre formatted text

$ ls -la
total 56
drwxr-xr-x   6 nferrier users  4096 Jul  5 23:10 .
drwxr-x--- 120 nferrier users 12288 Jul  5 19:36 ..
drwxr-xr-x   2 nferrier users  4096 Jul  5 18:19 bin
-rw-r--r--   1 nferrier users     6 Jul  5 18:19 .gitignore
drwxr-xr-x   4 nferrier users  4096 Jul  5 23:10 .hg
-rw-r--r--   1 nferrier users  1182 Jul  5 18:19 HISTORY.md
-rw-r--r--   1 nferrier users   562 Jul  5 18:19 .kick
drwxr-xr-x   3 nferrier users  4096 Jul  5 18:19 lib
-rw-r--r--   1 nferrier users  1050 Jul  5 18:19 LICENSE
-rw-r--r--   1 nferrier users  1312 Jul  5 18:19 Rakefile
-rw-r--r--   1 nferrier users  3390 Jul  5 18:19 README.md
drwxr-xr-x   3 nferrier users  4096 Jul  5 18:19 test
gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.litcoffee000066400000000000000000000016731317564624300272640ustar00rootroot00000000000000Literate CoffeeScript Test -------------------------- > Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee comment comment test "basic literate CoffeeScript parsing", -> ok yes now with a... test "broken up indentation", -> ... broken up ... do -> ... nested block. ok yes Code must be separated from text by a blank line. test "code blocks must be preceded by a blank line", -> The next line is part of the text and will not be executed. fail() ok yes Code in `backticks is not parsed` and... test "comments in indented blocks work", -> do -> do -> # Regular comment. ### Block comment. ### ok yes Regular [Markdown](http://example.com/markdown) features, like links and unordered lists, are fine: * I * Am * A * List Tabs work too: test "tabbed code", -> ok yes gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.litcoffee.html000066400000000000000000000023451317564624300302240ustar00rootroot00000000000000

Literate CoffeeScript Test

Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee

comment comment

test "basic literate CoffeeScript parsing", ->
  ok yes

now with a...

test "broken up indentation", ->

... broken up ...

  do ->

... nested block.

    ok yes

Code must be separated from text by a blank line.

test "code blocks must be preceded by a blank line", ->

The next line is part of the text and will not be executed. fail()

  ok yes

Code in backticks is not parsed and...

test "comments in indented blocks work", ->
  do ->
    do ->
      # Regular comment.

      ###
        Block comment.
      ###

      ok yes

Regular Markdown features, like links and unordered lists, are fine:

  • I

  • Am

  • A

  • List

Tabs work too:

test "tabbed code", -> ok yes

gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.markdown000066400000000000000000000000141317564624300271320ustar00rootroot00000000000000* One * Two gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.markdown.html000066400000000000000000000000441317564624300301000ustar00rootroot00000000000000
  • One
  • Two
gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.noformat000066400000000000000000000000141317564624300271350ustar00rootroot00000000000000* One * Two gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.noformat.html000066400000000000000000000000131317564624300300770ustar00rootroot00000000000000* One * Twogitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.org000066400000000000000000000101741317564624300261070ustar00rootroot00000000000000#+TITLE: org-ruby #+AUTHOR: Brian Dewey #+EMAIL: bdewey@gmail.com #+DATE: 2009-12-21 #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+OPTIONS: H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc #+EXPORT_EXCLUDE_TAGS: exclude #+STARTUP: showall | Status: | Under Development | | Location: | [[http://github.com/wallyqs/org-ruby]] | | Version: | 0.9.0 | * Description Helpful Ruby routines for parsing orgmode files. The most significant thing this library does today is convert orgmode files to textile. Currently, you cannot do much to customize the conversion. The supplied textile conversion is optimized for extracting "content" from the orgfile as opposed to "metadata." * History ** 2014-02-08: Version 0.9.0 - Let's make sure =#+INCLUDE:= is not supported #+INCLUDE: "./README.txt" src text - And confirm that syntax highlight is supported #+begin_src ruby module GitHub module Markup VERSION = 'test' Version = VERSION end end #+end_src ** 2009-12-30: Version 0.5.1 - Minor enhancement: Recognize lines starting with ":" as examples. - Minor enhancement: Recognize #+BEGIN_SRC as source blocks - Minor enhancement: Add "src" and "example" classes to
 blocks.


** 2009-12-30: Version 0.5.0

   - Parse (but not necessarily *use*) in-buffer settings. The following
     in-buffer settings *are* used:
     - Understand the #+TITLE: directive.
     - Exporting todo keywords (option todo:t)
     - Numbering headlines (option num:t)
     - Skipping text before the first headline (option skip:t)
     - Skipping tables (option |:nil)
     - Custom todo keywords
     - EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of
       the tree to export
   - Rewrite "file:(blah).org" links to "http:(blah).html" links. This
     makes the inter-links to other org-mode files work.
   - Uses  tags inside table rows that precede table separators.
   - Bugfixes:
     - Headings now have HTML escaped.

** 2009-12-29: Version 0.4.2

   - Got rid of the extraneous newline at the start of code blocks.
   - Everything now shows up in code blocks, even org-mode metadata.
   - Fixed bugs:
     - Regressed smart double quotes with HTML escaping. Added a test
       case and fixed the regression.

** 2009-12-29: Version 0.4.1
   - HTML is now escaped by default
   - org-mode comments will show up in a code block.

** 2009-12-29: Version 0.4

   - The first thing output in HTML gets the class "title"
   - HTML output is now indented
   - Proper support for multi-paragraph list items.

     See? This paragraph is part of the last bullet.
     
   - Fixed bugs:
     - "rake spec" wouldn't work on Linux. Needed "require 'rubygems'".

** 2009-12-27: Version 0.3

   - Uses rubypants to get better typography (smart quotes, elipses, etc...).
   - Fixed bugs:
     - Tables and lists did not get properly closed at the end of file
     - You couldn't do inline formatting inside table cells
     - Characters in PRE blocks were not HTML escaped.
   
** 2009-12-26: Version 0.2

   - Added =to_html= output on the parser.
   - Added support for the full range of inline markup: *bold*,
     /italic/, =code=, ~verbatim~, _underline_, +strikethrough+.
   - Lots of refactoring to make the code more maintainable.

** 2009-12-23: Version 0.1

   - Added support for block code, like this:

     #+BEGIN_EXAMPLE
     def flush!
     @logger.debug "FLUSH ==========> #{@output_type}"
     if (@output_type == :blank) then
       @output << "\n"
     elsif (@buffer.length > 0) then
       if @cancel_modifier then
         @output << "p. " if @output_type == :paragraph
         @cancel_modifier = false
       end
       @output << @paragraph_modifier if (@paragraph_modifier and not sticky_modifier?)
       @output << @buffer.textile_substitution << "\n"
     end
     @buffer = ""
   end
   #+END_EXAMPLE

   - Major code cleanup: Created the =OutputBuffer= class that
     greatly simplified a lot of the messiness of =textile=
     conversion.
   - Added support for line breaks within list items.
gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.org.html000066400000000000000000000110361317564624300270500ustar00rootroot00000000000000

org-ruby

Status: Under Development
Location: http://github.com/wallyqs/org-ruby
Version: 0.9.0

1 Description

Helpful Ruby routines for parsing orgmode files. The most significant thing this library does today is convert orgmode files to textile. Currently, you cannot do much to customize the conversion. The supplied textile conversion is optimized for extracting “content” from the orgfile as opposed to “metadata.”

2 History

2.1 2014-02-08: Version 0.9.0

  • Let’s make sure #+INCLUDE: is not supported
  • And confirm that syntax highlight is supported
module GitHub
  module Markup
    VERSION = 'test'
    Version = VERSION
  end
end

2.2 2009-12-30: Version 0.5.1

  • Minor enhancement: Recognize lines starting with “:” as examples.
  • Minor enhancement: Recognize #+BEGIN_SRC as source blocks
  • Minor enhancement: Add “src” and “example” classes to <pre> blocks.

2.3 2009-12-30: Version 0.5.0

  • Parse (but not necessarily use) in-buffer settings. The following in-buffer settings are used:
    • Understand the #+TITLE: directive.
    • Exporting todo keywords (option todo:t)
    • Numbering headlines (option num:t)
    • Skipping text before the first headline (option skip:t)
    • Skipping tables (option |:nil)
    • Custom todo keywords
    • EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of the tree to export
  • Rewrite “file:(blah).org” links to “http:(blah).html” links. This makes the inter-links to other org-mode files work.
  • Uses <th> tags inside table rows that precede table separators.
  • Bugfixes:
    • Headings now have HTML escaped.

2.4 2009-12-29: Version 0.4.2

  • Got rid of the extraneous newline at the start of code blocks.
  • Everything now shows up in code blocks, even org-mode metadata.
  • Fixed bugs:
    • Regressed smart double quotes with HTML escaping. Added a test case and fixed the regression.

2.5 2009-12-29: Version 0.4.1

  • HTML is now escaped by default
  • org-mode comments will show up in a code block.

2.6 2009-12-29: Version 0.4

  • The first thing output in HTML gets the class “title”
  • HTML output is now indented
  • Proper support for multi-paragraph list items.

    See? This paragraph is part of the last bullet.

  • Fixed bugs:
    • “rake spec” wouldn’t work on Linux. Needed “require ‘rubygems’”.

2.7 2009-12-27: Version 0.3

  • Uses rubypants to get better typography (smart quotes, elipses, etc…).
  • Fixed bugs:
    • Tables and lists did not get properly closed at the end of file
    • You couldn’t do inline formatting inside table cells
    • Characters in PRE blocks were not HTML escaped.

2.8 2009-12-26: Version 0.2

  • Added to_html output on the parser.
  • Added support for the full range of inline markup: bold, italic, code, verbatim, underline, strikethrough.
  • Lots of refactoring to make the code more maintainable.

2.9 2009-12-23: Version 0.1

  • Added support for block code, like this:
      def flush!
      @logger.debug "FLUSH ==========> #{@output_type}"
      if (@output_type == :blank) then
        @output << "\n"
      elsif (@buffer.length > 0) then
        if @cancel_modifier then
          @output << "p. " if @output_type == :paragraph
          @cancel_modifier = false
        end
        @output << @paragraph_modifier if (@paragraph_modifier and not sticky_modifier?)
        @output << @buffer.textile_substitution << "\n"
      end
      @buffer = ""
    end
        
  • Major code cleanup: Created the OutputBuffer class that greatly simplified a lot of the messiness of textile conversion.
  • Added support for line breaks within list items.
gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.pod000066400000000000000000000044671317564624300261120ustar00rootroot00000000000000=head1 Matrixy =head2 INTRODUCTION This is a port of the MATLAB/Octave programming language to Parrot. See the ROADMAP file for more information on the status of this project, and what else needs to be done. =head2 ABOUT Primary goals are: =over 4 =item * Create a working compiler that understands the majority of the MATLAB/Octave programming language. =back =head2 IMPLEMENTATION This project is broken into three primary components: =over 4 =item * The first is the parser, located in the C directory. The parser proper is composed of three source files, F which is a Perl6Grammar file, and F which is the associated actions file written in NQP, and F which is the operator precidence parser. In addition, several helper functions used by the parser are located in C. =item * The second component is the library of builtin functions in the C directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility. =item * A number of library functions are written in M, or mostly M with some inline PIR code in C. =back =head2 DEPENDENCIES Matrixy depends on these dependencies: =head3 Parrot To get a proper version of Parrot to build Matrixy, you will need to check out and build Parrot from source: svn co http://svn.parrot.org/parrot/trunk parrot cd parrot perl Configure.pl make && make test && make install-dev =head3 Parrot-Linear-Algebra The linear algebra package for Parrot is available separately and provides functionality required by Matrixy. This includes matrix data types and matrix manipulation libraries =head2 BUILDING Once all dependencies are in place, you can build Matrixy using this sequence of commands: perl Configure.pl nmake test =head2 TODO * Parser * Standard Builtins * Test against Octave Test Suite. =head2 BUGS Lots! =head2 CONTACT If you need to contact the Matrixy team, go to the project home page at: www.github.com\Whiteknight\matrixy gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.pod.html000066400000000000000000000054301317564624300270440ustar00rootroot00000000000000

Matrixy

INTRODUCTION

This is a port of the MATLAB/Octave programming language to Parrot. See the ROADMAP file for more information on the status of this project, and what else needs to be done.

ABOUT

Primary goals are:

  • Create a working compiler that understands the majority of the MATLAB/Octave programming language.

IMPLEMENTATION

This project is broken into three primary components:

  • The first is the parser, located in the src/parser/ directory. The parser proper is composed of three source files, grammar.pg which is a Perl6Grammar file, and actions.pm which is the associated actions file written in NQP, and grammar-oper.pm which is the operator precidence parser. In addition, several helper functions used by the parser are located in src/internals.
  • The second component is the library of builtin functions in the src/builtins/ directory. These functions are, currently, written primarily in PIR. Function names prefixed with an underscore are "private" functions for use with the parser. Other functions should have names which are the same as names for regular MATLAB or Octave functions, since they will be available to the HLL. These are also separated into different namespaces depending on visibility and utility.
  • A number of library functions are written in M, or mostly M with some inline PIR code in toolbox/.

DEPENDENCIES

Matrixy depends on these dependencies:

Parrot

To get a proper version of Parrot to build Matrixy, you will need to check out and build Parrot from source:

    svn co http://svn.parrot.org/parrot/trunk parrot
    cd parrot
    perl Configure.pl
    make && make test && make install-dev

Parrot-Linear-Algebra

The linear algebra package for Parrot is available separately and provides functionality required by Matrixy. This includes matrix data types and matrix manipulation libraries

BUILDING

Once all dependencies are in place, you can build Matrixy using this sequence of commands:

    perl Configure.pl
    nmake test

TODO

    * Parser
    * Standard Builtins
    * Test against Octave Test Suite.

BUGS

Lots!

CONTACT

If you need to contact the Matrixy team, go to the project home page at:

www.github.com\Whiteknight\matrixy

gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.rdoc000066400000000000000000000002421317564624300262420ustar00rootroot00000000000000* One * Two This is an {absolute link}[http://github.com]. So is this: http://github.com This is a {relative link}[link:rawr.html]. So is this: link:rawr.htmlgitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.rdoc.html000066400000000000000000000004301317564624300272040ustar00rootroot00000000000000
  • One

  • Two

This is an absolute link. So is this: github.com

This is a relative link. So is this: rawr.html

gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.rmd000066400000000000000000000000241317564624300260730ustar00rootroot00000000000000# Title * One * Two gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.rmd.html000066400000000000000000000000641317564624300270420ustar00rootroot00000000000000

Title

  • One
  • Two
gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.rst000066400000000000000000000035701317564624300261320ustar00rootroot00000000000000Header 1 ======== -------- Subtitle -------- Example text. .. contents:: Table of Contents Header 2 -------- 1. Blah blah ``code`` blah 2. More ``code``, hooray 3. Somé UTF-8° The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it. .. csv-table:: Things that are Awesome (on a scale of 1-11) :quote: ” Thing,Awesomeness Icecream, 7 Honey Badgers, 10.5 Nickelback, -2 Iron Man, 10 Iron Man 2, 3 Tabular Data, 5 Made up ratings, 11 .. code:: A block of code .. code:: python python.code('hooray') .. doctest:: ignored >>> some_function() 'result' ============== ========================================================== Travis http://travis-ci.org/tony/pullv Docs http://pullv.rtfd.org API http://pullv.readthedocs.org/en/latest/api.html Issues https://github.com/tony/pullv/issues Source https://github.com/tony/pullv ============== ========================================================== .. image:: https://scan.coverity.com/projects/621/badge.svg :target: https://scan.coverity.com/projects/621 :alt: Coverity Scan Build Status .. image:: https://scan.coverity.com/projects/621/badge.svg :alt: Coverity Scan Build Status Field list ---------- :123456789 123456789 123456789 123456789 123456789 1: Uh-oh! This name is too long! :123456789 123456789 123456789 123456789 1234567890: this is a long name, but no problem! :123456789 12345: this is not so long, but long enough for the default! :123456789 1234: this should work even with the default :) someone@somewhere.org Press :kbd:`Ctrl+C` to quit .. raw:: html

RAW HTML!

.. plantuml:: :caption: Caption with **bold** and *italic* Bob -> Alice: hello Alice -> Bob: Go Away .. uml:: Bob -> Alice: hello Alice -> Bob: Go Away gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.rst.html000066400000000000000000000047021317564624300270730ustar00rootroot00000000000000

Header 1

Subtitle

Example text.

Table of Contents

Header 2

  1. Blah blah code blah
  2. More code, hooray
  3. Somé UTF-8°

The UTF-8 quote character in this table used to cause python to go boom. Now docutils just silently ignores it.


A block of code

python.code('hooray')

>>> some_function()
'result'
Travis http://travis-ci.org/tony/pullv
Docs http://pullv.rtfd.org
API http://pullv.readthedocs.org/en/latest/api.html
Issues https://github.com/tony/pullv/issues
Source https://github.com/tony/pullv
Coverity Scan Build Status Coverity Scan Build Status

Field list

123456789 123456789 123456789 123456789 123456789 1:
  Uh-oh! This name is too long!
123456789 123456789 123456789 123456789 1234567890: this is a long name, but no problem!
123456789 12345: this is not so long, but long enough for the default!
123456789 1234: this should work even with the default :)

someone@somewhere.org

Press Ctrl+C to quit


Bob -> Alice: hello
Alice -> Bob: Go Away

Caption with bold and italic


Bob -> Alice: hello
Alice -> Bob: Go Away
gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.rst.txt000066400000000000000000000010141317564624300267370ustar00rootroot00000000000000Header 1 ======== Example text. Header 2 -------- 1. Blah blah ``code`` blah 2. More ``code``, hooray 3. Somé UTF-8° ============== ========================================================== Travis http://travis-ci.org/tony/pullv Docs http://pullv.rtfd.org API http://pullv.readthedocs.org/en/latest/api.html Issues https://github.com/tony/pullv/issues Source https://github.com/tony/pullv ============== ========================================================== gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.rst.txt.html000066400000000000000000000014761317564624300277160ustar00rootroot00000000000000

Header 1

Example text.

Header 2

  1. Blah blah code blah
  2. More code, hooray
  3. Somé UTF-8°
Travis http://travis-ci.org/tony/pullv
Docs http://pullv.rtfd.org
API http://pullv.readthedocs.org/en/latest/api.html
Issues https://github.com/tony/pullv/issues
Source https://github.com/tony/pullv
gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.textile000066400000000000000000000000141317564624300267660ustar00rootroot00000000000000* One * Two gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.textile.html000066400000000000000000000000461317564624300277360ustar00rootroot00000000000000
  • One
  • Two
gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.toc.rst000066400000000000000000000015241317564624300267130ustar00rootroot00000000000000.. contents:: :backlinks: none .. sectnum:: Introduction ============ What is pycparser? ------------------ **pycparser** is a parser for the C language, written in pure Python. It is a module designed to be easily integrated into applications that need to parse C source code. What is it good for? -------------------- Anything that needs C code to be parsed. The following are some uses for **pycparser**, taken from real user reports: * C code obfuscator * Front-end for various specialized C compilers * Static code checker * Automatic unit-test discovery * Adding specialized extensions to the C language **pycparser** is unique in the sense that it's written in pure Python - a very high level language that's easy to experiment with and tweak. To people familiar with Lex and Yacc, **pycparser**'s code will be simple to understand. gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.toc.rst.html000066400000000000000000000023571317564624300276630ustar00rootroot00000000000000

1   Introduction

1.1   What is pycparser?

pycparser is a parser for the C language, written in pure Python. It is a module designed to be easily integrated into applications that need to parse C source code.

1.2   What is it good for?

Anything that needs C code to be parsed. The following are some uses for pycparser, taken from real user reports:

  • C code obfuscator
  • Front-end for various specialized C compilers
  • Static code checker
  • Automatic unit-test discovery
  • Adding specialized extensions to the C language

pycparser is unique in the sense that it's written in pure Python - a very high level language that's easy to experiment with and tweak. To people familiar with Lex and Yacc, pycparser's code will be simple to understand.

gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.txt000066400000000000000000000000141317564624300261270ustar00rootroot00000000000000* One * Two gitlab-markup-v1.6.3-e74fbc4cd2018bd35138a75388608fc289395f0c/test/markups/README.txt.html000066400000000000000000000000131317564624300270710ustar00rootroot00000000000000* One * Two