Commit Graph
151 Commits
Author SHA1 Message Date
eksperimental 369c252b1a Remove trailing semicolong from summaries 2015-09-26 17:36:11 +07:00
eksperimental ed5671b4f8 Standardize use of backticks and quotes; including Error messages and Title Case commands
This is a large commit that does the following:
* Removes backticks from messages and comments.
  All references to backticks have been replaced with double quotes everywhere the
  code is not interpreted as Markdown, (ie. anywhere outside documentation and
  markdown files, such as in code comments, or error messages).

* Variables in Exception messages are printed using `inspect`
  The way no-matching error message are printed, have changed because now we use inspect for printing
  variables. The following file and their respective test have been changed:
  - lib/elixir/lib/exception.ex
  - lib/elixir/lib/inspect/algebra.ex
  - lib/elixir/test/elixir/inspect_test.exs
  - lib/ex_unit/test/ex_unit/formatter_test.exs
  - lib/elixir/test/elixir/exception_test.exs

* Properly use Title Case for Mix, Git, Dializer

* Use backticks when citing a command

****************************************************
CONVENTION FOR RENAMING USING BACKTICKS AND QUOTES

https://github.com/elixir-lang/elixir/pull/3697#issuecomment-138811747

1. Backticks should never be printed in error messages, neither be included anywhere where Markdown code is not interpreted as such.

2. Do not use single quotes anywhere. We should favor double quotes everywhere, to avoid confusion

3. If you want to format something in error messages, use inspect. For example, if you want to show the dependency name and that is an atom, instead of the dependency "foo", let's show the dependency :foo. Less noise and may click better

4. Similarly, if you want to show something with double quotes, call inspect, as it handles escaping as well as the quotes

5. Things like "--all" just add verbosity, we can definitely read --all without ambiguity.

6. When using switches with a single hyphen (such as "-o"), we can make it explicit in the text: e.g. "... give the switch -o when choosing ..."

****************************************************
SHELL COMMANDS TO DETECT CODE BREAKING THE RULES

* Detect values surrounded by single-quotes where we want double-quotes.

    # regular variables
    ag "'#{"
    # constants or ENV variables
    ag "'[A-Z][A-Z0-9_-]+"
    # switches
    ag -i "(?<!(\[))'--?[a-z0-9][a-z0-9_-]+'"
    # atoms
    ag -i "(?<!(\[))':[a-z0-9][a-z0-9_-]+'"

    # DETECT BACKTICKS OUTSIDE DOCS
    ag "^\s+(?<!(#))#[^#\r\n]*\`" --ignore "*.md"
    ag '^\s+["%].*`' --ignore "*.md"
    ag -s '(raise|Error)\b(?!(`|/)).*\`'

* Spot mentions to running a command that is not using backticks:

    commands="elixir|elixirc|mix|iex|ex_doc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    actions="runs?|running|executes?|executing|types?|typing|enters?|entering|calls?|calling"
    ag '(?i)('${actions}')(?-i)\b[^`\r\n/]+[\ \t]+(?!(`))('${commands}')'
    ag '(?-i)\b(?!(`))('${commands}')[\ \t]+[^`\r\n/]+(?i)(commands?)'

* Spot where a command is mentioned:

    #commands="erlang|elixir|eex|iex|ex_unit|ex_doc|logger|elixirc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    commands="mix|elixirc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    ag -s '(?<!(\`))(?<!(\.))(?<!(/))(?<!(:))(?<!(_))\b('${commands}')\b(?!(:))(?!(\?))(?!(_))(?!(-))(?!(\.))(?!(\`))(?!(/))(?!(>))' \
    --ignore "*.erl" --ignore "*.yrl" --ignore "*.src"
2015-09-11 18:49:51 +07:00
eksperimental ca00f04089 Avoid splitting words that use hyphen
For the ones in the documentation, a space will be added in after the hyphen.
Just for consistency and to ease detection, I have replaced the ones in
comments as well.

Command to detect these lines:

    ag "\w+-\n"
2015-09-07 21:22:25 +07:00
eksperimental 8d5c009b13 Correct descriptions in @doc, @moduledoc, @shortdoc to use Present Continuous
It makes it consistent with the rest of the docs.

I have just looked for the first line in @doc, @moduledoc, so lines bellow it may still need
to be corrected.

@shortdoc all have been corrected.

Inspired by: https://github.com/elixir-lang/elixir/pull/2942

