Skip to content

Commit

Permalink
Renamed ffi-upskirt to ffi-sundown.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Jul 18, 2011
1 parent 13544d7 commit 5fec03c
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .yardopts
@@ -1 +1 @@
--markup markdown --title "ffi-upskirt Documentation" --protected --markup markdown --title "FFI::Sundown Documentation" --protected
38 changes: 19 additions & 19 deletions README.md
@@ -1,50 +1,50 @@
# ffi-upskirt # ffi-sundown


* [Source](http://github.com/postmodern/ffi-upskirt) * [Source](http://github.com/postmodern/ffi-sundown)
* [Issues](http://github.com/postmodern/ffi-upskirt/issues) * [Issues](http://github.com/postmodern/ffi-sundown/issues)
* [Documentation](http://rubydoc.info/gems/ffi-upskirt/frames) * [Documentation](http://rubydoc.info/gems/ffi-sundown/frames)
* [Email](mailto:postmodern.mod3 at gmail.com) * [Email](mailto:postmodern.mod3 at gmail.com)


## Description ## Description


Ruby FFI bindings for the libupskirt markdown library. Ruby FFI bindings for the libsundown markdown library.


## Examples ## Examples


require 'ffi/upskirt' require 'ffi/sundown'


doc = FFI::Upskirt::Document.new(File.read('README.md')) doc = FFI::Sundown::Document.new(File.read('README.md'))
puts doc.to_html puts doc.to_html
# <h1>ffi-upskirt</h1> # <h1>ffi-sundown</h1>
# #
# <ul> # <ul>
# <li><a href="http://github.com/postmodern/ffi-upskirt">Source</a></li> # <li><a href="http://github.com/postmodern/ffi-sundown">Source</a></li>
# <li><a href="http://github.com/postmodern/ffi-upskirt/issues">Issues</a></li> # <li><a href="http://github.com/postmodern/ffi-sundown/issues">Issues</a></li>
# <li><a href="http://rubydoc.info/gems/ffi-upskirt/frames">Documentation</a></li> # <li><a href="http://rubydoc.info/gems/ffi-sundown/frames">Documentation</a></li>
# <li><a href="mailto:postmodern.mod3 at gmail.com">Email</a></li> # <li><a href="mailto:postmodern.mod3 at gmail.com">Email</a></li>
# </ul> # </ul>
# #
# <h2>Description</h2> # <h2>Description</h2>
# #
# <p>Ruby FFI bindings for the libupskirt markdown library.</p> # <p>Ruby FFI bindings for the libsundown markdown library.</p>
# #
# <h2>Examples</h2> # <h2>Examples</h2>
# #
# <pre><code>require 'ffi/upskirt' # <pre><code>require 'ffi/sundown'
# #
# doc = FFI::Upskirt::Document.new(File.read('README.md')) # doc = FFI::Sundown::Document.new(File.read('README.md'))
# puts doc.to_html # puts doc.to_html
# </code></pre> # </code></pre>
# #
# <h2>Requirements</h2> # <h2>Requirements</h2>
# #
# <ul> # <ul>
# <li><a href="https://github.com/tanoku/upskirt">libupskirt</a> &gt;= 1.2.0</li> # <li><a href="https://github.com/tanoku/sundown">libsundown</a> &gt;= 1.2.0</li>
# </ul> # </ul>
# #
# <h2>Install</h2> # <h2>Install</h2>
# #
# <pre><code>$ gem install ffi-upskirt # <pre><code>$ gem install ffi-sundown
# </code></pre> # </code></pre>
# #
# <h2>Copyright</h2> # <h2>Copyright</h2>
Expand All @@ -55,7 +55,7 @@ Ruby FFI bindings for the libupskirt markdown library.


puts doc.to_toc puts doc.to_toc
# <ul> # <ul>
# <li><a href="#toc_0">ffi-upskirt</a></li> # <li><a href="#toc_0">ffi-sundown</a></li>
# <li><ul> # <li><ul>
# <li><a href="#toc_1">Description</a></li> # <li><a href="#toc_1">Description</a></li>
# <li><a href="#toc_2">Examples</a></li> # <li><a href="#toc_2">Examples</a></li>
Expand All @@ -67,12 +67,12 @@ Ruby FFI bindings for the libupskirt markdown library.


## Requirements ## Requirements


* [libupskirt](https://github.com/tanoku/upskirt) >= 1.2.0 * [libsundown](https://github.com/tanoku/sundown) >= 1.2.0
* [ffi](http://github.com/ffi/ffi) ~> 1.0 * [ffi](http://github.com/ffi/ffi) ~> 1.0


## Install ## Install


$ gem install ffi-upskirt $ gem install ffi-sundown


## Copyright ## Copyright


Expand Down
14 changes: 9 additions & 5 deletions ffi-upskirt.gemspec → ffi-sundown.gemspec
Expand Up @@ -3,6 +3,8 @@
require 'yaml' require 'yaml'


Gem::Specification.new do |gemspec| Gem::Specification.new do |gemspec|
root = File.dirname(__FILE__)
lib_dir = File.join(root,'lib')
files = if File.directory?('.git') files = if File.directory?('.git')
`git ls-files`.split($/) `git ls-files`.split($/)
elsif File.directory?('.hg') elsif File.directory?('.hg')
Expand All @@ -23,12 +25,12 @@ Gem::Specification.new do |gemspec|
} }


version = { version = {
:file => 'lib/ffi/upskirt/version.rb', :file => 'sundown/version',
:constant => 'FFI::Upskirt::VERSION' :constant => 'FFI::Sundown::VERSION'
} }


defaults = { defaults = {
'name' => File.basename(File.dirname(__FILE__)), 'name' => File.basename(root),
'files' => files, 'files' => files,
'executables' => filter_files['bin/*'].map { |path| File.basename(path) }, 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'], 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
Expand All @@ -40,8 +42,10 @@ Gem::Specification.new do |gemspec|
gemspec.name = metadata.fetch('name',defaults[:name]) gemspec.name = metadata.fetch('name',defaults[:name])
gemspec.version = if metadata['version'] gemspec.version = if metadata['version']
metadata['version'] metadata['version']
elsif File.file?(version[:file]) else
require File.join('.',version[:file]) $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)

require version[:file]
eval(version[:constant]) eval(version[:constant])
end end


Expand Down
10 changes: 5 additions & 5 deletions gemspec.yml
@@ -1,15 +1,15 @@
name: ffi-upskirt name: ffi-sundown
summary: FFI bindings for libupskirt summary: FFI bindings for libsundown
description: description:
Ruby FFI bindings for the libupskirt markdown library. Ruby FFI bindings for the libsundown markdown library.


license: MIT license: MIT
authors: Postmodern authors: Postmodern
email: postmodern.mod3@gmail.com email: postmodern.mod3@gmail.com
homepage: http://github.com/postmodern/ffi-upskirt homepage: http://github.com/postmodern/ffi-sundown
has_yard: true has_yard: true


requirements: "libupskirt >= 1.2.0" requirements: "libsundown >= 1.2.0"


dependencies: dependencies:
ffi: ~> 1.0 ffi: ~> 1.0
Expand Down
2 changes: 2 additions & 0 deletions lib/ffi/sundown.rb
@@ -0,0 +1,2 @@
require 'ffi/sundown/document'
require 'ffi/sundown/version'
12 changes: 6 additions & 6 deletions lib/ffi/upskirt/buffer.rb → lib/ffi/sundown/buffer.rb
@@ -1,7 +1,7 @@
require 'ffi/upskirt/upskirt' require 'ffi/sundown/sundown'


module FFI module FFI
module Upskirt module Sundown
class Buffer < FFI::Struct class Buffer < FFI::Struct


layout :data, :pointer, layout :data, :pointer,
Expand All @@ -26,11 +26,11 @@ class Buffer < FFI::Struct
# Once the block has returned, the buffer will be released. # Once the block has returned, the buffer will be released.
# #
def self.create_empty(size) def self.create_empty(size)
buffer = new(Upskirt.bufnew(size)) buffer = new(Sundown.bufnew(size))


yield buffer yield buffer


Upskirt.bufrelease(buffer) Sundown.bufrelease(buffer)
end end


# #
Expand Down Expand Up @@ -68,7 +68,7 @@ def self.create_from(text)
# The length to increase the buffer by. # The length to increase the buffer by.
# #
def grow(length) def grow(length)
Upskirt.bufgrow(self,length) Sundown.bufgrow(self,length)
end end


# #
Expand All @@ -91,7 +91,7 @@ def to_smartypants
result = nil result = nil


Buffer.create_empty(128) do |smart_buffer| Buffer.create_empty(128) do |smart_buffer|
Upskirt.upshtml_smartypants(smart_buffer,self) Sundown.upshtml_smartypants(smart_buffer,self)


result = self.to_s result = self.to_s
end end
Expand Down
14 changes: 7 additions & 7 deletions lib/ffi/upskirt/document.rb → lib/ffi/sundown/document.rb
@@ -1,16 +1,16 @@
require 'ffi/upskirt/types' require 'ffi/sundown/types'
require 'ffi/upskirt/buffer' require 'ffi/sundown/buffer'
require 'ffi/upskirt/renderer' require 'ffi/sundown/renderer'


module FFI module FFI
module Upskirt module Sundown
class Document class Document


# The `render_mode` enum # The `render_mode` enum
RENDER_MODES = Upskirt.enum_type(:render_mode) RENDER_MODES = Sundown.enum_type(:render_mode)


# The `markdown_extensions` enum # The `markdown_extensions` enum
EXTENSIONS = Upskirt.enum_type(:markdown_extensions) EXTENSIONS = Sundown.enum_type(:markdown_extensions)


# Valid options for {#initialize} # Valid options for {#initialize}
VALID_OPTIONS = RENDER_MODES.symbols + EXTENSIONS.symbols VALID_OPTIONS = RENDER_MODES.symbols + EXTENSIONS.symbols
Expand Down Expand Up @@ -158,7 +158,7 @@ def render(renderer)
Buffer.create_empty(128) do |output_buffer| Buffer.create_empty(128) do |output_buffer|
output_buffer.grow(@source.length * 1.2) output_buffer.grow(@source.length * 1.2)


Upskirt.ups_markdown(output_buffer,input_buffer,renderer,extensions) Sundown.ups_markdown(output_buffer,input_buffer,renderer,extensions)


result = if @smart result = if @smart
output_buffer.to_smartypants output_buffer.to_smartypants
Expand Down
12 changes: 6 additions & 6 deletions lib/ffi/upskirt/renderer.rb → lib/ffi/sundown/renderer.rb
@@ -1,7 +1,7 @@
require 'ffi/upskirt/upskirt' require 'ffi/sundown/sundown'


module FFI module FFI
module Upskirt module Sundown
class Renderer < FFI::Struct class Renderer < FFI::Struct


layout :blockcode, :blockcode_callback, layout :blockcode, :blockcode_callback,
Expand Down Expand Up @@ -48,11 +48,11 @@ class Renderer < FFI::Struct
# #
def Renderer.html(flags) def Renderer.html(flags)
renderer = new renderer = new
Upskirt.upshtml_renderer(renderer,flags) Sundown.upshtml_renderer(renderer,flags)


yield renderer yield renderer


Upskirt.upshtml_free_renderer(renderer) Sundown.upshtml_free_renderer(renderer)
end end


# #
Expand All @@ -72,11 +72,11 @@ def Renderer.html(flags)
# #
def Renderer.toc def Renderer.toc
renderer = new renderer = new
Upskirt.upshtml_toc_renderer(renderer) Sundown.upshtml_toc_renderer(renderer)


yield renderer yield renderer


Upskirt.upshtml_free_renderer(renderer) Sudown.upshtml_free_renderer(renderer)
end end


end end
Expand Down
10 changes: 5 additions & 5 deletions lib/ffi/upskirt/upskirt.rb → lib/ffi/sundown/sundown.rb
@@ -1,12 +1,12 @@
require 'ffi/upskirt/types' require 'ffi/sundown/types'


require 'ffi' require 'ffi'


module FFI module FFI
module Upskirt module Sundown
extend FFI::Library extend FFI::Library


ffi_lib 'upskirt' ffi_lib 'sundown'


attach_function :bufcasecmp, [:pointer, :pointer], :int attach_function :bufcasecmp, [:pointer, :pointer], :int
attach_function :bufcmp, [:pointer, :pointer], :int attach_function :bufcmp, [:pointer, :pointer], :int
Expand Down Expand Up @@ -42,12 +42,12 @@ module Upskirt
attach_function :upshtml_smartypants, [:pointer, :pointer], :void attach_function :upshtml_smartypants, [:pointer, :pointer], :void


# #
# Returns the version of the installed `libupskirt`. # Returns the version of the installed `libsundown`.
# #
# @return [String] # @return [String]
# The version string. # The version string.
# #
def Upskirt.version def Sundown.version
ints = FFI::MemoryPointer.new(:int,3) ints = FFI::MemoryPointer.new(:int,3)


ups_version(ints[0],ints[1],ints[2]) ups_version(ints[0],ints[1],ints[2])
Expand Down
2 changes: 1 addition & 1 deletion lib/ffi/upskirt/types.rb → lib/ffi/sundown/types.rb
@@ -1,7 +1,7 @@
require 'ffi' require 'ffi'


module FFI module FFI
module Upskirt module Sundown
extend FFI::Library extend FFI::Library


enum :markdown_autolink, [ enum :markdown_autolink, [
Expand Down
4 changes: 2 additions & 2 deletions lib/ffi/upskirt/version.rb → lib/ffi/sundown/version.rb
@@ -1,6 +1,6 @@
module FFI module FFI
module Upskirt module Sundown
# ffi-upskirt version # ffi-sundown version
VERSION = "0.1.0" VERSION = "0.1.0"
end end
end end
2 changes: 0 additions & 2 deletions lib/ffi/upskirt.rb

This file was deleted.

4 changes: 2 additions & 2 deletions lib/markdown.rb
@@ -1,5 +1,5 @@
require 'ffi/upskirt/document' require 'ffi/sundown/document'


unless Object.const_defined?(:Markdown) unless Object.const_defined?(:Markdown)
Object.const_set(:Markdown,FFI::Upskirt::Document) Object.const_set(:Markdown,FFI::Sundown::Document)
end end
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
@@ -1,5 +1,5 @@
gem 'rspec', '~> 2.4' gem 'rspec', '~> 2.4'
require 'rspec' require 'rspec'
require 'ffi/upskirt/version' require 'ffi/sundown/version'


include FFI::Upskirt include FFI::Sundown
4 changes: 2 additions & 2 deletions spec/upskirt_spec.rb → spec/sundown_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
require 'ffi/upskirt' require 'ffi/sundown'


describe FFI::Upskirt do describe FFI::Sundown do
it "should have a VERSION constant" do it "should have a VERSION constant" do
subject.const_get('VERSION').should_not be_empty subject.const_get('VERSION').should_not be_empty
end end
Expand Down

0 comments on commit 5fec03c

Please sign in to comment.