Commit Graph

48 Commits

Author SHA1 Message Date
John Athayde
76bb36c4df
Add print styles to Rails guides (#51458)
This updates print CSS to be more inline with the overall style. The sidebar is inlined (same as mobile), and content is 100%. Previous code in the launch from boilerplate has been struck or integrated better.

* Links show in text after the original link text
* Border line around code and copy button are removed
* Print is now generated from SCSS to CSS via the generator that builds the other CSS files

Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
2024-04-18 13:31:43 -03:00
John Athayde
1e4f12c12c
Guides visual redesign (#51341)
Improve the visual presentation of the Rails Guides, bringing them more inline with the new marketing rubyonrails.org site, as part of a project with the Rails Foundation.

The CSS has been recreated from SCSS files, generated into the final pieces. The stylesrc directory contains those commented source files. The generate task will now process those scss => css files.

Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
2024-03-20 16:50:51 -03:00
Petrik
a720480a0a Improve dom_id uniqueness in guides
All headers in a guide get a unique `dom_id` to make anchor links work.
If a header is already present we would prefix it with the `dom_id` of
the parent node. This would not work for headers without parent nodes.

This commit simplifies the `dom_id` uniqueness by only prepending the
parent node if it exists. This can still result in duplicates at the
same level, but for these we already show a warning:

    *** DUPLICATE ID: 'some_id', please make sure that there are no
    headings with the same name at the same level.

Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
2024-02-08 19:18:58 +01:00
John Hawthorn
1f51d7d441 Revert "Fix guides generator"
This reverts commit 1be5e790eba2b1c069d5f15980a5c8ccdc4aa237.
2023-03-30 13:51:28 -07:00
zzak
1be5e790eb
Fix guides generator
Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
2023-02-21 13:43:25 +09:00
Geon George
56e96d9344 Replaces mobi guide with epub for docs because of discontinued support
Removes kindlerb logic

Adds template for epub generator

Renames the kindle dir to /epub

Adds epub module to generator and replaces kindle

Fixes mimetype

Creates basic epub book

Deletes old kindle module

Adds zip package

Updates rubyzip gem name

Removes now unused gepub gem

Adds the required container file for epubs

Fixes media type

Adds new epub generation logic

Removes all buttons from output html

Refactors and generates valid epub files

Removes frontmatter logic used for kindlegen

Filters out epub files in zip

Updates link to kindle doc on sidebar

Fixes rubocop issues

Adds deprecation warning for the old kindle task

Refactors and cleans up epub module

Cleans up epub code

Cleans up private internal method code style

Removes unnecessary imagemagick check
2022-08-05 00:18:20 +05:30
Jonathan Hefner
23d0cd6f6f Unify LTR / RTL CSS for guides
When `main.css` is updated, it is easy for `main.rtl.css` to be
overlooked (see #45423).

This commit eliminates `main.rtl.css` in favor of a unified approach to
LTR / RTL styling in `main.css`.  To accomplish this, the `<body>`
element is rendered with a [`dir` attribute][] (which has the same
effect as setting the CSS `direction` property), and LTR- / RTL-specific
styles are prefixed with `:where(body[dir="..."])` selectors.  (The
[`:where()` pseudo-class][] ensures that selector specificity is not
changed.)

This change also paves the way for automatic detection and application
of LTR / RTL styles when the [`:dir()` pseudo-class][] gains widespread
browser support.

[`dir` attribute]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir
[`:where()` pseudo-class]: https://developer.mozilla.org/en-US/docs/Web/CSS/:where
[`:dir()` pseudo-class]: https://developer.mozilla.org/en-US/docs/Web/CSS/:dir
2022-06-22 16:42:48 -05:00
John Bampton
d6f47017ad Fix spelling
Change `there're` to `there are`

`there're` is not in the dictionary and we use `there are` in many places

https://www.dictionary.com/misspelling?term=there%27re
2022-03-27 05:19:40 +10:00
Hartley McGuire
8b71dc15ef use DidYouMean for broken link fixes in guides
Ruby 2.7+ includes DidYouMean::SpellChecker, so we can use that for
suggesting corrections for broken links instead of a vendored
Levenshtein algorithm.
2022-03-14 16:35:06 -04:00
Ryuta Kamizono
c07dff7227 Auto-correct for delete_prefix/delete_suffix
Follow up to #39409.
2020-06-05 12:40:39 +09:00
Lukas_Skywalker
0589fe4c3a Remove Indexer class from Rails Guide generator
This commit removes the orphaned Indexer class from the Rails Guide
generator. The indexer was removed in 2012 during the move from Textile
to Markdown in commit 5e2866cc3445646d8df049413aa5fbf03fa605ef.
2020-05-13 22:21:35 +02:00
Takayuki Nakata
a341b06622 Suppress deprecation warning in generating the guide index.html
In generating the guide `index.html`, the warning below happens.

```
$ bundle exec rake guides:generate:html
(snip)
Generating index.html.erb as index.html
DEPRECATION WARNING: render file: should be given the absolute path to
a file
(snip)
```
2019-11-08 09:21:23 +09:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
localhostdotdev
d4710fc538 Fix rails guides generation
Was getting `formats=': Invalid formats: "html"
2019-03-22 18:45:22 +01:00
Vipul A M
bb8fe3701a After https://github.com/rails/rails/pull/35281 and https://github.com/rails/rails/pull/35036 AV warns about not having the compiled container.
Use the suggested with_empty_template_cache to overcome warning
2019-03-12 16:22:22 +05:30
Aaron Patterson
e17fe52e0e
Tighten up the AV::Base constructor
The AV::Base constructor was too complicated, and this commit tightens
up the parameters it will take.  At runtime, AV::Base is most commonly
constructed here:

  94d54fa4ab/actionview/lib/action_view/rendering.rb (L72-L74)

This provides an AV::Renderer instance, a hash of assignments, and a
controller instance.  Since this is the common case for construction, we
should remove logic from the constructor that handles other cases.  This
commit introduces special constructors for those other cases.
Interestingly, most code paths that construct AV::Base "strangely" are
tests.
2019-01-29 15:49:40 -08:00
Ryuta Kamizono
ea65d92f19
Enable Lint/UselessAssignment cop to avoid unused variable warnings (#34904)
* Enable `Lint/UselessAssignment` cop to avoid unused variable warnings

Since we've addressed the warning "assigned but unused variable"
frequently.

370537de05092aeea552146b42042833212a1acc
3040446cece8e7a6d9e29219e636e13f180a1e03
5ed618e192e9788094bd92c51255dda1c4fd0eae
76ebafe594fc23abc3764acc7a3758ca473799e5

And also, I've found the unused args in c1b14ad which raises no warnings
by the cop, it shows the value of the cop.
2019-01-09 18:09:01 +09:00
Yosuke Kabuto
cb343ef672 Use safe nav operator when calling RailsGuides::Generator.new
Use String for direction of RailsGuides::Generator
2018-12-05 12:41:07 +09:00
Alberto Almagro
5020c2e302 Use direction instead of rtl flag.
Improve readability by using `direction` as CSS does.

More info: https://developer.mozilla.org/en-US/docs/Web/CSS/direction
Continues: #34486

[Alberto Almagro + Ufuk Kayserilioglu]
2018-11-22 22:39:13 +01:00
Rafael Mendonça França
c4720a25ed Merge pull request #34486 from tamarr/master
allow right to left styling of docs
2018-11-19 13:20:08 -05:00
tamarr
29e0ed13f5
allow right to left styling of docs (#3)
* adding rtl css main file and logic to use
2018-11-19 18:59:52 +02:00
Yoshiyuki Hirano
f8d346f9fd Not generate needless files in guides
Not generate needless files:

* _license.html.erb, _welcome.html.erb are partial files.
* layout.html.erb is the layout file.
2018-04-02 18:30:23 +09:00
Koichi ITO
1f37d846a9 Use frozen string literal in guides/ 2017-08-13 22:04:09 +09:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Shia
ac00659b1b Fix to use correct path with language on guide 2017-03-08 10:54:06 +09:00
Xavier Noria
771a802c37 refactors and fixes in guides generation [ci skip]
This commit is not precisely atomic, but the changes have evolved, summary:

* The ENV-based interface has been moved upwards, the generator has now a conventional
  initializer.

* RAILS_VERSION is now assumed to be a Git tag. A blank RAILS_VERSION means edge guides.

* In consequence, the EDGE env variable is gone.

* The "local" version is also gone, the current SHA1 is computed for edge guides.

* Assumes guides are generated from a repo checkout (time ago users could
  generate them from gems.)

* The WARNINGS flag is gone in consequence, you cannot disable warnings.

* The `api_link` Markdown helper is fixed.

* Docs about usage have one single place: rake guides:help.

* Links in guides have been revised.
2017-02-12 10:33:50 +01:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
1607ee299d modernizes hash syntax in guides 2016-08-06 19:39:28 +02:00
Xavier Noria
6b3719b757 applies new string literal convention in guides
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:21:59 +02:00
Aditya Kapoor
3f7d85bdd5 Correct guide generation command [ci skip] 2016-07-02 15:18:27 +05:30
Viktar Basharymau
35442422fa Simplify RailsGuides::Generator#select_only a bit
The main goal is to improve readability, but as a side effect this commit makes the method a bit faster.
2015-11-22 18:37:30 +03:00
Seiei Miyagi
b2e490ef54 Add ability to translate rails guides documents.yaml
Some translations of rails guides has their own documents.yaml, for example

Japanese:
https://github.com/yasslab/railsguides.jp/blob/japanese/guides/source/documents.yaml

Traditional Chinese:
https://github.com/docrails-tw/guides/blob/master/rails_guides/helpers.rb#L21,L27
https://github.com/docrails-tw/guides/blob/master/source/documents_zh-TW.yaml

The [Translating Rails Guides](https://github.com/rails/docrails/wiki/translating-rails-guides) says

> Copy the contents of guides/source into your own language directory and translate them.

So that sounds ok to copy guides/source/documents.yaml into language
specific directly and translating them like other markdown files.
2015-10-05 23:53:04 +09:00
yui-knk
ec895167c2 Fix place of require 'rails_guides/markdown' 2015-03-07 16:50:27 +09:00
laurocaetano
d48222d22e remove warnings on ruby trunk 2013-11-01 18:15:53 -02:00
Vijay Dev
86269b4207 Merge pull request #8348 from danchoi/master
Kindle ebook generation with working section navigation
2012-12-08 10:33:05 -08:00
Xavier Noria
0adcf6d90e let @version be always externally set in guides generation [fixes #8221]
Shelling out was there for authors convenience, but we are
rather going to have the tag or SHA1 always in RAILS_VERSION
and if the environment variable is blank, then just use
"local" as a reminder that you are just working locally.

The docs server has been updated to set the long SHA1 in
RAILS_VERSION when generating edge guides.
2012-12-07 15:20:56 +01:00
Daniel Choi
e8fe1d1a20 Add periodical-style TOC and navigation to Kindle version of guides 2012-12-01 18:08:10 -05:00
Xavier Noria
1e7b8d3a22 let .md be the only supported extension for guides 2012-09-18 23:04:12 +02:00
Prem Sichanugrist
5e2866cc34 No more Textile guide generation support 2012-09-17 15:55:17 -04:00
Prem Sichanugrist
232b9ade1a Skip kindle's readme file on generation 2012-09-17 15:54:22 -04:00
Prem Sichanugrist
544f6bcb90 Start rewriting 4.0 release note into Markdown 2012-09-17 15:54:21 -04:00
Rafael Magana
eb362e59c0 [guides] fix reference to railties directory, guides are no longer there 2012-05-28 16:21:25 -05:00
Rafael Magana
15b229e8aa [guides] guides:generate:kindle is the new interface to generate .mobi file instead of using KINDLE=1 2012-05-28 16:20:10 -05:00
Rafael Magana
1b5e1c1972 [guides] get rid of any reference to the generator script since rake tasks are now the new interface 2012-05-28 16:17:00 -05:00
Rafael Magana
e625056c82 [guides] update generator.rb to refer to guides:generate instead of generate_guides 2012-05-27 23:33:54 -05:00
Xavier Noria
6d87cd028b moves the guides up to the root directory 2012-03-17 08:32:49 -07:00