Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Html rendering #47

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Html rendering #47

wants to merge 22 commits into from

Conversation

lolgear
Copy link

@lolgear lolgear commented Feb 13, 2018

Architecture changed.

  1. Base class Generator added.
  2. Module Auxiliaries added which contains file handling operations. Could be merged into base class Generator.
  3. HTMLGenerator added.
  4. Plist and HTML Writers added which handles output to appropriate file format.

.ruby-version Outdated
@@ -0,0 +1 @@
ruby-2.4.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't commit these .ruby-* files

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@segiddins
add to gitignore or just do not commit them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either is OK

@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'activesupport', '>= 4.0.2', '< 5'

spec.add_dependency "redcarpet", "~> 3.3"
spec.add_dependency "nokogiri"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if at all possible, we really should avoid a dependency on nokogiri, since many have issues installing it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@segiddins ok, html is too simple to use nokogiri.

spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing newline

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@segiddins
maybe add 'rubocop' to development group to solve style questions?

@@ -0,0 +1,37 @@
module CocoaPodsAcknowledgements
module Auxiliaries
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

text
end
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing newlines missing in all these files, everything should also be using 2 spaces for indentation

@lolgear
Copy link
Author

lolgear commented Feb 13, 2018

@segiddins updated.
nokogiri dependency removed.

@hamdshah
Copy link

hamdshah commented Feb 6, 2019

Any chance of merging this branch ?

@orta
Copy link
Member

orta commented Feb 6, 2019

@lolgear
Copy link
Author

lolgear commented Feb 6, 2019

@orta
It is an obsoleted class. ( or duplicate ). I use PlistGenerator instead. They are identical in terms of Model.
You can check invocations of HTMLGenerator. Maybe anybody can figure out what we can do with it in future. For now it is empty and it copies whole body of PlistGenerator. ( yeah, copy-paste is evil ).

Update:
HTMLWriter consumes PlistGenerator::SpecObject to generate correct output.

@lolgear
Copy link
Author

lolgear commented Feb 10, 2019

Weird, build error.

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    bundler (~> 1.3)
  Current Bundler version:
    bundler (2.0.1)

def <= (html)
self << html
!self
# self.content(html)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented-out code

lib/cocoapods_acknowledgements/writers.rb Outdated Show resolved Hide resolved
.gitignore Outdated
xcuserdata/

# Pods
Pods/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline

class MarkdownParser
class << self
def markdown_parser
@markdown_parser ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to pass render_options to HTML render using user_settings parameter of cocoapods-acknowledgements plugin. Current implementation don't wrap http[s] links with a HTML tag which makes them hard to style.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krin-san How to retrieve user_settings?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I mistyped – it's named user_options. This hash contains any custom parameters user might define in plugin inclusion string. E.g.:

plugin 'cocoapods-acknowledgements', :settings_bundle => true

We can use user_options as a source of extra parameters for Redcarpet::Render::HTML. Example:

plugin 'cocoapods-acknowledgements', :html_render_options => {:no_links => false, :link_attributes => {"link" => "#C0C0C0", "vlink" => "#808080", "alink" => "#FF0000"}}

Just need to figure out how to pass html_render_options through HTMLGenerator to MarkdownParser.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krin-san We can extend self.generate method in Generator to accept another parameter options.

      def generate_specs(target_description, sandbox, excluded, root_specs, options = {})
        []
      end
      def generate(target_description, sandbox, excluded, options = {})
        root_specs = target_description.specs.map(&:root).uniq.reject {|spec| excluded.include?(spec.name)}
        return nil if root_specs.empty?
        generate_specs(target_description, sandbox, excluded, root_specs)
      end

I don't see any better option here.
What do you think?

Copy link

@krin-san krin-san Mar 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a Ruby developer actually 😄. Whichever option allowing to define render_options in Podfile plugin inclusion line looks fine for me.

@lolgear
Copy link
Author

lolgear commented Mar 17, 2019

@segiddins Could you post a review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants