Commit 74a30768 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Merge branch 'master' into esprima-parser

parents 5d73798c f268e260
Loading
Loading
Loading
Loading

Gemfile

0 → 100644
+4 −0
Original line number Diff line number Diff line
source :rubygems

gemspec

Gemfile.lock

0 → 100644
+41 −0
Original line number Diff line number Diff line
PATH
  remote: .
  specs:
    jsduck (3.10.3)
      json
      parallel
      rdiscount

GEM
  remote: http://rubygems.org/
  specs:
    chunky_png (1.2.5)
    compass (0.12.1)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (~> 3.1)
    diff-lcs (1.1.3)
    fssm (0.2.9)
    json (1.7.3)
    parallel (0.5.16)
    rake (0.9.2.2)
    rdiscount (1.6.8)
    rspec (2.10.0)
      rspec-core (~> 2.10.0)
      rspec-expectations (~> 2.10.0)
      rspec-mocks (~> 2.10.0)
    rspec-core (2.10.0)
    rspec-expectations (2.10.0)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.10.1)
    sass (3.1.18)

PLATFORMS
  ruby
  x86-mingw32

DEPENDENCIES
  compass
  jsduck!
  rake
  rspec
+11 −8
Original line number Diff line number Diff line
require 'rubygems'
require 'rake'
require 'json'

$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)

def os_is_windows?
  RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
end

require 'rspec'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
  spec.rspec_opts = ["--color"]
  spec.rspec_opts = ["--color"] unless os_is_windows?
  spec.pattern = "spec/**/*_spec.rb"
end

@@ -176,11 +179,11 @@ class JsDuckRunner
  end

  def add_debug
    @options += [
    add_options(
      "--extjs-path", "extjs/ext-all-debug.js",
      "--template-links",
      "--template", "template",
    ]
      "--template", "template"
    )
    add_options("--template-links") unless os_is_windows?
  end

  def run
@@ -246,7 +249,7 @@ task :touch2 => :sass do
  runner.add_options(
    "--output", OUT_DIR,
    "--config", "#{SDK_DIR}/touch/docs/config.json",
    "--examples-base-url", "touch/examples/production/",
    "--examples-base-url", "touch-build/examples/production/",
    "--seo",
    "--tests"
  )
@@ -255,7 +258,7 @@ task :touch2 => :sass do
  runner.add_comments('touch', '2')
  runner.run

  system("cp -r #{TOUCH_BUILD} #{OUT_DIR}/touch")
  system("cp -r #{TOUCH_BUILD} #{OUT_DIR}/touch-build")
end

task :default => :spec
+7 −3
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@ Gem::Specification.new do |s|
  s.required_rubygems_version = ">= 1.3.5"

  s.name = 'jsduck'
  s.version = '3.10.0'
  s.date = '2012-05-04'
  s.version = '3.10.4'
  s.date = '2012-05-16'
  s.summary = "Simple JavaScript Duckumentation generator"
  s.description = "Documentation generator for Sencha JS frameworks"
  s.homepage = "https://github.com/senchalabs/jsduck"
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
  s.rubyforge_project = s.name

  s.files = `git ls-files`.split("\n").find_all do |file|
    file !~ /spec.rb$/ && file !~ /benchmark/ && file !~ /template\//
    file !~ /spec.rb$/ && file !~ /benchmark/ && file !~ /template\// && file !~ /opt\//
  end
  # Add files not in git
  s.files += Dir['template-min/**/*']
@@ -24,5 +24,9 @@ Gem::Specification.new do |s|
  s.add_dependency 'parallel'
  s.add_dependency 'therubyracer'

  s.add_development_dependency 'rspec'
  s.add_development_dependency 'rake'
  s.add_development_dependency 'compass'

  s.require_path = 'lib'
end
+4 −7
Original line number Diff line number Diff line
@@ -2,10 +2,10 @@
require 'rubygems'
require 'rdiscount'
require 'strscan'
require 'cgi'
require 'jsduck/logger'
require 'jsduck/inline_img'
require 'jsduck/inline_video'
require 'jsduck/html'

module JsDuck

@@ -274,7 +274,7 @@ module JsDuck
        when '%-'
          member ? "-" : ""
        when '%a'
          CGI.escapeHTML(anchor_text||"")
          HTML.escape(anchor_text||"")
        else
          $1
        end
@@ -327,7 +327,7 @@ module JsDuck
    #   Blah blah blah some text.
    #
    def shorten(input)
      sent = first_sentence(strip_tags(input))
      sent = first_sentence(HTML.strip_tags(input).strip)
      # Use u-modifier to correctly count multi-byte characters
      chars = sent.scan(/./mu)
      if chars.length > @max_length
@@ -343,15 +343,12 @@ module JsDuck

    # Returns true when input should get shortened.
    def too_long?(input)
      stripped = strip_tags(input)
      stripped = HTML.strip_tags(input).strip
      # for sentence v/s full - compare byte length
      # for full v/s max - compare char length
      first_sentence(stripped).length < stripped.length || stripped.scan(/./mu).length > @max_length
    end

    def strip_tags(str)
      str.gsub(/<.*?>/, "").strip
    end
  end

end
Loading