Command to list the first lines:

```sh
  # first line in @moduledoc / @doc
  ag '(@(module)?doc)\s+("{3})(\r|\n|.)\s*+[\w-]+(?<!s)\b'

  # also @shortdoc
  ag '(@shortdoc)\s+("{1,3})(\r|\n|.)\s*+[\w-]+(?<!s)\b'
```
2015-09-07 18:40:58 +07:00
José Valim 27ec972023 Remove usage of use Behaviour 2015-08-14 23:02:20 +02:00
José Valim b83cd9b514 Ensure blocks do not clobber eex buffer 2015-05-11 23:07:26 +02:00
Louis Pilfold 51530e9a28 Revert d49fb06 now underlying issue has been resolved.
The old formatting is much nicer. :)

This reverts commit d49fb0662c.
2015-05-01 09:02:06 +01:00
Louis Pilfold d49fb0662c EEx doc: Prevent list from being rendered as code blocks 2015-04-30 17:26:53 +01:00
Or Neeman 9e9fe04dae EEx: allow ) after end in end tokens
Closes #3017
2015-04-10 20:49:06 -06:00
Or Neeman cea84ddfeb EEx: correct doc for handle_assign/1 2015-04-10 11:14:54 -06:00
eksperimental f7e8651ed6 remove repeated word 2015-04-07 06:47:25 +07:00
José Valim e7170f5b6e Only make tokenizer return char lists 2015-03-27 09:54:20 -07:00
José Valim eea3f0fa3f Merge pull request #3194 from oneeman/eex-trim
EEx: Add trim option
2015-03-27 08:26:13 -07:00
Or Neeman 0a1859b6a3 Refactor trim mode 2015-03-25 19:31:01 -06:00
eksperimental 823807efc3 correct @spec for handle_expr 2015-03-25 23:53:44 +07:00
eksperimental 8f679e9a0f Explicitely declare argument names for functions with unnamed arguments. 2015-03-25 16:26:07 +07:00
Or Neeman d90f6ed858 EEx: Add trim option
If the `trim` option is used, trims around EEx tags:
- On left, up to the line break if all whitespace
- On right, up to and including the line break if all whitespace

Does not trim around quotations (`<%% %>`), but does trim around
any tags inside a quotation.

Closes #3154
2015-03-23 19:26:18 -06:00
Or Neeman 18998d974f EEx: convert tag type markers to char lists 2015-03-22 13:36:54 -06:00
Or Neeman 135d02e6cc EEx: fix interpolation inside quotations
Closes #3159
2015-03-22 09:00:34 -06:00
Or Neeman 4a08413069 Fix error in EEx docstring ("a macro" to "an expression") 2015-03-21 14:26:24 -06:00
Alexander Ivanov a288ddd326 Add column info in tokenizer, #2987
Add column info for each token in elixir_tokenizer.
Change the format of location info from `Line` to `[Line, BeginColumn,
EndColumn]`. Pass the current column after the current line in
`elixir_tokenizer:tokenize`. Reflect the change in related modules.
2015-01-05 03:34:53 +02:00
Doug Yun 03b04e735e smart_engine: Rephrases doc 2014-12-19 01:07:54 -05:00
José Valim ef0009daaa Unify error reporting from EEx, closes #2833 2014-10-21 11:25:20 -02:00
Shayan Pooya 0ca9d1663d fix typos 2014-10-16 12:50:12 -05:00
José Valim 6f36787e03 No longer inline binary expressions in EEx
String.Chars is now always inlined by the compiler.

Closes #2815
2014-10-12 19:34:50 +02:00
Peter Ericson 4995baa2e3 fix example sample.ex -> sample.eex 2014-09-14 12:26:43 +00:00
José Valim 39fa2878ce Fix list rendering on ANSI docs 2014-08-06 19:42:26 +02:00
José Valim 058b157b36 Remove deprecated features and deprecate soft ones 2014-07-12 16:23:17 +02:00
José Valim 071b0830f8 Ensure line numbers are properly preserved in EEx, closes #2485 2014-07-04 11:54:07 +02:00
José Valim c8a0158791 Add @external_resource attribute, closes #2455 2014-06-27 22:16:34 +02:00
José Valim 5c7fdcc244 Soft deprecate EEx.TransformerEngine and EEx.AssignsEngine 2014-06-24 13:51:17 +02:00
Alexei Sholik 41c74e9682 Fix ordered list formatting
The rules are similar to those for the unordered lists (see previous
commits). Subsequent lines and paragraphs should be aligned to the
beginning of the sentence on the first line, like this:

  1. This is a list item,
     it has a second line.

     Also paragraph.

  2. Second list item.

         code fragment

