Giter VIP home page Giter VIP logo

redmine_scmacros's People

Contributors

gpr avatar luckval avatar stansidel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

redmine_scmacros's Issues

Migrating plugins with rake fails with "invalid byte sequence in US-ASCII" exception

$ rake db:migrate_plugins RAILS_ENV=production
rake aborted!
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/trace_output.rb:16:in `block in trace_on': invalid byte sequence in US-ASCII (ArgumentError)
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/trace_output.rb:14:in `map'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/trace_output.rb:14:in `trace_on'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:376:in `trace'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:222:in `display_exception_message_details'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:209:in `display_exception_details'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:198:in `display_error_message'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:185:in `rescue in standard_exception_handling'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
    from /var/lib/gems/1.9.1/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
    from /usr/local/bin/rake:23:in `load'
    from /usr/local/bin/rake:23:in `<main>'

repo_includemd will include a <br> inside paragraphs

Thanks for this great plugin.

To include a line break inside a paragraph in the Markdown syntax, one should add two spaces at the end of the line. However, the rendered output for repo_includemd is including a <br> tag on every line break inside paragraphs.

modifications proposition

Hello,
thank for this plugin.
I use redmine 3.10 and RedmineThemePixelCookers theme so the intégration of source code is not very readable.
I've made some modifications, i hope this will help you a lot:

  Redmine::WikiFormatting::Macros.register do
    desc "Includes and formats a file from repository.\n\n" +
      " \{{repo_include(file_path)}}\n" +
      " \{{repo_include(file_path, rev)}}\n"
    macro :repo_include do |obj, args|

      return nil if args.length < 1
      file_path = args[0].strip
      rev ||= args[1].strip if args.length > 1

      repo = @project.repository
      return nil unless repo

      texts = repo.cat(file_path, rev)
      #text = Redmine::CodesetUtil.to_utf8_by_setting(text)
      text = ""
      line_num = 1
      text += "<link rel=\"stylesheet\" media=\"screen\" href=\"/redmine/stylesheets/scm.css\">"
      text += "<style>#CodeDiv div.wiki table, div.wiki td, div.wiki th, div.wiki pre, div.wiki code{padding: 0px 3px 3px;border: 0px;}</style>"
      text += "<div id=\"CodeDiv\" class=\"autoscroll\">"
      text += "<table class=\"filecontent syntaxhl\">"
      text += "<tbody>"
      syntax_highlight_lines(file_path, Redmine::CodesetUtil.to_utf8_by_setting(texts)).each do |line|
        text += "<tr id=\"L"+line_num.to_s+"\">"
        text += "<th class=\"line-num\">"
        text += "<a href=\"#L"+line_num.to_s+"\">"+line_num.to_s+"</a>"
        text += "</th>"
        text += "<td class=\"line-code\">"
        text += "<pre>"+line.html_safe+"</pre>"
        text += "</td>"
        text += "</tr>"
        line_num += 1
      end
      text += "</tbody>"
      text += "</table>"
      text += "</div>"

      #o = text
      h((text.html_safe))
      #return o
    end
  end

best regards
helmer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.