Current section

86 Versions

Jump to

Compare versions

5 files changed
+119 additions
-7 deletions
  @@ -0,0 +1,54 @@
1 + # Code of Conduct
2 +
3 + Contact: Philip Sampaio Silva - philip.sampaio+flokiconduct@gmail.com
4 +
5 + ## Why have a Code of Conduct?
6 +
7 + As contributors and maintainers of this project, we are committed to providing a friendly, safe and welcoming environment for all, regardless of age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.
8 +
9 + The goal of the Code of Conduct is to specify a baseline standard of behavior so that people with different social values and communication styles can talk about Floki effectively, productively, and respectfully, even in face of disagreements. The Code of Conduct also provides a mechanism for resolving conflicts in the community when they arise.
10 +
11 + ## Our Values
12 +
13 + These are the values Floki developers should aspire to:
14 +
15 + * Be friendly and welcoming
16 + * Be patient
17 + * Remember that people have varying communication styles and that not everyone is using their native language. (Meaning and tone can be lost in translation.)
18 + * Be thoughtful
19 + * Productive communication requires effort. Think about how your words will be interpreted.
20 + * Remember that sometimes it is best to refrain entirely from commenting.
21 + * Be respectful
22 + * In particular, respect differences of opinion. It is important that we resolve disagreements and differing views constructively.
23 + * Avoid destructive behavior
24 + * Derailing: stay on topic; if you want to talk about something else, start a new conversation.
25 + * Unconstructive criticism: don't merely decry the current state of affairs; offer (or at least solicit) suggestions as to how things may be improved.
26 + * Snarking (pithy, unproductive, sniping comments).
27 +
28 + The following actions are explicitly forbidden:
29 +
30 + * Insulting, demeaning, hateful, or threatening remarks.
31 + * Discrimination based on age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.
32 + * Bullying or systematic harassment.
33 + * Unwelcome sexual advances.
34 + * Incitement to any of these.
35 +
36 + ## Where does the Code of Conduct apply?
37 +
38 + If you participate in or contribute to the Floki project in any way, you are encouraged to follow the Code of Conduct while doing so.
39 +
40 + Explicit enforcement of the Code of Conduct applies to the official mediums operated by the Floki project:
41 +
42 + * The official GitHub project and code reviews.
43 +
44 + Other Floki related activities (such as conferences, meetups, and other unofficial forums) are encouraged to adopt this Code of Conduct. Such groups must provide their own contact information.
45 +
46 + Project maintainers may remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct.
47 +
48 + Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by emailing: philip.sampaio+flokiconduct@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. **All reports will be kept confidential**.
49 +
50 + **The goal of the Code of Conduct is to resolve conflicts in the most harmonious way possible**. We hope that in most cases issues may be resolved through polite discussion and mutual agreement. Bannings and other forceful measures are to be employed only as a last resort. **Do not** post about the issue publicly or try to rally sentiment against a particular individual or group.
51 +
52 + ## Acknowledgements
53 +
54 + This document was based on the Code of Conduct from the Elixir project that was based on the Go project with parts derived from Django's Code of Conduct, Rust's Code of Conduct and the Contributor Covenant.
  @@ -0,0 +1,41 @@