Short, one-sentence items that can be read as part of the surrounding
paragraph can start with a non-capital letter
2014-06-17 16:34:20 +03:00
Alexei Sholik e0f5dd506a Apply uniform capitalization and punctuation rules to all lists
* Never use capital letters after `-`. Sentences start right after
    the bullet and continue to the first period.

  * When list elements are one or two sentences, use non-capitalized
    format without terminators.

    The two sentences are converted into one, separated by a semicolon.
    This mainly applies to the cases with short sentences or when only
    one of many list elements needs to have two sentences.

    Example:

        * `:opt_a` - basic description, no terminator
        * `:opt_b` - also short description; this used to be second
          sentence

  * When at least one list element needs to have real sentences, 
    the whole list is formatted like that, with a period at the end
    of each element:

        * `:opt_a` - this is still short.

        * `:opt_b` or `:opt_c` - but this is longer. May have multiple 
          sentences.

          Or even paragraphs.
2014-06-17 16:25:16 +03:00
Alexei Sholik 55503239a4 Add missing backticks 2014-06-17 03:00:00 +03:00
Alexei Sholik 915ba1bb29 Reformat unordered lists in all docstrings
List items are marked with a star (*). Bullets marking list elements
must have a 2-space indent. The continuation lines should be indented
by 2 more spaces.

The second and subsequent paragraphs need to be indented 4 spaces
from the beginning of the line to be included in the list item.

The code fragments have to be indented 8 spaces from the beginning
of the line (or 4 spaces from the beginning of the preceding paragraph).

Sublists are marked with a hyphen (-). They follow the rules above
with the difference that their initial indent will be greater
(8 spaces from the beginning of the line).
2014-06-17 02:01:27 +03:00
José Valim 7ba3c3cfb7 Revert "EEx tests aware of CR+LF newline on Windows"
This reverts commit f60d3668ed.
2014-05-31 09:58:29 +02:00
chyndman f60d3668ed EEx tests aware of CR+LF newline on Windows 2014-05-28 10:25:16 -07:00
José Valim 84262257ef Move Integer/Float conversions to their respective modules 2014-05-17 16:29:49 +02:00
José Valim 68dd952b45 More deprecations around tuples and records 2014-05-17 16:13:02 +02:00
José Valim bf8f5c4bb8 Add String.to_char_list and List.to_string 2014-05-17 13:59:17 +02:00
José Valim 3bb8e17e9e Add iodata_to_binary and chardata_to_string to IO 2014-05-17 13:06:40 +02:00
José Valim c22e8e85dc Convert exceptions to structs 2014-05-16 00:01:49 +02:00
José Valim 8b203a8379 Use IO.ANSI.Docs to format mix help 2014-05-08 20:13:29 +02:00
Alexei Sholik c4de5f1849 Don't mention default EEx engine twice; add a note about it in the code 2014-04-25 14:50:51 +03:00
José Valim 4df91f14ee Fix bug in for comprehensions 2014-04-24 11:27:49 +02:00
José Valim 611bdbd0bc Remove records from EEx 2014-04-23 12:58:21 +02:00
José Valim 56f15d9f4e Do not add spaces after { and before }
This makes the source code consistent with the result
returned by inspect/2.
2014-04-21 19:06:35 +02:00
José Valim 6624f31472 Merge branch 'jv-char-data'
Conflicts:
	lib/eex/lib/eex/tokenizer.ex
	lib/elixir/lib/file.ex
	lib/elixir/lib/kernel.ex
	lib/elixir/lib/record/extractor.ex
	lib/elixir/lib/string.ex
	lib/ex_unit/lib/ex_unit/doc_test.ex
	lib/mix/lib/mix/archive.ex
	lib/mix/lib/mix/dep/fetcher.ex
	lib/mix/lib/mix/dep/umbrella.ex
2014-04-21 08:38:48 +02:00
Igor Kapkov 97e70e6de1 change some doc examples to iex style 2014-04-12 08:41:22 +02:00
Eric Meadows-Jönsson f7d0c8c58e Add handle_body/1 callback to EEx.Engine 2014-04-08 19:17:59 +02:00