|
1 | 1 | defmodule ExDoc do |
2 | 2 | @moduledoc """ |
3 | | - Main entry point for generating docs. |
4 | | - """ |
5 | | - @ex_doc_version Mix.Project.config()[:version] |
6 | | - |
7 | | - @doc """ |
8 | | - Returns the ExDoc version (used in templates). |
9 | | - """ |
10 | | - @spec version :: String.t() |
11 | | - def version, do: @ex_doc_version |
12 | | - |
13 | | - @doc """ |
14 | | - Emits a warning. |
15 | | - """ |
16 | | - def warn(message, stacktrace_info) do |
17 | | - :persistent_term.put({__MODULE__, :warned?}, true) |
18 | | - IO.warn(message, stacktrace_info) |
19 | | - end |
20 | | - |
21 | | - defp unset_warned() do |
22 | | - warned? = :persistent_term.get({__MODULE__, :warned?}, false) |
23 | | - :persistent_term.erase({__MODULE__, :warned?}) |
24 | | - warned? |
25 | | - end |
26 | | - |
27 | | - @doc ~S""" |
28 | | - Generates documentation for the given `project`, `vsn` (version), |
29 | | - `source_beams` directories, and `options`. |
| 3 | + ExDoc is a tool to generate documentation for Erlang and Elixir projects. |
30 | 4 |
|
31 | 5 | By default it generates HTML, Markdown, and EPUB documents. |
32 | 6 |
|
@@ -512,6 +486,35 @@ defmodule ExDoc do |
512 | 486 | all documented versions and their URLs. ExDoc will automatically match |
513 | 487 | the version of the package with the one in the array to mark as current. |
514 | 488 | """ |
| 489 | + @ex_doc_version Mix.Project.config()[:version] |
| 490 | + |
| 491 | + @doc """ |
| 492 | + Returns the ExDoc version (used in templates). |
| 493 | + """ |
| 494 | + @spec version :: String.t() |
| 495 | + def version, do: @ex_doc_version |
| 496 | + |
| 497 | + @doc """ |
| 498 | + Emits a warning. |
| 499 | + """ |
| 500 | + def warn(message, stacktrace_info) do |
| 501 | + :persistent_term.put({__MODULE__, :warned?}, true) |
| 502 | + IO.warn(message, stacktrace_info) |
| 503 | + end |
| 504 | + |
| 505 | + defp unset_warned() do |
| 506 | + warned? = :persistent_term.get({__MODULE__, :warned?}, false) |
| 507 | + :persistent_term.erase({__MODULE__, :warned?}) |
| 508 | + warned? |
| 509 | + end |
| 510 | + |
| 511 | + @doc ~S""" |
| 512 | + Generates documentation for the given `project`, `vsn` (version), |
| 513 | + `source_beams` directories, and `options`. |
| 514 | +
|
| 515 | + This is the entrypoint called `mix docs` and other tools. See |
| 516 | + the moduledoc (`ExDoc`) for more information. |
| 517 | + """ |
515 | 518 | @spec generate(String.t(), String.t(), [Path.t()], Keyword.t()) :: |
516 | 519 | [%{entrypoint: String.t(), warned?: boolean(), formatter: module()}] |
517 | 520 | def generate(project, version, source_beams, options) |
|
0 commit comments