1 + ## Contributing
2 +
3 + We want to encorage you to contribute to Floki with documentation, code and ideas.
4 + To do so, you can read the existing docs and take a look at our source code through [closed pull requests](https://github.com/philss/floki/pulls?q=is%3Apr+is%3Aclosed).
5 +
6 + Before starting, please read our [Code of Conduct](https://github.com/philss/floki/blob/master/CODE_OF_CONDUCT.md) and our [License](https://github.com/philss/floki/blob/master/LICENSE) files.
7 +
8 + ### Docs
9 +
10 + This project uses the [ExDoc](https://github.com/elixir-lang/ex_doc) tool, which generates documentation based on code docs.
11 + Floki uses the [Elixir style](https://hexdocs.pm/elixir/writing-documentation.html) of writing docs.
12 +
13 + Documentation is a very important portion of software. We want to always improve our communication using docs.
14 +
15 + ### Ideas
16 +
17 + To contribute with ideas, you can [open issues](https://github.com/philss/floki/issues/new) using Github. Please write a clear description of
18 + what you want to propouse, along with a motivation and examples.
19 +
20 + This can make the project very rich, even if your propouse is not accepted. It worth the discussion and possible implementations.
21 +
22 + ### Code
23 +
24 + Contributing with code (and documentation) is easy if you already know how to work with pull requests on Github.
25 + If you don't know yet, it's basically:
26 +
27 + 1. Fork the project
28 + 2. Clone your fork using the project URL (git or https)
29 + 3. Create a new branch to implement your functionality or code. This can be done with the command:
30 + `git checkout -b your-branch-name-here`
31 + 4. Make your changes and add a new commit with a clear message saying **why** this change is being made
32 + 5. Push your code with the command: `git push -u origin your-branch-name-here`
33 + 6. Go to your fork page at Github
34 + 7. Open a new Pull request.
35 +
36 + Today we only need a one :shipit: (it's the sign of approval) in order to merge a pull request. Unfortunally we can't garantee that all pull requests will be merged.
37 + But we can garantee that all PRs that are not accepted will have an explanation for that.
38 +
39 + If you have questions, security issues or suggestions about the project and prefer to talk privately, please send me an email at: philip.sampaio+flokicontributing@gmail.com.
40 +
41 + Thank you.
  @@ -16,14 +16,19 @@
16 16 <<"lib/floki/selector/functional.ex">>,<<"lib/floki/selector/parser.ex">>,
17 17 <<"lib/floki/selector/pseudo_class.ex">>,
18 18 <<"lib/floki/selector/tokenizer.ex">>,<<"src/floki_selector_lexer.xrl">>,
19 - <<"mix.exs">>,<<"README.md">>,<<"LICENSE">>]}.
19 + <<"mix.exs">>,<<"README.md">>,<<"LICENSE">>,<<"CODE_OF_CONDUCT.md">>,
20 + <<"CONTRIBUTING.md">>]}.
20 21 {<<"licenses">>,[<<"MIT">>]}.
21 22 {<<"links">>,[{<<"GitHub">>,<<"https://github.com/philss/floki">>}]}.
22 23 {<<"maintainers">>,[<<"Philip Sampaio Silva">>]}.
23 24 {<<"name">>,<<"floki">>}.
24 25 {<<"requirements">>,
25 - [[{<<"app">>,<<"mochiweb">>},
26 + [[{<<"app">>,<<"html_entities">>},
27 + {<<"name">>,<<"html_entities">>},
28 + {<<"optional">>,false},
29 + {<<"requirement">>,<<"~> 0.4.0">>}],
30 + [{<<"app">>,<<"mochiweb">>},
26 31 {<<"name">>,<<"mochiweb">>},
27 32 {<<"optional">>,false},
28 33 {<<"requirement">>,<<"~> 2.15">>}]]}.
29 - {<<"version">>,<<"0.19.1">>}.
34 + {<<"version">>,<<"0.19.2">>}.
  @@ -107,9 +107,12 @@ defmodule Floki do
107 107
108 108 def raw_html(html_tree), do: raw_html(html_tree, "")
109 109 defp raw_html([], html), do: html
110 - defp raw_html(string, _html) when is_binary(string), do: string
110 + defp raw_html(string, _html) when is_binary(string), do: HtmlEntities.encode(string)
111 111 defp raw_html(tuple, html) when is_tuple(tuple), do: raw_html([tuple], html)
112 - defp raw_html([string | tail], html) when is_binary(string), do: raw_html(tail, html <> string)
112 +
113 + defp raw_html([string | tail], html) when is_binary(string) do
114 + raw_html(tail, html <> HtmlEntities.encode(string))
115 + end
113 116
114 117 defp raw_html([{:comment, comment} | tail], html),
115 118 do: raw_html(tail, html <> "<!--#{comment}-->")
  @@ -2,7 +2,7 @@ defmodule Floki.Mixfile do
2 2 use Mix.Project
3 3
4 4 @description "Floki is a simple HTML parser that enables search for nodes using CSS selectors."
5 - @version "0.19.1"
5 + @version "0.19.2"
6 6
7 7 def project do
8 8 [
  @@ -25,6 +25,7 @@ defmodule Floki.Mixfile do
25 25 defp deps do
26 26 [
27 27 {:mochiweb, "~> 2.15"},
28 + {:html_entities, "~> 0.4.0"},
28 29 {:earmark, "~> 1.0", only: :dev},
29 30 {:ex_doc, "~> 0.14", only: :dev},
30 31 {:credo, ">= 0.0.0", only: [:dev, :test]},
  @@ -36,7 +37,15 @@ defmodule Floki.Mixfile do
36 37 %{
37 38 maintainers: ["Philip Sampaio Silva"],
38 39 licenses: ["MIT"],
39 - files: ["lib", "src/*.xrl", "mix.exs", "README.md", "LICENSE"],
40 + files: [
41 + "lib",
42 + "src/*.xrl",
43 + "mix.exs",
44 + "README.md",
45 + "LICENSE",
46 + "CODE_OF_CONDUCT.md",
47 + "CONTRIBUTING.md"
48 + ],
40 49 links: %{
41 50 "GitHub" => "https://github.com/philss/floki"
42 51 }