From bfa3668b79eb98c92cf33cd5add5a3b24e0194e3 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Sat, 8 May 2021 10:05:09 +0800 Subject: [PATCH] Misc doc changes Besides other documentation changes, this commit ensures the generated HTML doc for HexDocs.pm will become the main reference doc for this Elixir library which leverage on latest features of ExDoc. --- .formatter.exs | 1 + .gitignore | 16 +++++++++++----- CHANGELOG.md | 5 +++++ README.md | 25 +++++++++++++++---------- mix.exs | 31 ++++++++++++++++++++----------- mix.lock | 10 ++++++---- 6 files changed, 58 insertions(+), 30 deletions(-) diff --git a/.formatter.exs b/.formatter.exs index d304ff3..d2cda26 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,3 +1,4 @@ +# Used by "mix format" [ inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] ] diff --git a/.gitignore b/.gitignore index 3caba00..216bc59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,14 @@ # The directory Mix will write compiled artifacts to. -/_build +/_build/ # If you run "mix test --cover", coverage assets end up here. -/cover +/cover/ # The directory Mix downloads your dependencies sources to. -/deps +/deps/ -# Where 3rd-party dependencies like ExDoc output generated docs. -/doc +# Where third-party dependencies like ExDoc output generated docs. +/doc/ # Ignore .fetch files in case you like to edit your project deps locally. /.fetch @@ -19,5 +19,11 @@ erl_crash.dump # Also ignore archive artifacts (built via "mix archive.build"). *.ez +# Ignore package tarball (built via "mix hex.build"). +slugify-*.tar + +# Temporary files for e.g. tests. +/tmp + # macOS .DS_Store diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a725a4..ed31b35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + ## 1.3.1 (19.06.2020) ### Fixes diff --git a/README.md b/README.md index 3f3a1a6..a27e605 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # Slugify -![](https://github.com/jayjun/slugify/workflows/CI/badge.svg) -[![Hex.pm](https://img.shields.io/hexpm/v/slugify.svg)](https://hex.pm/packages/slugify) +[![CI](https://github.com/jayjun/slugify/actions/workflows/main.yml/badge.svg)](https://github.com/jayjun/slugify/actions/workflows/main.yml) +[![Module Version](https://img.shields.io/hexpm/v/slugify.svg)](https://hex.pm/packages/slugify) +[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/slugify/) +[![Total Download](https://img.shields.io/hexpm/dt/slugify.svg)](https://hex.pm/packages/slugify) +[![License](https://img.shields.io/hexpm/l/slugify.svg)](https://github.com/jayjun/slugify/blob/master/LICENSE) +[![Last Updated](https://img.shields.io/github/last-commit/jayjun/slugify.svg)](https://github.com/jayjun/slugify/commits/master) Transform strings from any language into slugs. @@ -84,7 +88,7 @@ pinyin. ## Installation -Add `slugify` to your list of dependencies in `mix.exs`: +Add `:slugify` to your list of dependencies in `mix.exs`: ```elixir def deps do @@ -101,16 +105,17 @@ end ## License -Slugify is released under [MIT][4] license. +Copyright (c) 2017 Tan Jay Jun. + +Slugify is released under [MIT](./LICENSE.md) license. ## Credits -Inspired by [Unidecode][5], [Transliteration][6] and [Slugger][7]. Data from [dzcpy/transliteration][6]. +Inspired by [Unidecode][4], [Transliteration][5] and [Slugger][6]. Data from [dzcpy/transliteration][6]. [1]: https://www.ietf.org/rfc/rfc3986.txt -[2]: https://hexdocs.pm/slugify/Slug.html +[2]: https://hexdocs.pm/slugify [3]: https://hex.pm/packages/slugify -[4]: https://github.com/jayjun/slugify/blob/master/LICENSE.md -[5]: http://search.cpan.org/~sburke/Text-Unidecode-1.30/lib/Text/Unidecode.pm -[6]: https://github.com/dzcpy/transliteration -[7]: https://github.com/h4cc/slugger +[4]: http://search.cpan.org/~sburke/Text-Unidecode-1.30/lib/Text/Unidecode.pm +[5]: https://github.com/dzcpy/transliteration +[6]: https://github.com/h4cc/slugger diff --git a/mix.exs b/mix.exs index 4efaf15..cbe6f0f 100644 --- a/mix.exs +++ b/mix.exs @@ -10,16 +10,10 @@ defmodule Slug.Mixfile do version: @version, elixir: "~> 1.8", name: "Slugify", - description: "Transform strings from any language to slugs for URLs, filenames or fun", deps: deps(), package: package(), - docs: [ - source_ref: @version, - source_url: @repo_url, - main: "Slug", - api_reference: false, - extra_section: [] - ] + docs: docs(), + preferred_cli_env: [docs: :docs] ] end @@ -30,16 +24,31 @@ defmodule Slug.Mixfile do defp deps do [ {:jason, "~> 1.0", only: [:dev, :test, :docs]}, - {:ex_doc, "~> 0.22", only: :docs} + {:ex_doc, ">= 0.0.0", only: :docs, runtime: false} ] end defp package do [ - files: ["lib/slug.ex", "priv", "mix.exs", "README.md"], + description: "Transform strings from any language into slugs.", + files: ["lib/slug.ex", "priv", "mix.exs", "README.md", "CHANGELOG.md", "LICENSE.md"], maintainers: ["Tan Jay Jun"], licenses: ["MIT"], - links: %{"GitHub" => @repo_url} + links: %{ + "Changelog" => "https://hexdocs.pm/slugify/changelog.html", + "GitHub" => @repo_url + } + ] + end + + defp docs do + [ + extras: ["CHANGELOG.md", {:"LICENSE.md", [title: "License"]}, "README.md"], + source_ref: @version, + source_url: @repo_url, + main: "readme", + formatters: ["html"], + api_reference: false ] end end diff --git a/mix.lock b/mix.lock index 280adb2..1f36c8b 100644 --- a/mix.lock +++ b/mix.lock @@ -1,9 +1,11 @@ %{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []}, "earmark": {:hex, :earmark, "1.4.5", "62ffd3bd7722fb7a7b1ecd2419ea0b458c356e7168c1f5d65caf09b4fbdd13c8", [:mix], [], "hexpm", "b7d0e6263d83dc27141a523467799a685965bf8b13b6743413f19a7079843f4f"}, - "ex_doc": {:hex, :ex_doc, "0.22.1", "9bb6d51508778193a4ea90fa16eac47f8b67934f33f8271d5e1edec2dc0eee4c", [:mix], [{:earmark, "~> 1.4.0", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "d957de1b75cb9f78d3ee17820733dc4460114d8b1e11f7ee4fd6546e69b1db60"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.13", "0c98163e7d04a15feb62000e1a891489feb29f3d10cb57d4f845c405852bbef8", [:mix], [], "hexpm", "d602c26af3a0af43d2f2645613f65841657ad6efc9f0e361c3b6c06b578214ba"}, + "ex_doc": {:hex, :ex_doc, "0.24.2", "e4c26603830c1a2286dae45f4412a4d1980e1e89dc779fcd0181ed1d5a05c8d9", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "e134e1d9e821b8d9e4244687fb2ace58d479b67b282de5158333b0d57c6fb7da"}, "jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"}, - "makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"}, + "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, }