Unified · Split
| @@ -6,3 +6,6 @@ indent_style = space · 5 unmodified lines | |||
| 6 | indent_size = 2 | 6 | indent_size = 2 |
| 7 | insert_final_newline = true | 7 | insert_final_newline = true |
| 8 | trim_trailing_whitespace = true | 8 | trim_trailing_whitespace = true |
| 9 | |||
| 10 | [*.md] | ||
| 11 | trim_trailing_whitespace = false | ||
| @@ -24,20 +24,18 @@ Want to contribute? Great. Please review the following guidelines carefully and · 23 unmodified lines | |||
| 24 | ## Requesting new features | 24 | ## Requesting new features |
| 25 | 25 | ||
| 26 | 1. Search for similar feature requests; someone may have already requested it. | 26 | 1. Search for similar feature requests; someone may have already requested it. |
| 27 | 2. Make sure your feature fits DevDocs's [vision](https://github.com/freeCodeCamp/devdocs/blob/master/README.md#vision). | 27 | 2. Make sure your feature fits DevDocs's [vision](../README.md#vision). |
| 28 | 3. Provide a clear and detailed explanation of the feature and why it's important to add it. | 28 | 3. Provide a clear and detailed explanation of the feature and why it's important to add it. |
| 29 | 29 | ||
| 30 | For general feedback and ideas, please use the [mailing list](https://groups.google.com/d/forum/devdocs). | ||
| 31 | |||
| 32 | ## Requesting new documentations | 30 | ## Requesting new documentations |
| 33 | 31 | ||
| 34 | Please don't open issues to request new documentations. | 32 | Please don't open issues to request new documentations. |
| 35 | Use the [Trello board](https://trello.com/b/6BmTulfx/devdocs-documentation) where everyone can vote. | 33 | Use the [Trello board](https://trello.com/b/6BmTulfx/devdocs-documentation) where everyone can vote. |
| 36 | 34 | ||
| 37 | ## Contributing code and features | 35 | ## Contributing code and features |
| 38 | 36 | ||
| 39 | 1. Search for existing issues; someone may already be working on a similar feature. | 37 | 1. Search for existing issues; someone may already be working on a similar feature. |
| 40 | 2. Before embarking on any significant pull request, please open an issue describing the changes you intend to make. Otherwise you risk spending a lot of time working on something I may not want to merge. This also tells other contributors that you're working on the feature. | 38 | 2. Before embarking on any significant pull request, please open an issue describing the changes you intend to make. Otherwise you risk spending a lot of time working on something we may not want to merge. This also tells other contributors that you're working on the feature. |
| 41 | 3. Follow the [coding conventions](#coding-conventions). | 39 | 3. Follow the [coding conventions](#coding-conventions). |
| 42 | 4. If you're modifying the Ruby code, include tests and ensure they pass. | 40 | 4. If you're modifying the Ruby code, include tests and ensure they pass. |
| 43 | 5. Try to keep your pull request small and simple. | 41 | 5. Try to keep your pull request small and simple. |
| @@ -46,7 +44,7 @@ Use the [Trello board](https://trello.com/b/6BmTulfx/devdocs-documentation) wher · 2 unmodified lines | |||
| 46 | 44 | ||
| 47 | ## Contributing new documentations | 45 | ## Contributing new documentations |
| 48 | 46 | ||
| 49 | See the [wiki](https://github.com/freeCodeCamp/devdocs/wiki) to learn how to add new documentations. | 47 | See the [`docs` folder](https://github.com/freeCodeCamp/devdocs/tree/master/docs) to learn how to add new documentations. |
| 50 | 48 | ||
| 51 | **Important:** the documentation's license must permit alteration, redistribution and commercial use, and the documented software must be released under an open source license. Feel free to get in touch if you're not sure if a documentation meets those requirements. | 49 | **Important:** the documentation's license must permit alteration, redistribution and commercial use, and the documented software must be released under an open source license. Feel free to get in touch if you're not sure if a documentation meets those requirements. |
| 52 | 50 | ||
| @@ -65,13 +63,6 @@ Please don't submit a pull request updating the version number of a documentatio · 12 unmodified lines | |||
| 65 | 63 | ||
| 66 | To ask that an existing documentation be updated, please use the [Trello board](https://trello.com/c/2B0hmW7M/52-request-updates-here). | 64 | To ask that an existing documentation be updated, please use the [Trello board](https://trello.com/c/2B0hmW7M/52-request-updates-here). |
| 67 | 65 | ||
| 68 | ## Other contributions | ||
| 69 | |||
| 70 | Besides new docs and features, here are other ways you can contribute: | ||
| 71 | |||
| 72 | * **Improve our copy.** English isn't my first language so if you notice grammatical or usage errors, feel free to submit a pull request — it'll be much appreciated. | ||
| 73 | * **Participate in the issue tracker.** Your opinion matters — feel free to add comments to existing issues. You're also welcome to participate to the [mailing list](https://groups.google.com/d/forum/devdocs). | ||
| 74 | |||
| 75 | ## Coding conventions | 66 | ## Coding conventions |
| 76 | 67 | ||
| 77 | * two spaces; no tabs | 68 | * two spaces; no tabs |
| @@ -80,4 +71,4 @@ Besides new docs and features, here are other ways you can contribute: · 2 unmodified lines | |||
| 80 | 71 | ||
| 81 | ## Questions? | 72 | ## Questions? |
| 82 | 73 | ||
| 83 | If you have any questions, please feel free to ask on the [mailing list](https://groups.google.com/d/forum/devdocs). | 74 | If you have any questions, please feel free to ask them on the contributor chat room on [Gitter](https://gitter.im/FreeCodeCamp/DevDocs). |
| @@ -1,6 +1,6 @@ | |||
| 1 | <!-- | 1 | <!-- |
| 2 | Please read the contributing guidelines before opening an issue: | 2 | Please read the contributing guidelines before opening an issue: |
| 3 | https://github.com/freeCodeCamp/devdocs/blob/master/CONTRIBUTING.md | 3 | https://github.com/freeCodeCamp/devdocs/blob/master/.github/CONTRIBUTING.md |
| 4 | 4 | ||
| 5 | To request a new documentation, or an update of an existing documentation, go here: | 5 | To request a new documentation, or an update of an existing documentation, go here: |
| 6 | https://trello.com/b/6BmTulfx/devdocs-documentation | 6 | https://trello.com/b/6BmTulfx/devdocs-documentation |
| @@ -0,0 +1,8 @@ | |||
| 1 | daysUntilClose: 30 | ||
| 2 | responseRequiredLabel: needs-info | ||
| 3 | closeComment: > | ||
| 4 | This issue has been automatically closed because there has been no response | ||
| 5 | to our request for more information from the original author. With only the | ||
| 6 | information that’s currently in the issue, we don’t have enough information | ||
| 7 | to take action. Please comment if you have or find the answer we need so we | ||
| 8 | can investigate further. | ||
| @@ -1,10 +1,9 @@ | |||
| 1 | .DS_Store | 1 | .DS_Store |
| 2 | .bundle | 2 | .bundle |
| 3 | *.pxm | 3 | log |
| 4 | *.sketch | ||
| 5 | tmp | 4 | tmp |
| 6 | public/assets | 5 | public/assets |
| 7 | public/fonts | 6 | public/fonts |
| 8 | public/docs/**/* | 7 | public/docs/**/* |
| 9 | !public/docs/docs.json | 8 | docs/**/* |
| 10 | !public/docs/**/index.json | 9 | !docs/*.md |
| @@ -1 +1 @@ | |||
| 1 | 2.5.1 | 1 | 2.6.0 |
| @@ -1,4 +1,15 @@ | |||
| 1 | language: ruby | 1 | language: ruby |
| 2 | |||
| 3 | cache: bundler | ||
| 4 | |||
| 2 | before_script: | 5 | before_script: |
| 3 | - gem update --system | 6 | - gem update --system |
| 4 | - gem install bundler | 7 | - gem install bundler |
| 8 | |||
| 9 | deploy: | ||
| 10 | provider: heroku | ||
| 11 | app: devdocs | ||
| 12 | on: | ||
| 13 | branch: master | ||
| 14 | api_key: | ||
| 15 | secure: "4p1klvWJZSOImzFcKOduILjP93hlOlAhceWlYMKS4tU+TCFE8qTBzdKdFPSCsCgjB+YR9pBss+L0lJpVVMjSwFHXqpKe6EeUSltO2k7DFHfW7kXLUM/L0AfqXz+YXk76XUyZMhvOEbldPfaMaj10e8vgDOQCSHABDyK/4CU+hnI=" | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | |||
| 2 | > Our Code of Conduct is available here: <https://code-of-conduct.freecodecamp.org/> | ||
| @@ -1,13 +1,13 @@ | |||
| 1 | Copyright 2013-2018 Thibaut Courouble and other contributors | 1 | Copyright 2013-2019 Thibaut Courouble and other contributors |
| 2 | 2 | ||
| 3 | This Source Code Form is subject to the terms of the Mozilla Public | 3 | This Source Code Form is subject to the terms of the Mozilla Public |
| 4 | License, v. 2.0. If a copy of the MPL was not distributed with this | 4 | License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 | file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 | file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 | 6 | ||
| 7 | Please do not use the name DevDocs to endorse or promote products | 7 | Please do not use the name DevDocs to endorse or promote products |
| 8 | derived from this software without my permission, except as may be | 8 | derived from this software without the maintainers' permission, except |
| 9 | necessary to comply with the notice/attribution requirements. | 9 | as may be necessary to comply with the notice/attribution requirements. |
| 10 | 10 | ||
| 11 | I also wish that any documentation file generated using this software | 11 | We also wish that any documentation file generated using this software |
| 12 | be attributed to DevDocs. Let's be fair to all contributors by giving | 12 | be attributed to DevDocs. Let's be fair to all contributors by giving |
| 13 | credit where credit's due. Thanks. | 13 | credit where credit's due. Thanks. |
| @@ -1,6 +1,7 @@ | |||
| 1 | FROM ruby:2.5.1 | 1 | FROM ruby:2.6.0 |
| 2 | 2 | ||
| 3 | ENV LANG=C.UTF-8 | 3 | ENV LANG=C.UTF-8 |
| 4 | ENV ENABLE_SERVICE_WORKER=true | ||
| 4 | 5 | ||
| 5 | WORKDIR /devdocs | 6 | WORKDIR /devdocs |
| 6 | 7 | ||
| @@ -1,6 +1,7 @@ | |||
| 1 | FROM ruby:2.5.1-alpine | 1 | FROM ruby:2.6.0-alpine |
| 2 | 2 | ||
| 3 | ENV LANG=C.UTF-8 | 3 | ENV LANG=C.UTF-8 |
| 4 | ENV ENABLE_SERVICE_WORKER=true | ||
| 4 | 5 | ||
| 5 | WORKDIR /devdocs | 6 | WORKDIR /devdocs |
| 6 | 7 | ||
| @@ -1,16 +1,20 @@ | |||
| 1 | source 'https://rubygems.org' | 1 | source 'https://rubygems.org' |
| 2 | ruby '2.5.1' | 2 | ruby '2.6.0' |
| 3 | 3 | ||
| 4 | gem 'rake' | 4 | gem 'rake' |
| 5 | gem 'thor' | 5 | gem 'thor' |
| 6 | gem 'pry', '~> 0.11.0' | 6 | gem 'pry', '~> 0.12.0' |
| 7 | gem 'activesupport', '~> 5.2', require: false | 7 | gem 'activesupport', '~> 5.2', require: false |
| 8 | gem 'yajl-ruby', require: false | 8 | gem 'yajl-ruby', require: false |
| 9 | gem 'html-pipeline' | ||
| 10 | gem 'typhoeus' | ||
| 11 | gem 'nokogiri' | ||
| 9 | 12 | ||
| 10 | group :app do | 13 | group :app do |
| 11 | gem 'rack' | 14 | gem 'rack' |
| 12 | gem 'sinatra' | 15 | gem 'sinatra' |
| 13 | gem 'sinatra-contrib' | 16 | gem 'sinatra-contrib' |
| 17 | gem 'rack-ssl-enforcer' | ||
| 14 | gem 'thin' | 18 | gem 'thin' |
| 15 | gem 'sprockets' | 19 | gem 'sprockets' |
| 16 | gem 'sprockets-helpers' | 20 | gem 'sprockets-helpers' |
| @@ -30,14 +34,12 @@ group :development do · 13 unmodified lines | |||
| 30 | end | 34 | end |
| 31 | 35 | ||
| 32 | group :docs do | 36 | group :docs do |
| 33 | gem 'typhoeus' | ||
| 34 | gem 'nokogiri' | ||
| 35 | gem 'html-pipeline' | ||
| 36 | gem 'image_optim' | 37 | gem 'image_optim' |
| 37 | gem 'image_optim_pack', platforms: :ruby | 38 | gem 'image_optim_pack', platforms: :ruby |
| 38 | gem 'progress_bar', require: false | 39 | gem 'progress_bar', require: false |
| 39 | gem 'unix_utils', require: false | 40 | gem 'unix_utils', require: false |
| 40 | gem 'tty-pager', require: false | 41 | gem 'tty-pager', require: false |
| 42 | gem 'net-sftp', '>= 2.1.3.rc2', require: false | ||
| 41 | end | 43 | end |
| 42 | 44 | ||
| 43 | group :test do | 45 | group :test do |
| @@ -1,13 +1,13 @@ | |||
| 1 | GEM | 1 | GEM |
| 2 | remote: https://rubygems.org/ | 2 | remote: https://rubygems.org/ |
| 3 | specs: | 3 | specs: |
| 4 | activesupport (5.2.0) | 4 | activesupport (5.2.2) |
| 5 | concurrent-ruby (~> 1.0, >= 1.0.2) | 5 | concurrent-ruby (~> 1.0, >= 1.0.2) |
| 6 | i18n (>= 0.7, < 2) | 6 | i18n (>= 0.7, < 2) |
| 7 | minitest (~> 5.1) | 7 | minitest (~> 5.1) |
| 8 | tzinfo (~> 1.1) | 8 | tzinfo (~> 1.1) |
| 9 | backports (3.11.3) | 9 | backports (3.11.4) |
| 10 | better_errors (2.4.0) | 10 | better_errors (2.5.0) |
| 11 | coderay (>= 1.0.0) | 11 | coderay (>= 1.0.0) |
| 12 | erubi (>= 1.0.0) | 12 | erubi (>= 1.0.0) |
| 13 | rack (>= 0.9.0) | 13 | rack (>= 0.9.0) |
| @@ -17,105 +17,110 @@ GEM · 3 unmodified lines | |||
| 17 | coffee-script-source | 17 | coffee-script-source |
| 18 | execjs | 18 | execjs |
| 19 | coffee-script-source (1.12.2) | 19 | coffee-script-source (1.12.2) |
| 20 | concurrent-ruby (1.0.5) | 20 | concurrent-ruby (1.1.4) |
| 21 | daemons (1.2.6) | 21 | daemons (1.3.1) |
| 22 | erubi (1.7.1) | 22 | erubi (1.8.0) |
| 23 | ethon (0.11.0) | 23 | ethon (0.12.0) |
| 24 | ffi (>= 1.3.0) | 24 | ffi (>= 1.3.0) |
| 25 | eventmachine (1.2.7) | 25 | eventmachine (1.2.7) |
| 26 | execjs (2.7.0) | 26 | execjs (2.7.0) |
| 27 | exifr (1.3.4) | 27 | exifr (1.3.5) |
| 28 | ffi (1.9.25) | 28 | ffi (1.10.0) |
| 29 | fspath (3.1.0) | 29 | fspath (3.1.0) |
| 30 | highline (1.7.10) | 30 | highline (2.0.0) |
| 31 | html-pipeline (2.8.4) | 31 | html-pipeline (2.10.0) |
| 32 | activesupport (>= 2) | 32 | activesupport (>= 2) |
| 33 | nokogiri (>= 1.4) | 33 | nokogiri (>= 1.4) |
| 34 | i18n (1.0.1) | 34 | i18n (1.5.2) |
| 35 | concurrent-ruby (~> 1.0) | 35 | concurrent-ruby (~> 1.0) |
| 36 | image_optim (0.26.1) | 36 | image_optim (0.26.3) |
| 37 | exifr (~> 1.2, >= 1.2.2) | 37 | exifr (~> 1.2, >= 1.2.2) |
| 38 | fspath (~> 3.0) | 38 | fspath (~> 3.0) |
| 39 | image_size (~> 1.5) | 39 | image_size (>= 1.5, < 3) |
| 40 | in_threads (~> 1.3) | 40 | in_threads (~> 1.3) |
| 41 | progress (~> 3.0, >= 3.0.1) | 41 | progress (~> 3.0, >= 3.0.1) |
| 42 | image_optim_pack (0.5.1) | 42 | image_optim_pack (0.5.1.20190105) |
| 43 | fspath (>= 2.1, < 4) | 43 | fspath (>= 2.1, < 4) |
| 44 | image_optim (~> 0.19) | 44 | image_optim (~> 0.19) |
| 45 | image_size (1.5.0) | 45 | image_size (2.0.0) |
| 46 | in_threads (1.5.0) | 46 | in_threads (1.5.1) |
| 47 | method_source (0.9.0) | 47 | method_source (0.9.2) |
| 48 | mini_portile2 (2.3.0) | 48 | mini_portile2 (2.4.0) |
| 49 | minitest (5.11.3) | 49 | minitest (5.11.3) |
| 50 | multi_json (1.13.1) | 50 | multi_json (1.13.1) |
| 51 | mustermann (1.0.2) | 51 | mustermann (1.0.3) |
| 52 | newrelic_rpm (5.2.0.345) | 52 | net-sftp (3.0.0.beta1) |
| 53 | nokogiri (1.8.4) | 53 | net-ssh (>= 5.0.0, < 6.0.0) |
| 54 | mini_portile2 (~> 2.3.0) | 54 | net-ssh (5.1.0) |
| 55 | newrelic_rpm (5.7.0.350) | ||
| 56 | nokogiri (1.10.1) | ||
| 57 | mini_portile2 (~> 2.4.0) | ||
| 55 | options (2.3.2) | 58 | options (2.3.2) |
| 56 | progress (3.4.0) | 59 | progress (3.5.0) |
| 57 | progress_bar (1.2.0) | 60 | progress_bar (1.3.0) |
| 58 | highline (~> 1.6) | 61 | highline (>= 1.6, < 3) |
| 59 | options (~> 2.3.0) | 62 | options (~> 2.3.0) |
| 60 | pry (0.11.3) | 63 | pry (0.12.2) |
| 61 | coderay (~> 1.1.0) | 64 | coderay (~> 1.1.0) |
| 62 | method_source (~> 0.9.0) | 65 | method_source (~> 0.9.0) |
| 63 | rack (2.0.5) | 66 | rack (2.0.6) |
| 64 | rack-protection (2.0.3) | 67 | rack-protection (2.0.5) |
| 65 | rack | 68 | rack |
| 69 | rack-ssl-enforcer (0.2.9) | ||
| 66 | rack-test (1.1.0) | 70 | rack-test (1.1.0) |
| 67 | rack (>= 1.0, < 3) | 71 | rack (>= 1.0, < 3) |
| 68 | rake (12.3.1) | 72 | rake (12.3.2) |
| 69 | rb-fsevent (0.10.3) | 73 | rb-fsevent (0.10.3) |
| 70 | rb-inotify (0.9.10) | 74 | rb-inotify (0.10.0) |
| 71 | ffi (>= 0.5.0, < 2) | 75 | ffi (~> 1.0) |
| 72 | rr (1.2.1) | 76 | rr (1.2.1) |
| 73 | sass (3.5.7) | 77 | sass (3.7.3) |
| 74 | sass-listen (~> 4.0.0) | 78 | sass-listen (~> 4.0.0) |
| 75 | sass-listen (4.0.0) | 79 | sass-listen (4.0.0) |
| 76 | rb-fsevent (~> 0.9, >= 0.9.4) | 80 | rb-fsevent (~> 0.9, >= 0.9.4) |
| 77 | rb-inotify (~> 0.9, >= 0.9.7) | 81 | rb-inotify (~> 0.9, >= 0.9.7) |
| 78 | sinatra (2.0.3) | 82 | sinatra (2.0.5) |
| 79 | mustermann (~> 1.0) | 83 | mustermann (~> 1.0) |
| 80 | rack (~> 2.0) | 84 | rack (~> 2.0) |
| 81 | rack-protection (= 2.0.3) | 85 | rack-protection (= 2.0.5) |
| 82 | tilt (~> 2.0) | 86 | tilt (~> 2.0) |
| 83 | sinatra-contrib (2.0.3) | 87 | sinatra-contrib (2.0.5) |
| 84 | activesupport (>= 4.0.0) | ||
| 85 | backports (>= 2.8.2) | 88 | backports (>= 2.8.2) |
| 86 | multi_json | 89 | multi_json |
| 87 | mustermann (~> 1.0) | 90 | mustermann (~> 1.0) |
| 88 | rack-protection (= 2.0.3) | 91 | rack-protection (= 2.0.5) |
| 89 | sinatra (= 2.0.3) | 92 | sinatra (= 2.0.5) |
| 90 | tilt (>= 1.3, < 3) | 93 | tilt (>= 1.3, < 3) |
| 91 | sprockets (3.7.2) | 94 | sprockets (3.7.2) |
| 92 | concurrent-ruby (~> 1.0) | 95 | concurrent-ruby (~> 1.0) |
| 93 | rack (> 1, < 3) | 96 | rack (> 1, < 3) |
| 94 | sprockets-helpers (1.2.1) | 97 | sprockets-helpers (1.2.1) |
| 95 | sprockets (>= 2.2) | 98 | sprockets (>= 2.2) |
| 96 | strings (0.1.1) | 99 | strings (0.1.4) |
| 97 | unicode-display_width (~> 1.3.0) | 100 | strings-ansi (~> 0.1.0) |
| 101 | unicode-display_width (~> 1.4.0) | ||
| 98 | unicode_utils (~> 1.4.0) | 102 | unicode_utils (~> 1.4.0) |
| 103 | strings-ansi (0.1.0) | ||
| 99 | thin (1.7.2) | 104 | thin (1.7.2) |
| 100 | daemons (~> 1.0, >= 1.0.9) | 105 | daemons (~> 1.0, >= 1.0.9) |
| 101 | eventmachine (~> 1.0, >= 1.0.4) | 106 | eventmachine (~> 1.0, >= 1.0.4) |
| 102 | rack (>= 1, < 3) | 107 | rack (>= 1, < 3) |
| 103 | thor (0.20.0) | 108 | thor (0.20.3) |
| 104 | thread_safe (0.3.6) | 109 | thread_safe (0.3.6) |
| 105 | tilt (2.0.8) | 110 | tilt (2.0.9) |
| 106 | tty-pager (0.11.0) | 111 | tty-pager (0.12.0) |
| 107 | strings (~> 0.1.0) | 112 | strings (~> 0.1.4) |
| 108 | tty-screen (~> 0.6.4) | 113 | tty-screen (~> 0.6) |
| 109 | tty-which (~> 0.3.0) | 114 | tty-which (~> 0.4) |
| 110 | tty-screen (0.6.5) | 115 | tty-screen (0.6.5) |
| 111 | tty-which (0.3.0) | 116 | tty-which (0.4.0) |
| 112 | typhoeus (1.3.0) | 117 | typhoeus (1.3.1) |
| 113 | ethon (>= 0.9.0) | 118 | ethon (>= 0.9.0) |
| 114 | tzinfo (1.2.5) | 119 | tzinfo (1.2.5) |
| 115 | thread_safe (~> 0.1) | 120 | thread_safe (~> 0.1) |
| 116 | uglifier (4.1.17) | 121 | uglifier (4.1.20) |
| 117 | execjs (>= 0.3.0, < 3) | 122 | execjs (>= 0.3.0, < 3) |
| 118 | unicode-display_width (1.3.3) | 123 | unicode-display_width (1.4.1) |
| 119 | unicode_utils (1.4.0) | 124 | unicode_utils (1.4.0) |
| 120 | unix_utils (0.0.15) | 125 | unix_utils (0.0.15) |
| 121 | yajl-ruby (1.4.1) | 126 | yajl-ruby (1.4.1) |
| @@ -133,11 +138,13 @@ DEPENDENCIES · 11 unmodified lines | |||
| 133 | image_optim | 138 | image_optim |
| 134 | image_optim_pack | 139 | image_optim_pack |
| 135 | minitest | 140 | minitest |
| 141 | net-sftp (>= 2.1.3.rc2) | ||
| 136 | newrelic_rpm | 142 | newrelic_rpm |
| 137 | nokogiri | 143 | nokogiri |
| 138 | progress_bar | 144 | progress_bar |
| 139 | pry (~> 0.11.0) | 145 | pry (~> 0.12.0) |
| 140 | rack | 146 | rack |
| 147 | rack-ssl-enforcer | ||
| 141 | rack-test | 148 | rack-test |
| 142 | rake | 149 | rake |
| 143 | rr | 150 | rr |
| @@ -155,7 +162,7 @@ DEPENDENCIES · 11 unmodified lines | |||
| 155 | yajl-ruby | 162 | yajl-ruby |
| 156 | 163 | ||
| 157 | RUBY VERSION | 164 | RUBY VERSION |
| 158 | ruby 2.5.1p57 | 165 | ruby 2.6.0p0 |
| 159 | 166 | ||
| 160 | BUNDLED WITH | 167 | BUNDLED WITH |
| 161 | 1.16.1 | 168 | 1.17.2 |
| @@ -0,0 +1,11 @@ | |||
| 1 | If you’re adding a new scraper, please ensure that you have: | ||
| 2 | |||
| 3 | - [ ] Tested the scraper on a local copy of DevDocs | ||
| 4 | - [ ] Ensured that the docs are styled similarly to other docs on DevDocs | ||
| 5 | <!-- If the docs don’t have an icon, delete the next four items: --> | ||
| 6 | - [ ] Added these files to the <code>public/icons/*your_scraper_name*/</code> directory: | ||
| 7 | - [ ] `16.png`: a 16×16 pixel icon for the doc | ||
| 8 | - [ ] `16@2x.png`: a 32×32 pixel icon for the doc | ||
| 9 | - [ ] `SOURCE`: A text file containing the URL to the page the image can be found on or the URL of the original image itself | ||
| 10 | |||
| 11 | <!-- Replace the `[ ]` with a `[x]` once you’ve completed each step. --> | ||
| @@ -1,25 +1,24 @@ | |||
| 1 | # [DevDocs](https://devdocs.io) [](https://travis-ci.org/freeCodeCamp/devdocs) | 1 | # [DevDocs](https://devdocs.io) — API Documentation Browser [](https://travis-ci.org/freeCodeCamp/devdocs) |
| 2 | 2 | ||
| 3 | DevDocs combines multiple API documentations in a fast, organized, and searchable interface. | 3 | DevDocs combines multiple developer documentations in a clean and organized web UI with instant search, offline support, mobile version, dark theme, keyboard shortcuts, and more. |
| 4 | 4 | ||
| 5 | * Created by [Thibaut Courouble](https://thibaut.me) | 5 | DevDocs was created by [Thibaut Courouble](https://thibaut.me) and is operated by [freeCodeCamp](https://www.freecodecamp.org). |
| 6 | 6 | ||
| 7 | Keep track of development news: | 7 | Keep track of development news: |
| 8 | 8 | ||
| 9 | * Join the contributor chat room on [Gitter](https://gitter.im/FreeCodeCamp/DevDocs) | 9 | * Join the contributor chat room on [Gitter](https://gitter.im/FreeCodeCamp/DevDocs) |
| 10 | * Watch the repository on [GitHub](https://github.com/freeCodeCamp/devdocs/subscription) | 10 | * Watch the repository on [GitHub](https://github.com/freeCodeCamp/devdocs/subscription) |
| 11 | * Follow [@DevDocs](https://twitter.com/DevDocs) on Twitter | 11 | * Follow [@DevDocs](https://twitter.com/DevDocs) on Twitter |
| 12 | * Join the [mailing list](https://groups.google.com/d/forum/devdocs) | ||
| 13 | 12 | ||
| 14 | **Table of Contents:** [Quick Start](#quick-start) · [Vision](#vision) · [App](#app) · [Scraper](#scraper) · [Commands](#available-commands) · [Contributing](#contributing) · [License](#copyright--license) · [Questions?](#questions) | 13 | **Table of Contents:** [Quick Start](#quick-start) · [Vision](#vision) · [App](#app) · [Scraper](#scraper) · [Commands](#available-commands) · [Contributing](#contributing) · [Documentation](#documentation) · [Plugins and Extensions](#plugins-and-extensions) · [License](#copyright--license) · [Questions?](#questions) |
| 15 | 14 | ||
| 16 | ## Quick Start | 15 | ## Quick Start |
| 17 | 16 | ||
| 18 | Unless you wish to contribute to the project, I recommend using the hosted version at [devdocs.io](https://devdocs.io). It's up-to-date and works offline out-of-the-box. | 17 | Unless you wish to contribute to the project, we recommend using the hosted version at [devdocs.io](https://devdocs.io). It's up-to-date and works offline out-of-the-box. |
| 19 | 18 | ||
| 20 | DevDocs is made of two pieces: a Ruby scraper that generates the documentation and metadata, and a JavaScript app powered by a small Sinatra app. | 19 | DevDocs is made of two pieces: a Ruby scraper that generates the documentation and metadata, and a JavaScript app powered by a small Sinatra app. |
| 21 | 20 | ||
| 22 | DevDocs requires Ruby 2.5.1, libcurl, and a JavaScript runtime supported by [ExecJS](https://github.com/rails/execjs#readme) (included in OS X and Windows; [Node.js](https://nodejs.org/en/) on Linux). Once you have these installed, run the following commands: | 21 | DevDocs requires Ruby 2.6.0, libcurl, and a JavaScript runtime supported by [ExecJS](https://github.com/rails/execjs#readme) (included in OS X and Windows; [Node.js](https://nodejs.org/en/) on Linux). Once you have these installed, run the following commands: |
| 23 | 22 | ||
| 24 | ``` | 23 | ``` |
| 25 | git clone https://github.com/freeCodeCamp/devdocs.git && cd devdocs | 24 | git clone https://github.com/freeCodeCamp/devdocs.git && cd devdocs |
| @@ -60,18 +59,14 @@ The web app is all client-side JavaScript, written in [CoffeeScript](http://coff · 34 unmodified lines | |||
| 60 | 59 | ||
| 61 | Many of the code's design decisions were driven by the fact that the app uses XHR to load content directly into the main frame. This includes stripping the original documents of most of their HTML markup (e.g. scripts and stylesheets) to avoid polluting the main frame, and prefixing all CSS class names with an underscore to prevent conflicts. | 60 | Many of the code's design decisions were driven by the fact that the app uses XHR to load content directly into the main frame. This includes stripping the original documents of most of their HTML markup (e.g. scripts and stylesheets) to avoid polluting the main frame, and prefixing all CSS class names with an underscore to prevent conflicts. |
| 62 | 61 | ||
| 63 | Another driving factor is performance and the fact that everything happens in the browser. `applicationCache` (which comes with its own set of constraints) and `localStorage` are used to speed up the boot time, while memory consumption is kept in check by allowing the user to pick his/her own set of documentations. The search algorithm is kept simple because it needs to be fast even searching through 100,000 strings. | 62 | Another driving factor is performance and the fact that everything happens in the browser. A service worker (which comes with its own set of constraints) and `localStorage` are used to speed up the boot time, while memory consumption is kept in check by allowing the user to pick his/her own set of documentations. The search algorithm is kept simple because it needs to be fast even searching through 100,000 strings. |
| 64 | 63 | ||
| 65 | DevDocs being a developer tool, the browser requirements are high: | 64 | DevDocs being a developer tool, the browser requirements are high: |
| 66 | 65 | ||
| 67 | 1. On the desktop: | 66 | * Recent versions of Firefox, Chrome, or Opera |
| 68 | * Recent version of Chrome, Firefox, or Opera | 67 | * Safari 11.1+ |
| 69 | * Safari 8+ | 68 | * Edge 17+ |
| 70 | * IE / Edge 10+ | 69 | * iOS 11.3+ |
| 71 | 2. On mobile: | ||
| 72 | * iOS 8+ | ||
| 73 | * Android 4.1+ | ||
| 74 | * Windows Phone 8+ | ||
| 75 | 70 | ||
| 76 | This allows the code to take advantage of the latest DOM and HTML5 APIs and make developing DevDocs a lot more fun! | 71 | This allows the code to take advantage of the latest DOM and HTML5 APIs and make developing DevDocs a lot more fun! |
| 77 | 72 | ||
| @@ -88,12 +83,13 @@ Modifications made to each document include: · 10 unmodified lines | |||
| 88 | * replacing all external (not scraped) URLs with their fully qualified counterpart | 83 | * replacing all external (not scraped) URLs with their fully qualified counterpart |
| 89 | * replacing all internal (scraped) URLs with their unqualified and relative counterpart | 84 | * replacing all internal (scraped) URLs with their unqualified and relative counterpart |
| 90 | * adding content, such as a title and link to the original document | 85 | * adding content, such as a title and link to the original document |
| 86 | * ensuring correct syntax highlighting using [Prism](http://prismjs.com/) | ||
| 91 | 87 | ||
| 92 | These modifications are applied via a set of filters using the [HTML::Pipeline](https://github.com/jch/html-pipeline) library. Each scraper includes filters specific to itself, one of which is tasked with figuring out the pages' metadata. | 88 | These modifications are applied via a set of filters using the [HTML::Pipeline](https://github.com/jch/html-pipeline) library. Each scraper includes filters specific to itself, one of which is tasked with figuring out the pages' metadata. |
| 93 | 89 | ||
| 94 | The end result is a set of normalized HTML partials and two JSON files (index + offline data). Because the index files are loaded separately by the [app](#app) following the user's preferences, the scraper also creates a JSON manifest file containing information about the documentations currently available on the system (such as their name, version, update date, etc.). | 90 | The end result is a set of normalized HTML partials and two JSON files (index + offline data). Because the index files are loaded separately by the [app](#app) following the user's preferences, the scraper also creates a JSON manifest file containing information about the documentations currently available on the system (such as their name, version, update date, etc.). |
| 95 | 91 | ||
| 96 | More information about scrapers and filters is available on the [wiki](https://github.com/freeCodeCamp/devdocs/wiki). | 92 | More information about [scrapers](./docs/scraper-reference.md) and [filters](./docs/filter-reference.md) is available in the `docs` folder. |
| 97 | 93 | ||
| 98 | ## Available Commands | 94 | ## Available Commands |
| 99 | 95 | ||
| @@ -133,20 +129,45 @@ If multiple versions of Ruby are installed on your system, commands must be run · 33 unmodified lines | |||
| 133 | 129 | ||
| 134 | ## Contributing | 130 | ## Contributing |
| 135 | 131 | ||
| 136 | Contributions are welcome. Please read the [contributing guidelines](https://github.com/freeCodeCamp/devdocs/blob/master/CONTRIBUTING.md). | 132 | Contributions are welcome. Please read the [contributing guidelines](./.github/CONTRIBUTING.md). |
| 137 | 133 | ||
| 138 | DevDocs's own documentation is available on the [wiki](https://github.com/freeCodeCamp/devdocs/wiki). | 134 | ## Documentation |
| 135 | |||
| 136 | * [Adding documentations to DevDocs](./docs/adding-docs.md) | ||
| 137 | * [Scraper Reference](./docs/scraper-reference.md) | ||
| 138 | * [Filter Reference](./docs/filter-reference.md) | ||
| 139 | * [Maintainers’ Guide](./docs/maintainers.md) | ||
| 140 | |||
| 141 | ## Plugins and Extensions | ||
| 142 | |||
| 143 | * [Chrome web app](https://chrome.google.com/webstore/detail/devdocs/mnfehgbmkapmjnhcnbodoamcioleeooe) | ||
| 144 | * [Ubuntu Touch app](https://uappexplorer.com/app/devdocsunofficial.berkes) | ||
| 145 | * [Sublime Text plugin](https://sublime.wbond.net/packages/DevDocs) | ||
| 146 | * [Atom plugin](https://atom.io/packages/devdocs) | ||
| 147 | * [Brackets extension](https://github.com/gruehle/dev-docs-viewer) | ||
| 148 | * [Fluid](http://fluidapp.com) for turning DevDocs into a real OS X app | ||
| 149 | * [GTK shell / Vim integration](https://github.com/naquad/devdocs-shell) | ||
| 150 | * [Emacs lookup](https://github.com/skeeto/devdocs-lookup) | ||
| 151 | * [Alfred Workflow](https://github.com/yannickglt/alfred-devdocs) | ||
| 152 | * [Vim search plugin with Devdocs in its defaults](https://github.com/waiting-for-dev/vim-www) Just set `let g:www_shortcut_engines = { 'devdocs': ['Devdocs', '<leader>dd'] }` to have a `:Devdocs` command and a `<leader>dd` mapping. | ||
| 153 | * [Visual Studio Code plugin](https://marketplace.visualstudio.com/items?itemName=akfish.vscode-devdocs ) (1) | ||
| 154 | * [Visual Studio Code plugin](https://marketplace.visualstudio.com/items?itemName=deibit.devdocs) (2) | ||
| 155 | * [Desktop application](https://github.com/egoist/devdocs-desktop) | ||
| 156 | * [Doc Browser](https://github.com/qwfy/doc-browser) is a native Linux app that supports DevDocs docsets | ||
| 157 | * [GNOME Application](https://github.com/hardpixel/devdocs-desktop) GTK3 application with search integrated in headerbar | ||
| 158 | * [macOS Application](https://github.com/dteoh/devdocs-macos) | ||
| 159 | * [Android Application](https://github.com/Merith-TK/devdocs_webapp_kotlin) is a fully working, advanced WebView | ||
| 139 | 160 | ||
| 140 | ## Copyright / License | 161 | ## Copyright / License |
| 141 | 162 | ||
| 142 | Copyright 2013-2018 Thibaut Courouble and [other contributors](https://github.com/freeCodeCamp/devdocs/graphs/contributors) | 163 | Copyright 2013-2019 Thibaut Courouble and [other contributors](https://github.com/freeCodeCamp/devdocs/graphs/contributors) |
| 143 | 164 | ||
| 144 | This software is licensed under the terms of the Mozilla Public License v2.0. See the [COPYRIGHT](https://github.com/freeCodeCamp/devdocs/blob/master/COPYRIGHT) and [LICENSE](https://github.com/freeCodeCamp/devdocs/blob/master/LICENSE) files. | 165 | This software is licensed under the terms of the Mozilla Public License v2.0. See the [COPYRIGHT](./COPYRIGHT) and [LICENSE](./LICENSE) files. |
| 145 | 166 | ||
| 146 | Please do not use the name DevDocs to endorse or promote products derived from this software without my permission, except as may be necessary to comply with the notice/attribution requirements. | 167 | Please do not use the name DevDocs to endorse or promote products derived from this software without the maintainers' permission, except as may be necessary to comply with the notice/attribution requirements. |
| 147 | 168 | ||
| 148 | I also wish that any documentation file generated using this software be attributed to DevDocs. Let's be fair to all contributors by giving credit where credit's due. Thanks! | 169 | We also wish that any documentation file generated using this software be attributed to DevDocs. Let's be fair to all contributors by giving credit where credit's due. Thanks! |
| 149 | 170 | ||
| 150 | ## Questions? | 171 | ## Questions? |
| 151 | 172 | ||
| 152 | If you have any questions, please feel free to ask them on the [mailing list](https://groups.google.com/d/forum/devdocs). | 173 | If you have any questions, please feel free to ask them on the contributor chat room on [Gitter](https://gitter.im/FreeCodeCamp/DevDocs). |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | |||
| 3 | require 'bundler/setup' | 3 | require 'bundler/setup' |
| 4 | require 'thor' | 4 | require 'thor' |
| 5 | 5 | ||
| 6 | Bundler.require :default | ||
| 6 | $LOAD_PATH.unshift 'lib' | 7 | $LOAD_PATH.unshift 'lib' |
| 7 | 8 | ||
| 8 | task :default do | 9 | task :default do |
| @@ -13,6 +14,9 @@ end · 4 unmodified lines | |||
| 13 | namespace :assets do | 14 | namespace :assets do |
| 14 | desc 'Compile all assets' | 15 | desc 'Compile all assets' |
| 15 | task :precompile do | 16 | task :precompile do |
| 17 | load 'tasks/docs.thor' | ||
| 18 | DocsCLI.new.prepare_deploy | ||
| 19 | |||
| 16 | load 'tasks/assets.thor' | 20 | load 'tasks/assets.thor' |
| 17 | AssetsCLI.new.compile | 21 | AssetsCLI.new.compile |
| 18 | end | 22 | end |
Binary file not shown.
Binary file not shown.
| @@ -13,10 +13,12 @@ · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | @el = $('._app') | 14 | @el = $('._app') |
| 15 | @localStorage = new LocalStorageStore | 15 | @localStorage = new LocalStorageStore |
| 16 | @appCache = new app.AppCache if app.AppCache.isEnabled() | 16 | @serviceWorker = new app.ServiceWorker if app.ServiceWorker.isEnabled() |
| 17 | @settings = new app.Settings | 17 | @settings = new app.Settings |
| 18 | @db = new app.DB() | 18 | @db = new app.DB() |
| 19 | 19 | ||
| 20 | @settings.initLayout() | ||
| 21 | |||
| 20 | @docs = new app.collections.Docs | 22 | @docs = new app.collections.Docs |
| 21 | @disabledDocs = new app.collections.Docs | 23 | @disabledDocs = new app.collections.Docs |
| 22 | @entries = new app.collections.Entries | 24 | @entries = new app.collections.Entries |
| @@ -150,7 +152,7 @@ · 127 unmodified lines | |||
| 150 | saveDocs: -> | 152 | saveDocs: -> |
| 151 | @settings.setDocs(doc.slug for doc in @docs.all()) | 153 | @settings.setDocs(doc.slug for doc in @docs.all()) |
| 152 | @db.migrate() | 154 | @db.migrate() |
| 153 | @appCache?.updateInBackground() | 155 | @serviceWorker?.updateInBackground() |
| 154 | 156 | ||
| 155 | welcomeBack: -> | 157 | welcomeBack: -> |
| 156 | visitCount = @settings.get('count') | 158 | visitCount = @settings.get('count') |
| @@ -160,17 +162,24 @@ · 3 unmodified lines | |||
| 160 | new app.views.Updates() | 162 | new app.views.Updates() |
| 161 | @updateChecker = new app.UpdateChecker() | 163 | @updateChecker = new app.UpdateChecker() |
| 162 | 164 | ||
| 165 | reboot: -> | ||
| 166 | if location.pathname isnt '/' and location.pathname isnt '/settings' | ||
| 167 | window.location = "/##{location.pathname}" | ||
| 168 | else | ||
| 169 | window.location = '/' | ||
| 170 | return | ||
| 171 | |||
| 163 | reload: -> | 172 | reload: -> |
| 164 | @docs.clearCache() | 173 | @docs.clearCache() |
| 165 | @disabledDocs.clearCache() | 174 | @disabledDocs.clearCache() |
| 166 | if @appCache then @appCache.reload() else window.location = '/' | 175 | if @serviceWorker then @serviceWorker.reload() else @reboot() |
| 167 | return | 176 | return |
| 168 | 177 | ||
| 169 | reset: -> | 178 | reset: -> |
| 170 | @localStorage.reset() | 179 | @localStorage.reset() |
| 171 | @settings.reset() | 180 | @settings.reset() |
| 172 | @db?.reset() | 181 | @db?.reset() |
| 173 | @appCache?.update() | 182 | @serviceWorker?.update() |
| 174 | window.location = '/' | 183 | window.location = '/' |
| 175 | return | 184 | return |
| 176 | 185 | ||
| @@ -189,9 +198,9 @@ · 12 unmodified lines | |||
| 189 | return | 198 | return |
| 190 | 199 | ||
| 191 | indexHost: -> | 200 | indexHost: -> |
| 192 | # Can't load the index files from the host/CDN when applicationCache is | 201 | # Can't load the index files from the host/CDN when service worker is |
| 193 | # enabled because it doesn't support caching URLs that use CORS. | 202 | # enabled because it doesn't support caching URLs that use CORS. |
| 194 | @config[if @appCache and @settings.hasDocs() then 'index_path' else 'docs_origin'] | 203 | @config[if @serviceWorker and @settings.hasDocs() then 'index_path' else 'docs_origin'] |
| 195 | 204 | ||
| 196 | onBootError: (args...) -> | 205 | onBootError: (args...) -> |
| 197 | @trigger 'bootError' | 206 | @trigger 'bootError' |
| @@ -248,7 +257,7 @@ · 50 unmodified lines | |||
| 248 | matchMedia: !!window.matchMedia | 257 | matchMedia: !!window.matchMedia |
| 249 | insertAdjacentHTML: !!document.body.insertAdjacentHTML | 258 | insertAdjacentHTML: !!document.body.insertAdjacentHTML |
| 250 | defaultPrevented: document.createEvent('CustomEvent').defaultPrevented is false | 259 | defaultPrevented: document.createEvent('CustomEvent').defaultPrevented is false |
| 251 | cssGradients: supportsCssGradients() | 260 | cssVariables: !!CSS?.supports?('(--t: 0)') |
| 252 | 261 | ||
| 253 | for key, value of features when not value | 262 | for key, value of features when not value |
| 254 | Raven.captureMessage "unsupported/#{key}", level: 'info' | 263 | Raven.captureMessage "unsupported/#{key}", level: 'info' |
| @@ -271,9 +280,4 @@ · 16 unmodified lines | |||
| 271 | isInvalidLocation: -> | 280 | isInvalidLocation: -> |
| 272 | @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0 | 281 | @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0 |
| 273 | 282 | ||
| 274 | supportsCssGradients = -> | ||
| 275 | el = document.createElement('div') | ||
| 276 | el.style.cssText = "background-image: -webkit-linear-gradient(top, #000, #fff); background-image: linear-gradient(to top, #000, #fff);" | ||
| 277 | el.style.backgroundImage.indexOf('gradient') >= 0 | ||
| 278 | |||
| 279 | $.extend app, Events | 283 | $.extend app, Events |
| @@ -1,42 +0,0 @@ | |||
| 1 | class app.AppCache | ||
| 2 | $.extend @prototype, Events | ||
| 3 | |||
| 4 | @isEnabled: -> | ||
| 5 | try | ||
| 6 | applicationCache and applicationCache.status isnt applicationCache.UNCACHED | ||
| 7 | catch | ||
| 8 | |||
| 9 | constructor: -> | ||
| 10 | @cache = applicationCache | ||
| 11 | @notifyUpdate = true | ||
| 12 | @onUpdateReady() if @cache.status is @cache.UPDATEREADY | ||
| 13 | |||
| 14 | $.on @cache, 'progress', @onProgress | ||
| 15 | $.on @cache, 'updateready', @onUpdateReady | ||
| 16 | |||
| 17 | update: -> | ||
| 18 | @notifyUpdate = true | ||
| 19 | @notifyProgress = true | ||
| 20 | try @cache.update() catch | ||
| 21 | return | ||
| 22 | |||
| 23 | updateInBackground: -> | ||
| 24 | @notifyUpdate = false | ||
| 25 | @notifyProgress = false | ||
| 26 | try @cache.update() catch | ||
| 27 | return | ||
| 28 | |||
| 29 | reload: -> | ||
| 30 | $.on @cache, 'updateready noupdate error', -> window.location = '/' | ||
| 31 | @notifyUpdate = false | ||
| 32 | @notifyProgress = true | ||
| 33 | try @cache.update() catch | ||
| 34 | return | ||
| 35 | |||
| 36 | onProgress: (event) => | ||
| 37 | @trigger 'progress', event if @notifyProgress | ||
| 38 | return | ||
| 39 | |||
| 40 | onUpdateReady: => | ||
| 41 | @trigger 'updateready' if @notifyUpdate | ||
| 42 | return | ||
| @@ -13,3 +13,5 @@ app.config = · 12 unmodified lines | |||
| 13 | version: <%= Time.now.to_i %> | 13 | version: <%= Time.now.to_i %> |
| 14 | release: <%= Time.now.utc.httpdate.to_json %> | 14 | release: <%= Time.now.utc.httpdate.to_json %> |
| 15 | mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css' | 15 | mathml_stylesheet: '<%= App.cdn_origin %>/mathml.css' |
| 16 | service_worker_path: '/service-worker.js' | ||
| 17 | service_worker_enabled: <%= App.environment == :production || ENV['ENABLE_SERVICE_WORKER'] == 'true' %> | ||
| @@ -0,0 +1,49 @@ | |||
| 1 | class app.ServiceWorker | ||
| 2 | $.extend @prototype, Events | ||
| 3 | |||
| 4 | @isEnabled: -> | ||
| 5 | !!navigator.serviceWorker and app.config.service_worker_enabled | ||
| 6 | |||
| 7 | constructor: -> | ||
| 8 | @registration = null | ||
| 9 | @notifyUpdate = true | ||
| 10 | |||
| 11 | navigator.serviceWorker.register(app.config.service_worker_path, {scope: '/'}) | ||
| 12 | .then( | ||
| 13 | (registration) => @updateRegistration(registration), | ||
| 14 | (error) -> console.error('Could not register service worker:', error) | ||
| 15 | ) | ||
| 16 | |||
| 17 | update: -> | ||
| 18 | return unless @registration | ||
| 19 | @notifyUpdate = true | ||
| 20 | return @registration.update().catch(->) | ||
| 21 | |||
| 22 | updateInBackground: -> | ||
| 23 | return unless @registration | ||
| 24 | @notifyUpdate = false | ||
| 25 | return @registration.update().catch(->) | ||
| 26 | |||
| 27 | reload: -> | ||
| 28 | return @updateInBackground().then(() -> app.reboot()) | ||
| 29 | |||
| 30 | updateRegistration: (registration) -> | ||
| 31 | @registration = registration | ||
| 32 | $.on @registration, 'updatefound', @onUpdateFound | ||
| 33 | return | ||
| 34 | |||
| 35 | onUpdateFound: => | ||
| 36 | $.off @installingRegistration, 'statechange', @onStateChange() if @installingRegistration | ||
| 37 | @installingRegistration = @registration.installing | ||
| 38 | $.on @installingRegistration, 'statechange', @onStateChange | ||
| 39 | return | ||
| 40 | |||
| 41 | onStateChange: => | ||
| 42 | if @installingRegistration and @installingRegistration.state == 'installed' and navigator.serviceWorker.controller | ||
| 43 | @installingRegistration = null | ||
| 44 | @onUpdateReady() | ||
| 45 | return | ||
| 46 | |||
| 47 | onUpdateReady: -> | ||
| 48 | @trigger 'updateready' if @notifyUpdate | ||
| 49 | return | ||
| @@ -5,6 +5,7 @@ class app.Settings · 4 unmodified lines | |||
| 5 | 'manualUpdate' | 5 | 'manualUpdate' |
| 6 | 'fastScroll' | 6 | 'fastScroll' |
| 7 | 'arrowScroll' | 7 | 'arrowScroll' |
| 8 | 'analyticsConsent' | ||
| 8 | 'docs' | 9 | 'docs' |
| 9 | 'dark' | 10 | 'dark' |
| 10 | 'layout' | 11 | 'layout' |
| @@ -20,6 +21,8 @@ class app.Settings · 9 unmodified lines | |||
| 20 | 'news' | 21 | 'news' |
| 21 | ] | 22 | ] |
| 22 | 23 | ||
| 24 | LAYOUTS: ['_max-width', '_sidebar-hidden', '_native-scrollbars'] | ||
| 25 | |||
| 23 | @defaults: | 26 | @defaults: |
| 24 | count: 0 | 27 | count: 0 |
| 25 | hideDisabled: false | 28 | hideDisabled: false |
| @@ -27,6 +30,7 @@ class app.Settings · 1 unmodified line | |||
| 27 | news: 0 | 30 | news: 0 |
| 28 | manualUpdate: false | 31 | manualUpdate: false |
| 29 | schema: 1 | 32 | schema: 1 |
| 33 | analyticsConsent: false | ||
| 30 | 34 | ||
| 31 | constructor: -> | 35 | constructor: -> |
| 32 | @store = new CookieStore | 36 | @store = new CookieStore |
| @@ -39,6 +43,7 @@ class app.Settings · 6 unmodified lines | |||
| 39 | set: (key, value) -> | 43 | set: (key, value) -> |
| 40 | @store.set(key, value) | 44 | @store.set(key, value) |
| 41 | delete @cache[key] | 45 | delete @cache[key] |
| 46 | @toggleDark(value) if key == 'dark' | ||
| 42 | return | 47 | return |
| 43 | 48 | ||
| 44 | del: (key) -> | 49 | del: (key) -> |
| @@ -64,6 +69,8 @@ class app.Settings · 19 unmodified lines | |||
| 64 | return | 69 | return |
| 65 | 70 | ||
| 66 | setLayout: (name, enable) -> | 71 | setLayout: (name, enable) -> |
| 72 | @toggleLayout(name, enable) | ||
| 73 | |||
| 67 | layout = (@store.get('layout') || '').split(' ') | 74 | layout = (@store.get('layout') || '').split(' ') |
| 68 | $.arrayDelete(layout, '') | 75 | $.arrayDelete(layout, '') |
| 69 | 76 | ||
| @@ -105,3 +112,28 @@ class app.Settings · 35 unmodified lines | |||
| 105 | @store.reset() | 112 | @store.reset() |
| 106 | @cache = {} | 113 | @cache = {} |
| 107 | return | 114 | return |
| 115 | |||
| 116 | initLayout: -> | ||
| 117 | @toggleDark(@get('dark') is 1) | ||
| 118 | @toggleLayout(layout, @hasLayout(layout)) for layout in @LAYOUTS | ||
| 119 | @initSidebarWidth() | ||
| 120 | return | ||
| 121 | |||
| 122 | toggleDark: (enable) -> | ||
| 123 | classList = document.documentElement.classList | ||
| 124 | classList.toggle('_theme-default', !enable) | ||
| 125 | classList.toggle('_theme-dark', enable) | ||
| 126 | color = getComputedStyle(document.documentElement).getPropertyValue('--headerBackground').trim() | ||
| 127 | $('meta[name=theme-color]').setAttribute('content', color) | ||
| 128 | return | ||
| 129 | |||
| 130 | toggleLayout: (layout, enable) -> | ||
| 131 | classList = document.body.classList | ||
| 132 | classList.toggle(layout, enable) unless layout is '_sidebar-hidden' | ||
| 133 | classList.toggle('_overlay-scrollbars', $.overlayScrollbarsEnabled()) | ||
| 134 | return | ||
| 135 | |||
| 136 | initSidebarWidth: -> | ||
| 137 | size = @get('size') | ||
| 138 | document.documentElement.style.setProperty('--sidebarWidth', size + 'px') if size | ||
| 139 | return | ||
| @@ -3,13 +3,13 @@ class app.UpdateChecker · 2 unmodified lines | |||
| 3 | @lastCheck = Date.now() | 3 | @lastCheck = Date.now() |
| 4 | 4 | ||
| 5 | $.on window, 'focus', @onFocus | 5 | $.on window, 'focus', @onFocus |
| 6 | app.appCache.on 'updateready', @onUpdateReady if app.appCache | 6 | app.serviceWorker?.on 'updateready', @onUpdateReady |
| 7 | 7 | ||
| 8 | setTimeout @checkDocs, 0 | 8 | setTimeout @checkDocs, 0 |
| 9 | 9 | ||
| 10 | check: -> | 10 | check: -> |
| 11 | if app.appCache | 11 | if app.serviceWorker |
| 12 | app.appCache.update() | 12 | app.serviceWorker.update() |
| 13 | else | 13 | else |
| 14 | ajax | 14 | ajax |
| 15 | url: $('script[src*="application"]').getAttribute('src') | 15 | url: $('script[src*="application"]').getAttribute('src') |
| @@ -1,5 +1,5 @@ | |||
| 1 | ### | 1 | ### |
| 2 | * Copyright 2013-2018 Thibaut Courouble and other contributors | 2 | * Copyright 2013-2019 Thibaut Courouble and other contributors |
| 3 | * | 3 | * |
| 4 | * This source code is licensed under the terms of the Mozilla | 4 | * This source code is licensed under the terms of the Mozilla |
| 5 | * Public License, v. 2.0, a copy of which may be obtained at: | 5 | * Public License, v. 2.0, a copy of which may be obtained at: |
| @@ -190,7 +190,7 @@ isSameOrigin = (url) -> · 189 unmodified lines | |||
| 190 | 190 | ||
| 191 | updateCanonicalLink = -> | 191 | updateCanonicalLink = -> |
| 192 | @canonicalLink ||= document.head.querySelector('link[rel="canonical"]') | 192 | @canonicalLink ||= document.head.querySelector('link[rel="canonical"]') |
| 193 | @canonicalLink.setAttribute('href', "http://#{location.host}#{location.pathname}") | 193 | @canonicalLink.setAttribute('href', "https://#{location.host}#{location.pathname}") |
| 194 | 194 | ||
| 195 | trackers = [] | 195 | trackers = [] |
| 196 | 196 | ||
| @@ -199,5 +199,21 @@ page.track = (fn) -> · 2 unmodified lines | |||
| 199 | return | 199 | return |
| 200 | 200 | ||
| 201 | track = -> | 201 | track = -> |
| 202 | tracker.call() for tracker in trackers | 202 | consentGiven = Cookies.get('analyticsConsent') |
| 203 | consentAsked = Cookies.get('analyticsConsentAsked') | ||
| 204 | |||
| 205 | if consentGiven == '1' | ||
| 206 | tracker.call() for tracker in trackers | ||
| 207 | else if consentGiven == undefined and consentAsked == undefined | ||
| 208 | # Only ask for consent once per browser session | ||
| 209 | Cookies.set('analyticsConsentAsked', '1') | ||
| 210 | |||
| 211 | new app.views.Notif 'AnalyticsConsent', autoHide: null | ||
| 212 | return | ||
| 213 | |||
| 214 | @resetAnalytics = -> | ||
| 215 | for cookie in document.cookie.split(/;\s?/) | ||
| 216 | name = cookie.split('=')[0] | ||
| 217 | if name[0] == '_' | ||
| 218 | Cookies.expire(name) | ||
| 203 | return | 219 | return |
| @@ -352,6 +352,10 @@ isIE = null · 351 unmodified lines | |||
| 352 | $.isIE = -> | 352 | $.isIE = -> |
| 353 | isIE ?= navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0 | 353 | isIE ?= navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0 |
| 354 | 354 | ||
| 355 | isChromeForAndroid = null | ||
| 356 | $.isChromeForAndroid = -> | ||
| 357 | isChromeForAndroid ?= navigator.userAgent?.indexOf('Android') >= 0 && /Chrome\/([.0-9])+ Mobile/.test(navigator.userAgent) | ||
| 358 | |||
| 355 | isAndroid = null | 359 | isAndroid = null |
| 356 | $.isAndroid = -> | 360 | $.isAndroid = -> |
| 357 | isAndroid ?= navigator.userAgent?.indexOf('Android') >= 0 | 361 | isAndroid ?= navigator.userAgent?.indexOf('Android') >= 0 |
| @@ -1,5 +1,12 @@ | |||
| 1 | [ | 1 | [ |
| 2 | [ | 2 | [ |
| 3 | "2019-07-19", | ||
| 4 | "Replaced the AppCache with a Service Worker (which makes DevDocs an installable PWA) and fixed layout preferences on Firefox." | ||
| 5 | ], | ||
| 6 | [ | ||
| 7 | "2018-09-23", | ||
| 8 | "New documentations: <a href=\"/puppeteer/\">Puppeteer</a> and <a href=\"/handlebars/\">Handlebars.js</a>" | ||
| 9 | ], [ | ||
| 3 | "2018-08-12", | 10 | "2018-08-12", |
| 4 | "New documentations: <a href=\"/dart/\">Dart</a> and <a href=\"/qt/\">Qt</a>" | 11 | "New documentations: <a href=\"/dart/\">Dart</a> and <a href=\"/qt/\">Qt</a>" |
| 5 | ], [ | 12 | ], [ |
| @@ -12,8 +12,8 @@ app.templates.notFoundPage = -> · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | app.templates.pageLoadError = -> | 13 | app.templates.pageLoadError = -> |
| 14 | error """ The page failed to load. """, | 14 | error """ The page failed to load. """, |
| 15 | """ It may be missing from the server (try reloading the app) or you could be offline.<br> | 15 | """ It may be missing from the server (try reloading the app) or you could be offline (try <a href="/offline">installing the documentation for offline usage</a> when online again).<br> |
| 16 | If you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests. """, | 16 | If you're online and you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests. """, |
| 17 | """ #{back} · <a href="/##{location.pathname}" target="_top" class="_error-link">Reload</a> | 17 | """ #{back} · <a href="/##{location.pathname}" target="_top" class="_error-link">Reload</a> |
| 18 | · <a href="#" class="_error-link" data-retry>Retry</a> """ | 18 | · <a href="#" class="_error-link" data-retry>Retry</a> """ |
| 19 | 19 | ||
| @@ -56,21 +56,18 @@ app.templates.unsupportedBrowser = """ · 36 unmodified lines | |||
| 56 | <h1 class="_fail-title">Your browser is unsupported, sorry.</h1> | 56 | <h1 class="_fail-title">Your browser is unsupported, sorry.</h1> |
| 57 | <p class="_fail-text">DevDocs is an API documentation browser which supports the following browsers: | 57 | <p class="_fail-text">DevDocs is an API documentation browser which supports the following browsers: |
| 58 | <ul class="_fail-list"> | 58 | <ul class="_fail-list"> |
| 59 | <li>Recent versions of Chrome and Firefox | 59 | <li>Recent versions of Firefox, Chrome, or Opera |
| 60 | <li>Safari 5.1+ | 60 | <li>Safari 11.1+ |
| 61 | <li>Opera 12.1+ | 61 | <li>Edge 17+ |
| 62 | <li>Internet Explorer 10+ | 62 | <li>iOS 11.3+ |
| 63 | <li>iOS 6+ | ||
| 64 | <li>Android 4.1+ | ||
| 65 | <li>Windows Phone 8+ | ||
| 66 | </ul> | 63 | </ul> |
| 67 | <p class="_fail-text"> | 64 | <p class="_fail-text"> |
| 68 | If you're unable to upgrade, I apologize. | 65 | If you're unable to upgrade, we apologize. |
| 69 | I decided to prioritize speed and new features over support for older browsers. | 66 | We decided to prioritize speed and new features over support for older browsers. |
| 70 | <p class="_fail-text"> | 67 | <p class="_fail-text"> |
| 71 | Note: if you're already using one of the browsers above, check your settings and add-ons. | 68 | Note: if you're already using one of the browsers above, check your settings and add-ons. |
| 72 | The app uses feature detection, not user agent sniffing. | 69 | The app uses feature detection, not user agent sniffing. |
| 73 | <p class="_fail-text"> | 70 | <p class="_fail-text"> |
| 74 | — Thibaut <a href="https://twitter.com/DevDocs" class="_fail-link">@DevDocs</a> | 71 | — <a href="https://twitter.com/DevDocs">@DevDocs</a> |
| 75 | </div> | 72 | </div> |
| 76 | """ | 73 | """ |
| @@ -68,3 +68,9 @@ app.templates.notifShare = -> · 67 unmodified lines | |||
| 68 | app.templates.notifUpdateDocs = -> | 68 | app.templates.notifUpdateDocs = -> |
| 69 | textNotif """ Documentation updates available. """, | 69 | textNotif """ Documentation updates available. """, |
| 70 | """ <a href="/offline">Install them</a> as soon as possible to avoid broken pages. """ | 70 | """ <a href="/offline">Install them</a> as soon as possible to avoid broken pages. """ |
| 71 | |||
| 72 | app.templates.notifAnalyticsConsent = -> | ||
| 73 | textNotif """ Tracking cookies """, | ||
| 74 | """ We would like to gather usage data about how DevDocs is used through Google Analytics and Gauges. We only collect anonymous traffic information. | ||
| 75 | Please confirm if you accept our tracking cookies. You can always change your decision in the settings. | ||
| 76 | <br><span class="_notif-right"><a href="#" data-behavior="accept-analytics">Accept</a> or <a href="#" data-behavior="decline-analytics">Decline</a></span> """ | ||
| @@ -11,22 +11,18 @@ app.templates.aboutPage = -> """ · 10 unmodified lines | |||
| 11 | </nav> | 11 | </nav> |
| 12 | 12 | ||
| 13 | <h1 class="_lined-heading">DevDocs: API Documentation Browser</h1> | 13 | <h1 class="_lined-heading">DevDocs: API Documentation Browser</h1> |
| 14 | <p>DevDocs combines multiple API documentations in a clean and organized web UI with instant search, offline support, mobile version, dark theme, keyboard shortcuts, and more. | 14 | <p>DevDocs combines multiple developer documentations in a clean and organized web UI with instant search, offline support, mobile version, dark theme, keyboard shortcuts, and more. |
| 15 | <ul> | 15 | <p>DevDocs is free and <a href="https://github.com/freeCodeCamp/devdocs">open source</a>. It was created by <a href="https://thibaut.me">Thibaut Courouble</a> and is operated by <a href="https://www.freecodecamp.org/">freeCodeCamp</a>. |
| 16 | <li>Created and maintained by <a href="https://thibaut.me">Thibaut Courouble</a> | ||
| 17 | <li>Free and <a href="https://github.com/freeCodeCamp/devdocs">open source</a> | ||
| 18 | <iframe class="_github-btn" src="https://ghbtns.com/github-btn.html?user=freeCodeCamp&repo=devdocs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20" tabindex="-1"></iframe> | ||
| 19 | </ul> | ||
| 20 | <p>To keep up-to-date with the latest news: | 16 | <p>To keep up-to-date with the latest news: |
| 21 | <ul> | 17 | <ul> |
| 22 | <li>Follow <a href="https://twitter.com/DevDocs">@DevDocs</a> on Twitter | 18 | <li>Follow <a href="https://twitter.com/DevDocs">@DevDocs</a> on Twitter |
| 23 | <li>Watch the repository on <a href="https://github.com/freeCodeCamp/devdocs/subscription">GitHub</a> | 19 | <li>Watch the repository on <a href="https://github.com/freeCodeCamp/devdocs/subscription">GitHub</a> <iframe class="_github-btn" src="https://ghbtns.com/github-btn.html?user=freeCodeCamp&repo=devdocs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20" tabindex="-1"></iframe> |
| 24 | <li>Join the <a href="https://groups.google.com/d/forum/devdocs">mailing list</a> | 20 | <li>Join the <a href="https://gitter.im/FreeCodeCamp/DevDocs">Gitter</a> chat room |
| 25 | </ul> | 21 | </ul> |
| 26 | 22 | ||
| 27 | <h2 class="_block-heading" id="copyright">Copyright and License</h2> | 23 | <h2 class="_block-heading" id="copyright">Copyright and License</h2> |
| 28 | <p class="_note"> | 24 | <p class="_note"> |
| 29 | <strong>Copyright 2013–2018 Thibaut Courouble and <a href="https://github.com/freeCodeCamp/devdocs/graphs/contributors">other contributors</a></strong><br> | 25 | <strong>Copyright 2013–2019 Thibaut Courouble and <a href="https://github.com/freeCodeCamp/devdocs/graphs/contributors">other contributors</a></strong><br> |
| 30 | This software is licensed under the terms of the Mozilla Public License v2.0.<br> | 26 | This software is licensed under the terms of the Mozilla Public License v2.0.<br> |
| 31 | You may obtain a copy of the source code at <a href="https://github.com/freeCodeCamp/devdocs">github.com/freeCodeCamp/devdocs</a>.<br> | 27 | You may obtain a copy of the source code at <a href="https://github.com/freeCodeCamp/devdocs">github.com/freeCodeCamp/devdocs</a>.<br> |
| 32 | For more information, see the <a href="https://github.com/freeCodeCamp/devdocs/blob/master/COPYRIGHT">COPYRIGHT</a> | 28 | For more information, see the <a href="https://github.com/freeCodeCamp/devdocs/blob/master/COPYRIGHT">COPYRIGHT</a> |
| @@ -48,11 +44,10 @@ app.templates.aboutPage = -> """ · 15 unmodified lines | |||
| 48 | <dt>Where can I suggest new docs and features? | 44 | <dt>Where can I suggest new docs and features? |
| 49 | <dd>You can suggest and vote for new docs on the <a href="https://trello.com/b/6BmTulfx/devdocs-documentation">Trello board</a>.<br> | 45 | <dd>You can suggest and vote for new docs on the <a href="https://trello.com/b/6BmTulfx/devdocs-documentation">Trello board</a>.<br> |
| 50 | If you have a specific feature request, add it to the <a href="https://github.com/freeCodeCamp/devdocs/issues">issue tracker</a>.<br> | 46 | If you have a specific feature request, add it to the <a href="https://github.com/freeCodeCamp/devdocs/issues">issue tracker</a>.<br> |
| 51 | Otherwise use the <a href="https://groups.google.com/d/forum/devdocs">mailing list</a>. | 47 | Otherwise, come talk to us in the <a href="https://gitter.im/FreeCodeCamp/DevDocs">Gitter</a> chat room. |
| 52 | <dt>Where can I report bugs? | 48 | <dt>Where can I report bugs? |
| 53 | <dd>In the <a href="https://github.com/freeCodeCamp/devdocs/issues">issue tracker</a>. Thanks! | 49 | <dd>In the <a href="https://github.com/freeCodeCamp/devdocs/issues">issue tracker</a>. Thanks! |
| 54 | </dl> | 50 | </dl> |
| 55 | <p>For anything else, feel free to email me at <a href="mailto:thibaut@devdocs.io">thibaut@devdocs.io</a>. | ||
| 56 | 51 | ||
| 57 | <h2 class="_block-heading" id="credits">Credits</h2> | 52 | <h2 class="_block-heading" id="credits">Credits</h2> |
| 58 | 53 | ||
| @@ -76,12 +71,13 @@ app.templates.aboutPage = -> """ · 17 unmodified lines | |||
| 76 | 71 | ||
| 77 | <h2 class="_block-heading" id="privacy">Privacy Policy</h2> | 72 | <h2 class="_block-heading" id="privacy">Privacy Policy</h2> |
| 78 | <ul> | 73 | <ul> |
| 79 | <li><a href="https://devdocs.io">devdocs.io</a> ("App") is operated by Thibaut Courouble ("We"). | 74 | <li><a href="https://devdocs.io">devdocs.io</a> ("App") is operated by <a href="https://www.freecodecamp.org/">freeCodeCamp</a> ("We"). |
| 80 | <li>We do not collect personal information. | 75 | <li>We do not collect personal information through the app. |
| 81 | <li>We use Google Analytics, Gauges and Sentry to collect anonymous traffic information and improve the app. | 76 | <li>We use Google Analytics and Gauges to collect anonymous traffic information if you have given consent to this. You can change your decision in the <a href="/settings">settings</a>. |
| 77 | <li>We use Sentry to collect crash data and improve the app. | ||
| 82 | <li>The app uses cookies to store user preferences. | 78 | <li>The app uses cookies to store user preferences. |
| 83 | <li>By using the app, you signify your acceptance of this policy. If you do not agree to this policy, please do not use the app. | 79 | <li>By using the app, you signify your acceptance of this policy. If you do not agree to this policy, please do not use the app. |
| 84 | <li>If you have any questions regarding privacy, please email <a href="mailto:thibaut@devdocs.io">thibaut@devdocs.io</a>. | 80 | <li>If you have any questions regarding privacy, please email <a href="mailto:privacy@freecodecamp.org">privacy@freecodecamp.org</a>. |
| 85 | </ul> | 81 | </ul> |
| 86 | """ | 82 | """ |
| 87 | 83 | ||
| @@ -102,7 +98,7 @@ credits = [ · 14 unmodified lines | |||
| 102 | 'https://www.apache.org/licenses/LICENSE-2.0' | 98 | 'https://www.apache.org/licenses/LICENSE-2.0' |
| 103 | ], [ | 99 | ], [ |
| 104 | 'Async', | 100 | 'Async', |
| 105 | '2010-2017 Caolan McMahon', | 101 | '2010-2018 Caolan McMahon', |
| 106 | 'MIT', | 102 | 'MIT', |
| 107 | 'https://raw.githubusercontent.com/caolan/async/master/LICENSE' | 103 | 'https://raw.githubusercontent.com/caolan/async/master/LICENSE' |
| 108 | ], [ | 104 | ], [ |
| @@ -192,7 +188,7 @@ credits = [ · 83 unmodified lines | |||
| 192 | 'https://raw.githubusercontent.com/jashkenas/coffeescript/master/LICENSE' | 188 | 'https://raw.githubusercontent.com/jashkenas/coffeescript/master/LICENSE' |
| 193 | ], [ | 189 | ], [ |
| 194 | 'Cordova', | 190 | 'Cordova', |
| 195 | '2012-2017 The Apache Software Foundation', | 191 | '2012-2018 The Apache Software Foundation', |
| 196 | 'Apache', | 192 | 'Apache', |
| 197 | 'https://raw.githubusercontent.com/apache/cordova-docs/master/LICENSE' | 193 | 'https://raw.githubusercontent.com/apache/cordova-docs/master/LICENSE' |
| 198 | ], [ | 194 | ], [ |
| @@ -310,6 +306,11 @@ credits = [ · 111 unmodified lines | |||
| 310 | 'GruntJS Team', | 306 | 'GruntJS Team', |
| 311 | 'MIT', | 307 | 'MIT', |
| 312 | 'https://github.com/gruntjs/grunt-docs/blob/master/package.json#L10' | 308 | 'https://github.com/gruntjs/grunt-docs/blob/master/package.json#L10' |
| 309 | ], [ | ||
| 310 | 'Handlebars', | ||
| 311 | '2011-2017 Yehuda Katz', | ||
| 312 | 'MIT', | ||
| 313 | 'https://raw.githubusercontent.com/wycats/handlebars.js/master/LICENSE' | ||
| 313 | ], [ | 314 | ], [ |
| 314 | 'Haskell', | 315 | 'Haskell', |
| 315 | 'The University of Glasgow', | 316 | 'The University of Glasgow', |
| @@ -367,7 +368,7 @@ credits = [ · 51 unmodified lines | |||
| 367 | 'https://raw.githubusercontent.com/jquery/api.jqueryui.com/master/LICENSE.txt' | 368 | 'https://raw.githubusercontent.com/jquery/api.jqueryui.com/master/LICENSE.txt' |
| 368 | ], [ | 369 | ], [ |
| 369 | 'Julia', | 370 | 'Julia', |
| 370 | '2009-2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors', | 371 | '2009-2018 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors', |
| 371 | 'MIT', | 372 | 'MIT', |
| 372 | 'https://raw.githubusercontent.com/JuliaLang/julia/master/LICENSE.md' | 373 | 'https://raw.githubusercontent.com/JuliaLang/julia/master/LICENSE.md' |
| 373 | ], [ | 374 | ], [ |
| @@ -437,7 +438,7 @@ credits = [ · 63 unmodified lines | |||
| 437 | 'https://daringfireball.net/projects/markdown/license' | 438 | 'https://daringfireball.net/projects/markdown/license' |
| 438 | ], [ | 439 | ], [ |
| 439 | 'Matplotlib', | 440 | 'Matplotlib', |
| 440 | '2012-2017 Matplotlib Development Team. All rights reserved.', | 441 | '2012-2018 Matplotlib Development Team. All rights reserved.', |
| 441 | 'Custom', | 442 | 'Custom', |
| 442 | 'https://raw.githubusercontent.com/matplotlib/matplotlib/master/LICENSE/LICENSE' | 443 | 'https://raw.githubusercontent.com/matplotlib/matplotlib/master/LICENSE/LICENSE' |
| 443 | ], [ | 444 | ], [ |
| @@ -560,6 +561,11 @@ credits = [ · 116 unmodified lines | |||
| 560 | '1996-2018 The PostgreSQL Global Development Group<br>© 1994 The Regents of the University of California', | 561 | '1996-2018 The PostgreSQL Global Development Group<br>© 1994 The Regents of the University of California', |
| 561 | 'PostgreSQL', | 562 | 'PostgreSQL', |
| 562 | 'https://www.postgresql.org/about/licence/' | 563 | 'https://www.postgresql.org/about/licence/' |
| 564 | ], [ | ||
| 565 | 'Puppeteer', | ||
| 566 | '2017 Google Inc', | ||
| 567 | 'Apache', | ||
| 568 | 'https://raw.githubusercontent.com/GoogleChrome/puppeteer/master/LICENSE' | ||
| 563 | ], [ | 569 | ], [ |
| 564 | 'Pygame', | 570 | 'Pygame', |
| 565 | 'Pygame Developpers', | 571 | 'Pygame Developpers', |
| @@ -637,7 +643,7 @@ credits = [ · 71 unmodified lines | |||
| 637 | 'http://scikit-image.org/docs/dev/license.html' | 643 | 'http://scikit-image.org/docs/dev/license.html' |
| 638 | ], [ | 644 | ], [ |
| 639 | 'scikit-learn', | 645 | 'scikit-learn', |
| 640 | '2007-2017 The scikit-learn developers', | 646 | '2007-2018 The scikit-learn developers', |
| 641 | 'BSD', | 647 | 'BSD', |
| 642 | 'https://raw.githubusercontent.com/scikit-learn/scikit-learn/master/COPYING' | 648 | 'https://raw.githubusercontent.com/scikit-learn/scikit-learn/master/COPYING' |
| 643 | ], [ | 649 | ], [ |
| @@ -682,9 +688,9 @@ credits = [ · 38 unmodified lines | |||
| 682 | 'https://raw.githubusercontent.com/hashicorp/terraform-website/master/LICENSE.md' | 688 | 'https://raw.githubusercontent.com/hashicorp/terraform-website/master/LICENSE.md' |
| 683 | ], [ | 689 | ], [ |
| 684 | 'Twig', | 690 | 'Twig', |
| 685 | '2009-2017 The Twig Team', | 691 | '2009-2018 The Twig Team', |
| 686 | 'BSD', | 692 | 'BSD', |
| 687 | 'https://twig.sensiolabs.org/license' | 693 | 'https://twig.symfony.com/license' |
| 688 | ], [ | 694 | ], [ |
| 689 | 'TypeScript', | 695 | 'TypeScript', |
| 690 | 'Microsoft and other contributors', | 696 | 'Microsoft and other contributors', |
| @@ -692,7 +698,7 @@ credits = [ · 1 unmodified line | |||
| 692 | 'https://raw.githubusercontent.com/Microsoft/TypeScript-Handbook/master/LICENSE' | 698 | 'https://raw.githubusercontent.com/Microsoft/TypeScript-Handbook/master/LICENSE' |
| 693 | ], [ | 699 | ], [ |
| 694 | 'Underscore.js', | 700 | 'Underscore.js', |
| 695 | '2009-2017 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors', | 701 | '2009-2018 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors', |
| 696 | 'MIT', | 702 | 'MIT', |
| 697 | 'https://raw.githubusercontent.com/jashkenas/underscore/master/LICENSE' | 703 | 'https://raw.githubusercontent.com/jashkenas/underscore/master/LICENSE' |
| 698 | ], [ | 704 | ], [ |
| @@ -25,8 +25,8 @@ app.templates.offlinePage = (docs) -> """ · 24 unmodified lines | |||
| 25 | <h2 class="_block-heading">Questions & Answers</h2> | 25 | <h2 class="_block-heading">Questions & Answers</h2> |
| 26 | <dl> | 26 | <dl> |
| 27 | <dt>How does this work? | 27 | <dt>How does this work? |
| 28 | <dd>Each page is cached as a key-value pair in <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a> (downloaded from a single file).<br> | 28 | <dd>Each page is cached as a key-value pair in <a href="https://devdocs.io/dom/indexeddb_api">IndexedDB</a> (downloaded from a single file).<br> |
| 29 | The app also uses <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache">AppCache</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API">localStorage</a> to cache the assets and index files. | 29 | The app also uses <a href="https://devdocs.io/dom/service_worker_api/using_service_workers">Service Workers</a> and <a href="https://devdocs.io/dom/web_storage_api">localStorage</a> to cache the assets and index files. |
| 30 | <dt>Can I close the tab/browser? | 30 | <dt>Can I close the tab/browser? |
| 31 | <dd>#{canICloseTheTab()} | 31 | <dd>#{canICloseTheTab()} |
| 32 | <dt>What if I don't update a documentation? | 32 | <dt>What if I don't update a documentation? |
| @@ -41,10 +41,15 @@ app.templates.offlinePage = (docs) -> """ · 8 unmodified lines | |||
| 41 | """ | 41 | """ |
| 42 | 42 | ||
| 43 | canICloseTheTab = -> | 43 | canICloseTheTab = -> |
| 44 | if app.AppCache.isEnabled() | 44 | if app.ServiceWorker.isEnabled() |
| 45 | """ Yes! Even offline, you can open a new tab, go to <a href="//devdocs.io">devdocs.io</a>, and everything will work as if you were online (provided you installed all the documentations you want to use beforehand). """ | 45 | """ Yes! Even offline, you can open a new tab, go to <a href="//devdocs.io">devdocs.io</a>, and everything will work as if you were online (provided you installed all the documentations you want to use beforehand). """ |
| 46 | else | 46 | else |
| 47 | """ No. AppCache isn't available in your browser (or is disabled), so loading <a href="//devdocs.io">devdocs.io</a> offline won't work.<br> | 47 | reason = "aren't available in your browser (or are disabled)" |
| 48 | |||
| 49 | if app.config.env != 'production' | ||
| 50 | reason = "are disabled in your development instance of DevDocs (enable them by setting the <code>ENABLE_SERVICE_WORKER</code> environment variable to <code>true</code>)" | ||
| 51 | |||
| 52 | """ No. Service Workers #{reason}, so loading <a href="//devdocs.io">devdocs.io</a> offline won't work.<br> | ||
| 48 | The current tab will continue to function even when you go offline (provided you installed all the documentations beforehand). """ | 53 | The current tab will continue to function even when you go offline (provided you installed all the documentations beforehand). """ |
| 49 | 54 | ||
| 50 | app.templates.offlineDoc = (doc, status) -> | 55 | app.templates.offlineDoc = (doc, status) -> |
| @@ -8,13 +8,13 @@ app.templates.intro = """ · 7 unmodified lines | |||
| 8 | <p>Thanks for downloading DevDocs. Here are a few things you should know: | 8 | <p>Thanks for downloading DevDocs. Here are a few things you should know: |
| 9 | <ol class="_intro-list"> | 9 | <ol class="_intro-list"> |
| 10 | <li>Your local version of DevDocs won't self-update. Unless you're modifying the code, | 10 | <li>Your local version of DevDocs won't self-update. Unless you're modifying the code, |
| 11 | I recommend using the hosted version at <a href="https://devdocs.io">devdocs.io</a>. | 11 | we recommend using the hosted version at <a href="https://devdocs.io">devdocs.io</a>. |
| 12 | <li>Run <code>thor docs:list</code> to see all available documentations. | 12 | <li>Run <code>thor docs:list</code> to see all available documentations. |
| 13 | <li>Run <code>thor docs:download <name></code> to download documentations. | 13 | <li>Run <code>thor docs:download <name></code> to download documentations. |
| 14 | <li>Run <code>thor docs:download --installed</code> to update all downloaded documentations. | 14 | <li>Run <code>thor docs:download --installed</code> to update all downloaded documentations. |
| 15 | <li>To be notified about new versions, don't forget to <a href="https://github.com/freeCodeCamp/devdocs/subscription">watch the repository</a> on GitHub. | 15 | <li>To be notified about new versions, don't forget to <a href="https://github.com/freeCodeCamp/devdocs/subscription">watch the repository</a> on GitHub. |
| 16 | <li>The <a href="https://github.com/freeCodeCamp/devdocs/issues">issue tracker</a> is the preferred channel for bug reports and | 16 | <li>The <a href="https://github.com/freeCodeCamp/devdocs/issues">issue tracker</a> is the preferred channel for bug reports and |
| 17 | feature requests. For everything else, use the <a href="https://groups.google.com/d/forum/devdocs">mailing list</a>. | 17 | feature requests. For everything else, use <a href="https://gitter.im/FreeCodeCamp/DevDocs">Gitter</a>. |
| 18 | <li>Contributions are welcome. See the <a href="https://github.com/freeCodeCamp/devdocs/blob/master/CONTRIBUTING.md">guidelines</a>. | 18 | <li>Contributions are welcome. See the <a href="https://github.com/freeCodeCamp/devdocs/blob/master/CONTRIBUTING.md">guidelines</a>. |
| 19 | <li>DevDocs is licensed under the terms of the Mozilla Public License v2.0. For more information, | 19 | <li>DevDocs is licensed under the terms of the Mozilla Public License v2.0. For more information, |
| 20 | see the <a href="https://github.com/freeCodeCamp/devdocs/blob/master/COPYRIGHT">COPYRIGHT</a> and | 20 | see the <a href="https://github.com/freeCodeCamp/devdocs/blob/master/COPYRIGHT">COPYRIGHT</a> and |
| @@ -39,7 +39,7 @@ app.templates.intro = """ · 18 unmodified lines | |||
| 39 | <li>DevDocs works <a href="/offline">offline</a>, on mobile, and can be installed on <a href="https://chrome.google.com/webstore/detail/devdocs/mnfehgbmkapmjnhcnbodoamcioleeooe">Chrome</a>. | 39 | <li>DevDocs works <a href="/offline">offline</a>, on mobile, and can be installed on <a href="https://chrome.google.com/webstore/detail/devdocs/mnfehgbmkapmjnhcnbodoamcioleeooe">Chrome</a>. |
| 40 | <li>For the latest news, follow <a href="https://twitter.com/DevDocs">@DevDocs</a>. | 40 | <li>For the latest news, follow <a href="https://twitter.com/DevDocs">@DevDocs</a>. |
| 41 | <li>DevDocs is free and <a href="https://github.com/freeCodeCamp/devdocs">open source</a>. | 41 | <li>DevDocs is free and <a href="https://github.com/freeCodeCamp/devdocs">open source</a>. |
| 42 | <iframe class="_github-btn" src="//ghbtns.com/github-btn.html?user=freeCodeCamp&repo=devdocs&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe> | 42 | <object data="https://img.shields.io/github/stars/freeCodeCamp/devdocs.svg?style=social" type="image/svg+xml" aria-hidden="true"></object> |
| 43 | <li>And if you're new to coding, check out <a href="https://www.freecodecamp.org/">freeCodeCamp's open source curriculum</a>. | 43 | <li>And if you're new to coding, check out <a href="https://www.freecodecamp.org/">freeCodeCamp's open source curriculum</a>. |
| 44 | </ol> | 44 | </ol> |
| 45 | <p>Happy coding! | 45 | <p>Happy coding! |
| @@ -72,14 +72,3 @@ app.templates.androidWarning = """ · 26 unmodified lines | |||
| 72 | <p>To install DevDocs on your phone, visit <a href="https://devdocs.io" target="_blank" rel="noopener">devdocs.io</a> in Chrome and select "Add to home screen" in the menu. | 72 | <p>To install DevDocs on your phone, visit <a href="https://devdocs.io" target="_blank" rel="noopener">devdocs.io</a> in Chrome and select "Add to home screen" in the menu. |
| 73 | </div> | 73 | </div> |
| 74 | """ | 74 | """ |
| 75 | |||
| 76 | app.templates.httpWarning = """ | ||
| 77 | <div class="_intro"><div class="_intro-message"> | ||
| 78 | <h2 class="_intro-title">Hi there!</h2> | ||
| 79 | <p>DevDocs is migrating to HTTPS. | ||
| 80 | <p>Please update your bookmarks to point to <a href="https://devdocs.io">https://devdocs.io</a>. | ||
| 81 | <p>When using the HTTPS version, your preferences will carry over automatically, but your offline data will be reset. Simply re-download documentation in the <a href="https://devdocs.io/offline">Offline area</a>, and you'll be all set to use DevDocs securely offline. | ||
| 82 | <p>Sorry for the inconvenience. This migration is needed because browsers are removing support for certain DOM APIs that power DevDocs's offline mode over non-secure origins. | ||
| 83 | <p>Thanks for using DevDocs, and happy coding! | ||
| 84 | </div></div> | ||
| 85 | """ | ||
| @@ -19,6 +19,10 @@ app.templates.settingsPage = (settings) -> """ · 18 unmodified lines | |||
| 19 | <input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use | 19 | <input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use |
| 20 | <small>Only enable this when bandwidth isn't a concern to you.</small> | 20 | <small>Only enable this when bandwidth isn't a concern to you.</small> |
| 21 | </label> | 21 | </label> |
| 22 | <label class="_settings-label"> | ||
| 23 | <input type="checkbox" form="settings" name="analyticsConsent"#{if settings.analyticsConsent then ' checked' else ''}>Enable tracking cookies | ||
| 24 | <small>With this checked, we enable Google Analytics and Gauges to collect anonymous traffic information.</small> | ||
| 25 | </label> | ||
| 22 | </div> | 26 | </div> |
| 23 | </div> | 27 | </div> |
| 24 | 28 | ||
| @@ -1,28 +1,32 @@ | |||
| 1 | try { | 1 | try { |
| 2 | if (app.config.env == 'production') { | 2 | if (app.config.env === 'production') { |
| 3 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | 3 | if (Cookies.get('analyticsConsent') === '1') { |
| 4 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | 4 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| 5 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | 5 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| 6 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | 6 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| 7 | ga('create', 'UA-5544833-12', 'devdocs.io'); | 7 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| 8 | page.track(function() { | 8 | ga('create', 'UA-5544833-12', 'devdocs.io'); |
| 9 | ga('send', 'pageview', { | 9 | page.track(function() { |
| 10 | page: location.pathname + location.search + location.hash, | 10 | ga('send', 'pageview', { |
| 11 | dimension1: app.router.context && app.router.context.doc && app.router.context.doc.slug_without_version | 11 | page: location.pathname + location.search + location.hash, |
| 12 | dimension1: app.router.context && app.router.context.doc && app.router.context.doc.slug_without_version | ||
| 13 | }); | ||
| 12 | }); | 14 | }); |
| 13 | }); | ||
| 14 | 15 | ||
| 15 | page.track(function() { | 16 | page.track(function() { |
| 16 | if (window._gauges) | 17 | if (window._gauges) |
| 17 | _gauges.push(['track']); | 18 | _gauges.push(['track']); |
| 18 | else | 19 | else |
| 19 | (function() { | 20 | (function() { |
| 20 | var _gauges=_gauges||[];!function(){var a=document.createElement("script"); | 21 | var _gauges=_gauges||[];!function(){var a=document.createElement("script"); |
| 21 | a.type="text/javascript",a.async=!0,a.id="gauges-tracker", | 22 | a.type="text/javascript",a.async=!0,a.id="gauges-tracker", |
| 22 | a.setAttribute("data-site-id","51c15f82613f5d7819000067"), | 23 | a.setAttribute("data-site-id","51c15f82613f5d7819000067"), |
| 23 | a.src="https://secure.gaug.es/track.js";var b=document.getElementsByTagName("script")[0]; | 24 | a.src="https://secure.gaug.es/track.js";var b=document.getElementsByTagName("script")[0]; |
| 24 | b.parentNode.insertBefore(a,b)}(); | 25 | b.parentNode.insertBefore(a,b)}(); |
| 25 | })(); | 26 | })(); |
| 26 | }); | 27 | }); |
| 28 | } else { | ||
| 29 | resetAnalytics(); | ||
| 30 | } | ||
| 27 | } | 31 | } |
| 28 | } catch(e) { } | 32 | } catch(e) { } |
| @@ -123,7 +123,7 @@ class app.views.EntryPage extends app.View · 122 unmodified lines | |||
| 123 | @render @tmpl('pageLoadError') | 123 | @render @tmpl('pageLoadError') |
| 124 | @resetClass() | 124 | @resetClass() |
| 125 | @addClass @constructor.errorClass | 125 | @addClass @constructor.errorClass |
| 126 | app.appCache?.update() | 126 | app.serviceWorker?.update() |
| 127 | return | 127 | return |
| 128 | 128 | ||
| 129 | cache: -> | 129 | cache: -> |
| @@ -57,6 +57,7 @@ class app.views.OfflinePage extends app.View · 56 unmodified lines | |||
| 57 | doc[action](@onInstallSuccess.bind(@, doc), @onInstallError.bind(@, doc), @onInstallProgress.bind(@, doc)) | 57 | doc[action](@onInstallSuccess.bind(@, doc), @onInstallError.bind(@, doc), @onInstallProgress.bind(@, doc)) |
| 58 | el.parentNode.innerHTML = "#{el.textContent.replace(/e$/, '')}ing…" | 58 | el.parentNode.innerHTML = "#{el.textContent.replace(/e$/, '')}ing…" |
| 59 | else if action = el.getAttribute('data-action-all') | 59 | else if action = el.getAttribute('data-action-all') |
| 60 | return unless action isnt 'uninstall' or window.confirm('Uninstall all docs?') | ||
| 60 | app.db.migrate() | 61 | app.db.migrate() |
| 61 | $.click(el) for el in @findAll("[data-action='#{action}']") | 62 | $.click(el) for el in @findAll("[data-action='#{action}']") |
| 62 | return | 63 | return |
| @@ -19,10 +19,6 @@ class app.views.RootPage extends app.View · 18 unmodified lines | |||
| 19 | else | 19 | else |
| 20 | 'intro' | 20 | 'intro' |
| 21 | 21 | ||
| 22 | # temporary | ||
| 23 | if location.host is 'devdocs.io' and location.protocol is 'http:' | ||
| 24 | tmpl = 'httpWarning' | ||
| 25 | |||
| 26 | @append @tmpl(tmpl) | 22 | @append @tmpl(tmpl) |
| 27 | return | 23 | return |
| 28 | 24 | ||
| @@ -1,7 +1,4 @@ | |||
| 1 | class app.views.SettingsPage extends app.View | 1 | class app.views.SettingsPage extends app.View |
| 2 | LAYOUTS = ['_max-width', '_sidebar-hidden', '_native-scrollbars'] | ||
| 3 | SIDEBAR_HIDDEN_LAYOUT = '_sidebar-hidden' | ||
| 4 | |||
| 5 | @className: '_static' | 2 | @className: '_static' |
| 6 | 3 | ||
| 7 | @events: | 4 | @events: |
| @@ -18,32 +15,30 @@ class app.views.SettingsPage extends app.View · 10 unmodified lines | |||
| 18 | settings.smoothScroll = !app.settings.get('fastScroll') | 15 | settings.smoothScroll = !app.settings.get('fastScroll') |
| 19 | settings.arrowScroll = app.settings.get('arrowScroll') | 16 | settings.arrowScroll = app.settings.get('arrowScroll') |
| 20 | settings.autoInstall = app.settings.get('autoInstall') | 17 | settings.autoInstall = app.settings.get('autoInstall') |
| 21 | settings[layout] = app.settings.hasLayout(layout) for layout in LAYOUTS | 18 | settings.analyticsConsent = app.settings.get('analyticsConsent') |
| 19 | settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS | ||
| 22 | settings | 20 | settings |
| 23 | 21 | ||
| 24 | getTitle: -> | 22 | getTitle: -> |
| 25 | 'Preferences' | 23 | 'Preferences' |
| 26 | 24 | ||
| 27 | toggleDark: (enable) -> | 25 | toggleDark: (enable) -> |
| 28 | css = $('link[rel="stylesheet"][data-alt]') | ||
| 29 | alt = css.getAttribute('data-alt') | ||
| 30 | css.setAttribute('data-alt', css.getAttribute('href')) | ||
| 31 | css.setAttribute('href', alt) | ||
| 32 | app.settings.set('dark', !!enable) | 26 | app.settings.set('dark', !!enable) |
| 33 | app.appCache?.updateInBackground() | ||
| 34 | return | 27 | return |
| 35 | 28 | ||
| 36 | toggleLayout: (layout, enable) -> | 29 | toggleLayout: (layout, enable) -> |
| 37 | document.body.classList[if enable then 'add' else 'remove'](layout) unless layout is SIDEBAR_HIDDEN_LAYOUT | ||
| 38 | document.body.classList[if $.overlayScrollbarsEnabled() then 'add' else 'remove']('_overlay-scrollbars') | ||
| 39 | app.settings.setLayout(layout, enable) | 30 | app.settings.setLayout(layout, enable) |
| 40 | app.appCache?.updateInBackground() | ||
| 41 | return | 31 | return |
| 42 | 32 | ||
| 43 | toggleSmoothScroll: (enable) -> | 33 | toggleSmoothScroll: (enable) -> |
| 44 | app.settings.set('fastScroll', !enable) | 34 | app.settings.set('fastScroll', !enable) |
| 45 | return | 35 | return |
| 46 | 36 | ||
| 37 | toggleAnalyticsConsent: (enable) -> | ||
| 38 | app.settings.set('analyticsConsent', if enable then '1' else '0') | ||
| 39 | resetAnalytics() unless enable | ||
| 40 | return | ||
| 41 | |||
| 47 | toggle: (name, enable) -> | 42 | toggle: (name, enable) -> |
| 48 | app.settings.set(name, enable) | 43 | app.settings.set(name, enable) |
| 49 | return | 44 | return |
| @@ -87,6 +82,8 @@ class app.views.SettingsPage extends app.View · 37 unmodified lines | |||
| 87 | @toggleSmoothScroll input.checked | 82 | @toggleSmoothScroll input.checked |
| 88 | when 'import' | 83 | when 'import' |
| 89 | @import input.files[0], input | 84 | @import input.files[0], input |
| 85 | when 'analyticsConsent' | ||
| 86 | @toggleAnalyticsConsent input.checked | ||
| 90 | else | 87 | else |
| 91 | @toggle input.name, input.checked | 88 | @toggle input.name, input.checked |
| 92 | return | 89 | return |
| @@ -75,9 +75,11 @@ class app.views.Document extends app.View · 74 unmodified lines | |||
| 75 | return unless target.hasAttribute('data-behavior') | 75 | return unless target.hasAttribute('data-behavior') |
| 76 | $.stopEvent(event) | 76 | $.stopEvent(event) |
| 77 | switch target.getAttribute('data-behavior') | 77 | switch target.getAttribute('data-behavior') |
| 78 | when 'back' then history.back() | 78 | when 'back' then history.back() |
| 79 | when 'reload' then window.location.reload() | 79 | when 'reload' then window.location.reload() |
| 80 | when 'reboot' then window.location = '/' | 80 | when 'reboot' then app.reboot() |
| 81 | when 'hard-reload' then app.reload() | 81 | when 'hard-reload' then app.reload() |
| 82 | when 'reset' then app.reset() if confirm('Are you sure you want to reset DevDocs?') | 82 | when 'reset' then app.reset() if confirm('Are you sure you want to reset DevDocs?') |
| 83 | when 'accept-analytics' then Cookies.set('analyticsConsent', '1') && app.reboot() | ||
| 84 | when 'decline-analytics' then Cookies.set('analyticsConsent', '0') && app.reboot() | ||
| 83 | return | 85 | return |
| @@ -11,9 +11,6 @@ class app.views.Resizer extends app.View · 10 unmodified lines | |||
| 11 | init: -> | 11 | init: -> |
| 12 | @el.setAttribute('draggable', 'true') | 12 | @el.setAttribute('draggable', 'true') |
| 13 | @appendTo $('._app') | 13 | @appendTo $('._app') |
| 14 | |||
| 15 | @style = $('style[data-resizer]') | ||
| 16 | @size = @style.getAttribute('data-size') | ||
| 17 | return | 14 | return |
| 18 | 15 | ||
| 19 | MIN = 260 | 16 | MIN = 260 |
| @@ -24,15 +21,11 @@ class app.views.Resizer extends app.View · 4 unmodified lines | |||
| 24 | return unless value > 0 | 21 | return unless value > 0 |
| 25 | value = Math.min(Math.max(Math.round(value), MIN), MAX) | 22 | value = Math.min(Math.max(Math.round(value), MIN), MAX) |
| 26 | newSize = "#{value}px" | 23 | newSize = "#{value}px" |
| 27 | @style.innerHTML = @style.innerHTML.replace(new RegExp(@size, 'g'), newSize) | 24 | document.documentElement.style.setProperty('--sidebarWidth', newSize) |
| 28 | @size = newSize | 25 | app.settings.setSize(value) if save |
| 29 | if save | ||
| 30 | app.settings.setSize(value) | ||
| 31 | app.appCache?.updateInBackground() | ||
| 32 | return | 26 | return |
| 33 | 27 | ||
| 34 | onDragStart: (event) => | 28 | onDragStart: (event) => |
| 35 | @style.removeAttribute('disabled') | ||
| 36 | event.dataTransfer.effectAllowed = 'link' | 29 | event.dataTransfer.effectAllowed = 'link' |
| 37 | event.dataTransfer.setData('Text', '') | 30 | event.dataTransfer.setData('Text', '') |
| 38 | $.on(window, 'dragover', @onDrag) | 31 | $.on(window, 'dragover', @onDrag) |
| @@ -25,7 +25,6 @@ class app.views.Settings extends app.View · 24 unmodified lines | |||
| 25 | if super | 25 | if super |
| 26 | @render() | 26 | @render() |
| 27 | document.body.classList.remove(SIDEBAR_HIDDEN_LAYOUT) | 27 | document.body.classList.remove(SIDEBAR_HIDDEN_LAYOUT) |
| 28 | app.appCache?.on 'progress', @onAppCacheProgress | ||
| 29 | return | 28 | return |
| 30 | 29 | ||
| 31 | deactivate: -> | 30 | deactivate: -> |
| @@ -33,7 +32,6 @@ class app.views.Settings extends app.View · 1 unmodified line | |||
| 33 | @resetClass() | 32 | @resetClass() |
| 34 | @docPicker.detach() | 33 | @docPicker.detach() |
| 35 | document.body.classList.add(SIDEBAR_HIDDEN_LAYOUT) if app.settings.hasLayout(SIDEBAR_HIDDEN_LAYOUT) | 34 | document.body.classList.add(SIDEBAR_HIDDEN_LAYOUT) if app.settings.hasLayout(SIDEBAR_HIDDEN_LAYOUT) |
| 36 | app.appCache?.off 'progress', @onAppCacheProgress | ||
| 37 | return | 35 | return |
| 38 | 36 | ||
| 39 | render: -> | 37 | render: -> |
| @@ -52,7 +50,7 @@ class app.views.Settings extends app.View · 12 unmodified lines | |||
| 52 | docs = @docPicker.getSelectedDocs() | 50 | docs = @docPicker.getSelectedDocs() |
| 53 | app.settings.setDocs(docs) | 51 | app.settings.setDocs(docs) |
| 54 | 52 | ||
| 55 | @saveBtn.textContent = if app.appCache then 'Downloading\u2026' else 'Saving\u2026' | 53 | @saveBtn.textContent = 'Saving\u2026' |
| 56 | disabledDocs = new app.collections.Docs(doc for doc in app.docs.all() when docs.indexOf(doc.slug) is -1) | 54 | disabledDocs = new app.collections.Docs(doc for doc in app.docs.all() when docs.indexOf(doc.slug) is -1) |
| 57 | disabledDocs.uninstall -> | 55 | disabledDocs.uninstall -> |
| 58 | app.db.migrate() | 56 | app.db.migrate() |
| @@ -83,9 +81,3 @@ class app.views.Settings extends app.View · 24 unmodified lines | |||
| 83 | $.stopEvent(event) | 81 | $.stopEvent(event) |
| 84 | app.router.show '/' | 82 | app.router.show '/' |
| 85 | return | 83 | return |
| 86 | |||
| 87 | onAppCacheProgress: (event) => | ||
| 88 | if event.lengthComputable | ||
| 89 | percentage = Math.round event.loaded * 100 / event.total | ||
| 90 | @saveBtn.textContent = "Downloading\u2026 (#{percentage}%)" | ||
| 91 | return | ||
| @@ -30,6 +30,9 @@ class app.views.Search extends app.View · 29 unmodified lines | |||
| 30 | .on 'results', @onResults | 30 | .on 'results', @onResults |
| 31 | .on 'end', @onEnd | 31 | .on 'end', @onEnd |
| 32 | 32 | ||
| 33 | @scope | ||
| 34 | .on 'change', @onScopeChange | ||
| 35 | |||
| 33 | app.on 'ready', @onReady | 36 | app.on 'ready', @onReady |
| 34 | $.on window, 'hashchange', @searchUrl | 37 | $.on window, 'hashchange', @searchUrl |
| 35 | $.on window, 'focus', @onWindowFocus | 38 | $.on window, 'focus', @onWindowFocus |
| @@ -138,6 +141,11 @@ class app.views.Search extends app.View · 102 unmodified lines | |||
| 138 | $.stopEvent(event) | 141 | $.stopEvent(event) |
| 139 | return | 142 | return |
| 140 | 143 | ||
| 144 | onScopeChange: => | ||
| 145 | @value = '' | ||
| 146 | @onInput() | ||
| 147 | return | ||
| 148 | |||
| 141 | afterRoute: (name, context) => | 149 | afterRoute: (name, context) => |
| 142 | return if app.shortcuts.eventInProgress?.name is 'escape' | 150 | return if app.shortcuts.eventInProgress?.name is 'escape' |
| 143 | @reset(true) if not context.init and app.router.isIndex() | 151 | @reset(true) if not context.init and app.router.isIndex() |
| @@ -6,7 +6,9 @@ class app.views.SearchScope extends app.View · 5 unmodified lines | |||
| 6 | tag: '._search-tag' | 6 | tag: '._search-tag' |
| 7 | 7 | ||
| 8 | @events: | 8 | @events: |
| 9 | click: 'onClick' | ||
| 9 | keydown: 'onKeydown' | 10 | keydown: 'onKeydown' |
| 11 | textInput: 'onTextInput' | ||
| 10 | 12 | ||
| 11 | @routes: | 13 | @routes: |
| 12 | after: 'afterRoute' | 14 | after: 'afterRoute' |
| @@ -87,17 +89,33 @@ class app.views.SearchScope extends app.View · 74 unmodified lines | |||
| 87 | @trigger 'change', null, previousDoc | 89 | @trigger 'change', null, previousDoc |
| 88 | return | 90 | return |
| 89 | 91 | ||
| 92 | doScopeSearch: (event) => | ||
| 93 | @search @input.value[0...@input.selectionStart] | ||
| 94 | $.stopEvent(event) if @doc | ||
| 95 | return | ||
| 96 | |||
| 97 | onClick: (event) => | ||
| 98 | if event.target is @tag | ||
| 99 | @reset() | ||
| 100 | $.stopEvent(event) | ||
| 101 | return | ||
| 102 | |||
| 90 | onKeydown: (event) => | 103 | onKeydown: (event) => |
| 91 | if event.which is 8 # backspace | 104 | if event.which is 8 # backspace |
| 92 | if @doc and not @input.value | 105 | if @doc and @input.selectionEnd is 0 |
| 93 | $.stopEvent(event) | ||
| 94 | @reset() | 106 | @reset() |
| 95 | else if not @doc and @input.value | 107 | $.stopEvent(event) |
| 108 | else if not @doc and @input.value and not $.isChromeForAndroid() | ||
| 96 | return if event.ctrlKey or event.metaKey or event.altKey or event.shiftKey | 109 | return if event.ctrlKey or event.metaKey or event.altKey or event.shiftKey |
| 97 | if event.which is 9 or # tab | 110 | if event.which is 9 or # tab |
| 98 | (event.which is 32 and app.isMobile()) # space | 111 | (event.which is 32 and app.isMobile()) # space |
| 99 | @search @input.value[0...@input.selectionStart] | 112 | @doScopeSearch(event) |
| 100 | $.stopEvent(event) if @doc | 113 | return |
| 114 | |||
| 115 | onTextInput: (event) => | ||
| 116 | return unless $.isChromeForAndroid() | ||
| 117 | if not @doc and @input.value and event.data == ' ' | ||
| 118 | @doScopeSearch(event) | ||
| 101 | return | 119 | return |
| 102 | 120 | ||
| 103 | extractHashValue: -> | 121 | extractHashValue: -> |
| @@ -28,7 +28,7 @@ class app.views.Sidebar extends app.View · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | app.on 'ready', @onReady | 29 | app.on 'ready', @onReady |
| 30 | 30 | ||
| 31 | $.on document.documentElement, 'mouseleave', (event) => @display() if event.clientX < 10 | 31 | $.on document.documentElement, 'mouseleave', (event) => @display() unless event.clientX <= 0 |
| 32 | $.on document.documentElement, 'mouseenter', => @resetDisplay(forceNoHover: false) | 32 | $.on document.documentElement, 'mouseenter', => @resetDisplay(forceNoHover: false) |
| 33 | return | 33 | return |
| 34 | 34 | ||
| @@ -1,108 +0,0 @@ | |||
| 1 | //= depend_on docs-1.png | ||
| 2 | //= depend_on docs-1@2x.png | ||
| 3 | //= depend_on docs-2.png | ||
| 4 | //= depend_on docs-2@2x.png | ||
| 5 | |||
| 6 | /*! | ||
| 7 | * Copyright 2013-2018 Thibaut Courouble and other contributors | ||
| 8 | * | ||
| 9 | * This source code is licensed under the terms of the Mozilla | ||
| 10 | * Public License, v. 2.0, a copy of which may be obtained at: | ||
| 11 | * http://mozilla.org/MPL/2.0/ | ||
| 12 | */ | ||
| 13 | |||
| 14 | @import 'global/variables-dark', | ||
| 15 | 'global/mixins', | ||
| 16 | 'global/icons', | ||
| 17 | 'global/classes', | ||
| 18 | 'global/base'; | ||
| 19 | |||
| 20 | @import 'components/app', | ||
| 21 | 'components/header', | ||
| 22 | 'components/notif', | ||
| 23 | 'components/sidebar', | ||
| 24 | 'components/settings', | ||
| 25 | 'components/content', | ||
| 26 | 'components/page', | ||
| 27 | 'components/fail', | ||
| 28 | 'components/path', | ||
| 29 | 'components/notice', | ||
| 30 | 'components/prism', | ||
| 31 | 'components/mobile'; | ||
| 32 | |||
| 33 | @import 'pages/simple', | ||
| 34 | 'pages/angular', | ||
| 35 | 'pages/angularjs', | ||
| 36 | 'pages/apache', | ||
| 37 | 'pages/async', | ||
| 38 | 'pages/bash', | ||
| 39 | 'pages/bootstrap', | ||
| 40 | 'pages/c', | ||
| 41 | 'pages/cakephp', | ||
| 42 | 'pages/clojure', | ||
| 43 | 'pages/codeception', | ||
| 44 | 'pages/coffeescript', | ||
| 45 | 'pages/cordova', | ||
| 46 | 'pages/crystal', | ||
| 47 | 'pages/d', | ||
| 48 | 'pages/d3', | ||
| 49 | 'pages/dart', | ||
| 50 | 'pages/dojo', | ||
| 51 | 'pages/drupal', | ||
| 52 | 'pages/elixir', | ||
| 53 | 'pages/ember', | ||
| 54 | 'pages/erlang', | ||
| 55 | 'pages/express', | ||
| 56 | 'pages/git', | ||
| 57 | 'pages/github', | ||
| 58 | 'pages/go', | ||
| 59 | 'pages/graphite', | ||
| 60 | 'pages/haskell', | ||
| 61 | 'pages/jekyll', | ||
| 62 | 'pages/jquery', | ||
| 63 | 'pages/julia', | ||
| 64 | 'pages/knockout', | ||
| 65 | 'pages/kotlin', | ||
| 66 | 'pages/laravel', | ||
| 67 | 'pages/liquid', | ||
| 68 | 'pages/love', | ||
| 69 | 'pages/lua', | ||
| 70 | 'pages/mdn', | ||
| 71 | 'pages/meteor', | ||
| 72 | 'pages/modernizr', | ||
| 73 | 'pages/moment', | ||
| 74 | 'pages/nginx', | ||
| 75 | 'pages/node', | ||
| 76 | 'pages/npm', | ||
| 77 | 'pages/openjdk', | ||
| 78 | 'pages/perl', | ||
| 79 | 'pages/phalcon', | ||
| 80 | 'pages/phaser', | ||
| 81 | 'pages/php', | ||
| 82 | 'pages/phpunit', | ||
| 83 | 'pages/postgres', | ||
| 84 | 'pages/pug', | ||
| 85 | 'pages/python', | ||
| 86 | 'pages/qt', | ||
| 87 | 'pages/ramda', | ||
| 88 | 'pages/rdoc', | ||
| 89 | 'pages/react_native', | ||
| 90 | 'pages/redis', | ||
| 91 | 'pages/rethinkdb', | ||
| 92 | 'pages/rfc', | ||
| 93 | 'pages/rubydoc', | ||
| 94 | 'pages/rust', | ||
| 95 | 'pages/sinon', | ||
| 96 | 'pages/socketio', | ||
| 97 | 'pages/sphinx', | ||
| 98 | 'pages/sphinx_simple', | ||
| 99 | 'pages/sqlite', | ||
| 100 | 'pages/support_tables', | ||
| 101 | 'pages/tcl_tk', | ||
| 102 | 'pages/tensorflow', | ||
| 103 | 'pages/terraform', | ||
| 104 | 'pages/underscore', | ||
| 105 | 'pages/vue', | ||
| 106 | 'pages/webpack', | ||
| 107 | 'pages/yard', | ||
| 108 | 'pages/yii'; | ||
| @@ -4,14 +4,16 @@ · 3 unmodified lines | |||
| 4 | //= depend_on docs-2@2x.png | 4 | //= depend_on docs-2@2x.png |
| 5 | 5 | ||
| 6 | /*! | 6 | /*! |
| 7 | * Copyright 2013-2018 Thibaut Courouble and other contributors | 7 | * Copyright 2013-2019 Thibaut Courouble and other contributors |
| 8 | * | 8 | * |
| 9 | * This source code is licensed under the terms of the Mozilla | 9 | * This source code is licensed under the terms of the Mozilla |
| 10 | * Public License, v. 2.0, a copy of which may be obtained at: | 10 | * Public License, v. 2.0, a copy of which may be obtained at: |
| 11 | * http://mozilla.org/MPL/2.0/ | 11 | * http://mozilla.org/MPL/2.0/ |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | @import 'global/variables', | 14 | @import 'global/variables-light', |
| 15 | 'global/variables-dark', | ||
| 16 | 'global/variables', | ||
| 15 | 'global/mixins', | 17 | 'global/mixins', |
| 16 | 'global/icons', | 18 | 'global/icons', |
| 17 | 'global/classes', | 19 | 'global/classes', |
| @@ -1,6 +1,6 @@ | |||
| 1 | html._booting { background: $contentBackground; } | 1 | html._booting { background: var(--contentBackground); } |
| 2 | body._max-width { background: none; } | 2 | body._max-width { background: none; } |
| 3 | html._booting body._max-width { background: $documentBackground; } | 3 | html._booting body._max-width { background: var(--documentBackground); } |
| 4 | 4 | ||
| 5 | ._app { | 5 | ._app { |
| 6 | position: relative; | 6 | position: relative; |
| @@ -15,8 +15,8 @@ html._booting body._max-width { background: $documentBackground; } · 8 unmodified lines | |||
| 15 | 15 | ||
| 16 | ._max-width & { | 16 | ._max-width & { |
| 17 | margin: 0 auto; | 17 | margin: 0 auto; |
| 18 | max-width: $maxWidth; | 18 | max-width: var(--maxWidth); |
| 19 | background: $contentBackground; | 19 | background: var(--contentBackground); |
| 20 | box-shadow: 1px 0 $headerBorder, -1px 0 $headerBorder; | 20 | box-shadow: 1px 0 var(--headerBorder), -1px 0 var(--headerBorder); |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
| @@ -4,13 +4,13 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | ._container { | 5 | ._container { |
| 6 | position: relative; | 6 | position: relative; |
| 7 | z-index: $contentZ; | 7 | z-index: var(--contentZ); |
| 8 | height: 100%; | 8 | height: 100%; |
| 9 | margin-left: $sidebarWidth; | 9 | margin-left: var(--sidebarWidth); |
| 10 | pointer-events: none; | 10 | pointer-events: none; |
| 11 | @extend %border-box; | 11 | @extend %border-box; |
| 12 | 12 | ||
| 13 | @media #{$mediumScreen} { margin-left: $sidebarMediumWidth; } | 13 | @include mobile { margin-left: var(--sidebarMediumWidth); } |
| 14 | 14 | ||
| 15 | ._sidebar-hidden & { margin-left: 0; } | 15 | ._sidebar-hidden & { margin-left: 0; } |
| 16 | body:not(._native-scrollbars) & { -webkit-margin-end: -1px; } | 16 | body:not(._native-scrollbars) & { -webkit-margin-end: -1px; } |
| @@ -30,7 +30,7 @@ · 13 unmodified lines | |||
| 30 | ._sidebar-hidden &:before { | 30 | ._sidebar-hidden &:before { |
| 31 | content: ''; | 31 | content: ''; |
| 32 | display: block; | 32 | display: block; |
| 33 | margin-top: $headerHeight; | 33 | margin-top: var(--headerHeight); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | ._overlay-scrollbars & { padding-left: .625rem; } | 36 | ._overlay-scrollbars & { padding-left: .625rem; } |
| @@ -54,7 +54,7 @@ · 17 unmodified lines | |||
| 54 | font-size: 4rem; | 54 | font-size: 4rem; |
| 55 | font-weight: 300; | 55 | font-weight: 300; |
| 56 | letter-spacing: -.125rem; | 56 | letter-spacing: -.125rem; |
| 57 | color: $loadingText; | 57 | color: var(--loadingText); |
| 58 | text-align: center; | 58 | text-align: center; |
| 59 | cursor: default; | 59 | cursor: default; |
| 60 | } | 60 | } |
| @@ -68,7 +68,7 @@ · 7 unmodified lines | |||
| 68 | // | 68 | // |
| 69 | 69 | ||
| 70 | ._splash-title { | 70 | ._splash-title { |
| 71 | color: $splashText; | 71 | color: var(--splashText); |
| 72 | @extend %loading, %user-select-none; | 72 | @extend %loading, %user-select-none; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| @@ -88,7 +88,7 @@ · 13 unmodified lines | |||
| 88 | min-height: calc(100vh - 2.375rem); | 88 | min-height: calc(100vh - 2.375rem); |
| 89 | 89 | ||
| 90 | ._sidebar-hidden & { | 90 | ._sidebar-hidden & { |
| 91 | min-height: calc(100vh - 2.375rem - #{$headerHeight}); | 91 | min-height: calc(100vh - 2.375rem - var(--headerHeight)); |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | 94 | ||
| @@ -140,12 +140,12 @@ · 45 unmodified lines | |||
| 140 | 140 | ||
| 141 | ._error-text { | 141 | ._error-text { |
| 142 | margin: 0 0 1rem; | 142 | margin: 0 0 1rem; |
| 143 | color: $textColorLight; | 143 | color: var(--textColorLight); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | ._error-links { | 146 | ._error-links { |
| 147 | font-size: 1rem; | 147 | font-size: 1rem; |
| 148 | font-weight: $boldFontWeight; | 148 | font-weight: var(--boldFontWeight); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | ._error-link { padding: 0 .5rem; } | 151 | ._error-link { padding: 0 .5rem; } |
| @@ -167,7 +167,7 @@ · 15 unmodified lines | |||
| 167 | height: 1px; | 167 | height: 1px; |
| 168 | margin-top: .25rem; | 168 | margin-top: .25rem; |
| 169 | margin-left: 1rem; | 169 | margin-left: 1rem; |
| 170 | background: $boxBorderLight; | 170 | background: var(--boxBorderLight); |
| 171 | } | 171 | } |
| 172 | } | 172 | } |
| 173 | 173 | ||
| @@ -197,7 +197,7 @@ · 23 unmodified lines | |||
| 197 | ._toc-title { | 197 | ._toc-title { |
| 198 | margin: 0 0 .5rem; | 198 | margin: 0 0 .5rem; |
| 199 | font-size: inherit; | 199 | font-size: inherit; |
| 200 | font-weight: $boldFontWeight; | 200 | font-weight: var(--boldFontWeight); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | ._toc-list { | 203 | ._toc-list { |
| @@ -252,7 +252,7 @@ · 48 unmodified lines | |||
| 252 | ._docs-size { | 252 | ._docs-size { |
| 253 | text-align: right; | 253 | text-align: right; |
| 254 | 254 | ||
| 255 | > small { color: $textColorLight; } | 255 | > small { color: var(--textColorLight); } |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | ._docs-tools { | 258 | ._docs-tools { |
| @@ -285,7 +285,7 @@ · 26 unmodified lines | |||
| 285 | padding: 0 .75rem; | 285 | padding: 0 .75rem; |
| 286 | } | 286 | } |
| 287 | ._btn-link:not(._show) { display: none; } | 287 | ._btn-link:not(._show) { display: none; } |
| 288 | ._btn-link._show ~ ._btn-link._show { border-left: 1px solid $boxBorder; } | 288 | ._btn-link._show ~ ._btn-link._show { border-left: 1px solid var(--boxBorder); } |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | // | 291 | // |
| @@ -297,7 +297,7 @@ · 5 unmodified lines | |||
| 297 | position: relative; | 297 | position: relative; |
| 298 | padding-left: 10em; | 298 | padding-left: 10em; |
| 299 | font-size: .8125rem; | 299 | font-size: .8125rem; |
| 300 | color: $textColorLight; | 300 | color: var(--textColorLight); |
| 301 | 301 | ||
| 302 | + ._news-row { margin-top: 1em; } | 302 | + ._news-row { margin-top: 1em; } |
| 303 | } | 303 | } |
| @@ -305,7 +305,7 @@ · 1 unmodified line | |||
| 305 | ._news-title { | 305 | ._news-title { |
| 306 | display: block; | 306 | display: block; |
| 307 | font-size: .875rem; | 307 | font-size: .875rem; |
| 308 | color: $textColor; | 308 | color: var(--textColor); |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | ._news-date { | 311 | ._news-date { |
| @@ -372,12 +372,12 @@ · 60 unmodified lines | |||
| 372 | // Utilities | 372 | // Utilities |
| 373 | // | 373 | // |
| 374 | 374 | ||
| 375 | ._bold { font-weight: $boldFontWeight; } | 375 | ._bold { font-weight: var(--boldFontWeight); } |
| 376 | ._note { @extend %note; } | 376 | ._note { @extend %note; } |
| 377 | ._note-green { @extend %note-green; } | 377 | ._note-green { @extend %note-green; } |
| 378 | ._label { @extend %label; } | 378 | ._label { @extend %label; } |
| 379 | ._code { @extend %code; } | 379 | ._code { @extend %code; } |
| 380 | ._highlight { background: $highlightBackground !important; } | 380 | ._highlight { background: var(--highlightBackground) !important; } |
| 381 | 381 | ||
| 382 | ._table { width: 100%; } | 382 | ._table { width: 100%; } |
| 383 | ._mobile ._table { overflow-x: auto; } | 383 | ._mobile ._table { overflow-x: auto; } |
| @@ -396,12 +396,9 @@ · 12 unmodified lines | |||
| 396 | pre:hover > & { display: block; } | 396 | pre:hover > & { display: block; } |
| 397 | &:hover { opacity: 1; } | 397 | &:hover { opacity: 1; } |
| 398 | 398 | ||
| 399 | > svg { @extend %svg-icon; } | 399 | > svg { |
| 400 | 400 | @extend %svg-icon; | |
| 401 | @if $style == 'dark' { | 401 | fill: var(--absolute); |
| 402 | > svg { fill: white; } | ||
| 403 | } @else { | ||
| 404 | > svg { fill: black; } | ||
| 405 | } | 402 | } |
| 406 | 403 | ||
| 407 | &._pre-clip-success > svg, | 404 | &._pre-clip-success > svg, |
| @@ -419,15 +416,13 @@ · 11 unmodified lines | |||
| 419 | line-height: normal; | 416 | line-height: normal; |
| 420 | white-space: nowrap; | 417 | white-space: nowrap; |
| 421 | padding: .375rem .675rem; | 418 | padding: .375rem .675rem; |
| 422 | background-image: linear-gradient(lighten($boxBackground, 4%), darken($boxBackground, 2%)); | 419 | background-color: var(--boxBackground); |
| 423 | border: 1px solid $boxBorder; | 420 | border: 1px solid var(--boxBorder); |
| 424 | border-radius: 3px; | 421 | border-radius: 3px; |
| 425 | box-shadow: 0 1px rgba($boxBorder, .08); | ||
| 426 | cursor: pointer; | 422 | cursor: pointer; |
| 427 | 423 | ||
| 428 | &:active { | 424 | &:active { |
| 429 | background-color: $boxBackground; | 425 | box-shadow: inset 0 1px 1px rgba(black, .05), inset 0 1px 4px var(--boxBorder); |
| 430 | box-shadow: inset 0 1px 1px rgba(black, .05), inset 0 1px 4px $boxBorder; | ||
| 431 | } | 426 | } |
| 432 | } | 427 | } |
| 433 | 428 | ||
| @@ -447,22 +442,23 @@ · 13 unmodified lines | |||
| 447 | 442 | ||
| 448 | ._btn-link { | 443 | ._btn-link { |
| 449 | line-height: inherit; | 444 | line-height: inherit; |
| 450 | color: $linkColor; | 445 | color: var(--linkColor); |
| 451 | text-decoration: $linkTextDecoration; | 446 | text-decoration: var(--linkTextDecoration); |
| 452 | 447 | ||
| 453 | &:hover { | 448 | &:hover { |
| 454 | color: $linkColorHover; | 449 | color: var(--linkColorHover); |
| 455 | text-decoration: underline; | 450 | text-decoration: underline; |
| 456 | } | 451 | } |
| 457 | } | 452 | } |
| 458 | 453 | ||
| 459 | ._reset-btn, | 454 | ._reset-btn, |
| 460 | ._reset-btn:hover { | 455 | ._reset-btn:hover { |
| 461 | color: $textColorRed; | 456 | color: var(--textColorRed); |
| 462 | } | 457 | } |
| 463 | 458 | ||
| 464 | ._github-btn { | 459 | ._github-btn { |
| 465 | display: inline-block; | 460 | display: inline-block; |
| 466 | vertical-align: text-top; | 461 | vertical-align: text-top; |
| 467 | margin-left: .25rem; | 462 | margin-left: .25rem; |
| 463 | background: inherit; | ||
| 468 | } | 464 | } |
| @@ -1,4 +1,4 @@ | |||
| 1 | ._fail { | 1 | ._fail { // Don't use CSS variables, in case the browser doesn't support them. |
| 2 | display: block; | 2 | display: block; |
| 3 | position: relative; | 3 | position: relative; |
| 4 | top: 1.5rem; | 4 | top: 1.5rem; |
| @@ -23,7 +23,7 @@ · 18 unmodified lines | |||
| 23 | ._fail-title { | 23 | ._fail-title { |
| 24 | margin: 0 0 1rem; | 24 | margin: 0 0 1rem; |
| 25 | font-size: 1rem; | 25 | font-size: 1rem; |
| 26 | font-weight: $boldFontWeight; | 26 | font-weight: bold; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | ._fail-text, ._fail-list { | 29 | ._fail-text, ._fail-list { |
| @@ -32,5 +32,3 @@ · 2 unmodified lines | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | ._fail-text:last-child { margin: 0; } | 34 | ._fail-text:last-child { margin: 0; } |
| 35 | |||
| 36 | ._fail-link { float: right; } | ||
| @@ -4,20 +4,20 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | ._header { | 5 | ._header { |
| 6 | position: absolute; | 6 | position: absolute; |
| 7 | z-index: $headerZ; | 7 | z-index: var(--headerZ); |
| 8 | top: 0; | 8 | top: 0; |
| 9 | left: 0; | 9 | left: 0; |
| 10 | display: -ms-flexbox; | 10 | display: -ms-flexbox; |
| 11 | display: flex; | 11 | display: flex; |
| 12 | width: $sidebarWidth; | 12 | width: var(--sidebarWidth); |
| 13 | height: $headerHeight; | 13 | height: var(--headerHeight); |
| 14 | background: $headerBackground; | 14 | background: var(--headerBackground); |
| 15 | border-bottom: 1px solid $headerBorder; | 15 | border-bottom: 1px solid var(--headerBorder); |
| 16 | border-right: 1px solid $headerBorder; | 16 | border-right: 1px solid var(--headerBorder); |
| 17 | @extend %border-box; | 17 | @extend %border-box; |
| 18 | @extend %user-select-none; | 18 | @extend %user-select-none; |
| 19 | 19 | ||
| 20 | @media #{$mediumScreen} { width: $sidebarMediumWidth; } | 20 | @include mobile { width: var(--sidebarMediumWidth); } |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | ._header-left { | 23 | ._header-left { |
| @@ -35,7 +35,7 @@ · 11 unmodified lines | |||
| 35 | flex: 0 0 auto; | 35 | flex: 0 0 auto; |
| 36 | width: 2.25rem; | 36 | width: 2.25rem; |
| 37 | height: 100%; | 37 | height: 100%; |
| 38 | color: $textColorLight; | 38 | color: var(--textColorLight); |
| 39 | text-align: center; | 39 | text-align: center; |
| 40 | 40 | ||
| 41 | &[hidden] { display: none; } | 41 | &[hidden] { display: none; } |
| @@ -67,8 +67,8 @@ · 25 unmodified lines | |||
| 67 | word-wrap: normal; | 67 | word-wrap: normal; |
| 68 | overflow-wrap: normal; | 68 | overflow-wrap: normal; |
| 69 | font-size: .875rem; | 69 | font-size: .875rem; |
| 70 | background: $contentBackground; | 70 | background: var(--contentBackground); |
| 71 | border: 1px solid $headerBorder; | 71 | border: 1px solid var(--headerBorder); |
| 72 | border-radius: 3px; | 72 | border-radius: 3px; |
| 73 | box-shadow: -1px 1px 1px rgba(black, .05); | 73 | box-shadow: -1px 1px 1px rgba(black, .05); |
| 74 | transition: all 0ms cubic-bezier(0.23, 1, 0.32, 1) 1ms; | 74 | transition: all 0ms cubic-bezier(0.23, 1, 0.32, 1) 1ms; |
| @@ -98,10 +98,10 @@ · 23 unmodified lines | |||
| 98 | margin: 0; | 98 | margin: 0; |
| 99 | line-height: 1.5rem; | 99 | line-height: 1.5rem; |
| 100 | font-size: 1rem; | 100 | font-size: 1rem; |
| 101 | font-weight: $boldFontWeight; | 101 | font-weight: var(--boldFontWeight); |
| 102 | letter-spacing: -.5px; | 102 | letter-spacing: -.5px; |
| 103 | background: $sidebarBackground; | 103 | background: var(--sidebarBackground); |
| 104 | border-bottom: 1px solid $sidebarBorder; | 104 | border-bottom: 1px solid var(--sidebarBorder); |
| 105 | border-radius: 2px 2px 0 0; | 105 | border-radius: 2px 2px 0 0; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| @@ -109,7 +109,7 @@ · 1 unmodified line | |||
| 109 | ._menu-title-link:hover { | 109 | ._menu-title-link:hover { |
| 110 | display: block; | 110 | display: block; |
| 111 | padding: .5rem 1rem; | 111 | padding: .5rem 1rem; |
| 112 | color: $focusText; | 112 | color: var(--focusText); |
| 113 | text-decoration: none; | 113 | text-decoration: none; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| @@ -121,9 +121,9 @@ · 5 unmodified lines | |||
| 121 | text-decoration: none; | 121 | text-decoration: none; |
| 122 | 122 | ||
| 123 | &:hover { | 123 | &:hover { |
| 124 | color: $focusText; | 124 | color: var(--focusText); |
| 125 | text-decoration: none; | 125 | text-decoration: none; |
| 126 | background: $sidebarBackground; | 126 | background: var(--sidebarBackground); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | &:last-child { border-radius: 0 0 2px 2px; } | 129 | &:last-child { border-radius: 0 0 2px 2px; } |
| @@ -151,11 +151,7 @@ · 21 unmodified lines | |||
| 151 | opacity: .42; | 151 | opacity: .42; |
| 152 | @extend %svg-icon; | 152 | @extend %svg-icon; |
| 153 | 153 | ||
| 154 | @if $style == 'dark' { | 154 | fill: var(--absolute); |
| 155 | fill: white; | ||
| 156 | } @else { | ||
| 157 | fill: black; | ||
| 158 | } | ||
| 159 | } | 155 | } |
| 160 | } | 156 | } |
| 161 | 157 | ||
| @@ -166,21 +162,19 @@ · 4 unmodified lines | |||
| 166 | height: 100%; | 162 | height: 100%; |
| 167 | padding: 0 .75rem 1px 1.75rem; | 163 | padding: 0 .75rem 1px 1.75rem; |
| 168 | font-size: .875rem; | 164 | font-size: .875rem; |
| 169 | background: $contentBackground; | 165 | background: var(--contentBackground); |
| 170 | border: 1px solid; | 166 | border: 1px solid; |
| 171 | border-color: darken($headerBorder, 2%); | 167 | border-color: var(--searchBorder); |
| 172 | border-radius: 3px; | 168 | border-radius: 3px; |
| 173 | 169 | ||
| 174 | &:focus { | 170 | &:focus { |
| 175 | outline: 0; | 171 | outline: 0; |
| 176 | @if $inputFocusBorder { | 172 | border-color: var(--inputFocusBorder); |
| 177 | border-color: $inputFocusBorder; | 173 | box-shadow: 0 0 1px var(--inputFocusBorder); |
| 178 | box-shadow: 0 0 1px $inputFocusBorder; | ||
| 179 | } | ||
| 180 | } | 174 | } |
| 181 | 175 | ||
| 182 | &[disabled] { | 176 | &[disabled] { |
| 183 | background: $sidebarBackground; | 177 | background: var(--sidebarBackground); |
| 184 | cursor: not-allowed; | 178 | cursor: not-allowed; |
| 185 | } | 179 | } |
| 186 | } | 180 | } |
| @@ -202,13 +196,9 @@ · 15 unmodified lines | |||
| 202 | top: .5rem; | 196 | top: .5rem; |
| 203 | left: .375rem; | 197 | left: .375rem; |
| 204 | @extend %svg-icon; | 198 | @extend %svg-icon; |
| 199 | fill: var(--absolute); | ||
| 205 | } | 200 | } |
| 206 | 201 | ||
| 207 | @if $style == 'dark' { | ||
| 208 | > svg { fill: white; } | ||
| 209 | } @else { | ||
| 210 | > svg { fill: black; } | ||
| 211 | } | ||
| 212 | ._search-active > & { display: block; } | 202 | ._search-active > & { display: block; } |
| 213 | } | 203 | } |
| 214 | 204 | ||
| @@ -222,8 +212,9 @@ · 7 unmodified lines | |||
| 222 | line-height: 1.25rem; | 212 | line-height: 1.25rem; |
| 223 | max-width: 50%; | 213 | max-width: 50%; |
| 224 | font-size: .8125rem; | 214 | font-size: .8125rem; |
| 225 | color: $textColorLight; | 215 | color: var(--textColorLight); |
| 226 | background: darken($headerBackground, 5%); | 216 | background: var(--searchTagBackground); |
| 227 | border-radius: 2px; | 217 | border-radius: 2px; |
| 218 | cursor: pointer; | ||
| 228 | @extend %truncate-text; | 219 | @extend %truncate-text; |
| 229 | } | 220 | } |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | ._mobile { | 5 | ._mobile { |
| 6 | font-size: 100%; | 6 | font-size: 100%; |
| 7 | background: $contentBackground; | 7 | background: var(--contentBackground); |
| 8 | 8 | ||
| 9 | ._hide-on-mobile { display: none; } | 9 | ._hide-on-mobile { display: none; } |
| 10 | 10 | ||
| @@ -18,7 +18,7 @@ · 7 unmodified lines | |||
| 18 | 18 | ||
| 19 | ._container { | 19 | ._container { |
| 20 | margin: 0; | 20 | margin: 0; |
| 21 | padding-top: $headerHeight; | 21 | padding-top: var(--headerHeight); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | ._content { | 24 | ._content { |
| @@ -1,15 +1,15 @@ | |||
| 1 | ._notice { | 1 | ._notice { |
| 2 | position: absolute; | 2 | position: absolute; |
| 3 | z-index: $noticeZ; | 3 | z-index: var(--noticeZ); |
| 4 | bottom: 0; | 4 | bottom: 0; |
| 5 | left: $sidebarWidth; | 5 | left: var(--sidebarWidth); |
| 6 | right: 0; | 6 | right: 0; |
| 7 | height: 2.5rem; | 7 | height: 2.5rem; |
| 8 | padding: 0 1.25rem; | 8 | padding: 0 1.25rem; |
| 9 | background: $noticeBackground; | 9 | background: var(--noticeBackground); |
| 10 | box-shadow: inset 0 1px $noticeBorder; | 10 | box-shadow: inset 0 1px var(--noticeBorder); |
| 11 | 11 | ||
| 12 | @media #{$mediumScreen} { left: $sidebarMediumWidth; } | 12 | @include mobile { left: var(--sidebarMediumWidth); } |
| 13 | 13 | ||
| 14 | ._sidebar-hidden & { left: 0; } | 14 | ._sidebar-hidden & { left: 0; } |
| 15 | 15 | ||
| @@ -7,9 +7,9 @@ · 6 unmodified lines | |||
| 7 | max-width: 90%; | 7 | max-width: 90%; |
| 8 | padding: .625rem 1rem; | 8 | padding: .625rem 1rem; |
| 9 | font-size: .75rem; | 9 | font-size: .75rem; |
| 10 | color: $notifColor; | 10 | color: var(--notifColor); |
| 11 | background: $notifBackground; | 11 | background: var(--notifBackground); |
| 12 | border: $notifBorder; | 12 | border: var(--notifBorder); |
| 13 | border-radius: .25rem; | 13 | border-radius: .25rem; |
| 14 | transition: opacity .2s; | 14 | transition: opacity .2s; |
| 15 | opacity: 0; | 15 | opacity: 0; |
| @@ -30,7 +30,7 @@ · 14 unmodified lines | |||
| 30 | 30 | ||
| 31 | ._notif-info { | 31 | ._notif-info { |
| 32 | float: right; | 32 | float: right; |
| 33 | color: $notifColorLight; | 33 | color: var(--notifColorLight); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | ._notif-link, | 36 | ._notif-link, |
| @@ -69,13 +69,13 @@ · 32 unmodified lines | |||
| 69 | &::-webkit-scrollbar { width: 10px !important; } | 69 | &::-webkit-scrollbar { width: 10px !important; } |
| 70 | 70 | ||
| 71 | &::-webkit-scrollbar-track { | 71 | &::-webkit-scrollbar-track { |
| 72 | background: $notifBackground !important; | 72 | background: var(--notifBackground) !important; |
| 73 | border: 0 !important; | 73 | border: 0 !important; |
| 74 | border-radius: 5px !important; | 74 | border-radius: 5px !important; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | &::-webkit-scrollbar-thumb { | 77 | &::-webkit-scrollbar-thumb { |
| 78 | border: 3px solid $notifBackground !important; | 78 | border: 3px solid var(--notifBackground) !important; |
| 79 | 79 | ||
| 80 | &:hover, &:active { border-width: 2px !important; } | 80 | &:hover, &:active { border-width: 2px !important; } |
| 81 | } | 81 | } |
| @@ -90,7 +90,7 @@ · 8 unmodified lines | |||
| 90 | > ._news-row { | 90 | > ._news-row { |
| 91 | line-height: 1.125rem; | 91 | line-height: 1.125rem; |
| 92 | font-size: .6875rem; | 92 | font-size: .6875rem; |
| 93 | color: $notifColorLight; | 93 | color: var(--notifColorLight); |
| 94 | margin-bottom: .25rem; | 94 | margin-bottom: .25rem; |
| 95 | 95 | ||
| 96 | + ._news-row { margin-top: .625rem; } | 96 | + ._news-row { margin-top: .625rem; } |
| @@ -107,7 +107,7 @@ · 10 unmodified lines | |||
| 107 | ._news-date { | 107 | ._news-date { |
| 108 | float: right; | 108 | float: right; |
| 109 | margin-left: 1rem; | 109 | margin-left: 1rem; |
| 110 | font-weight: $boldFontWeight; | 110 | font-weight: var(--boldFontWeight); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | code { | 113 | code { |
| @@ -128,9 +128,13 @@ · 14 unmodified lines | |||
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | ._notif-tip { | 130 | ._notif-tip { |
| 131 | color: $textColor; | 131 | color: var(--textColor); |
| 132 | background: $tipBackground; | 132 | background: var(--tipBackground); |
| 133 | border: $tipBorder; | 133 | border: var(--tipBorder); |
| 134 | 134 | ||
| 135 | ._notif-info { color: $textColorLight; } | 135 | ._notif-info { color: var(--textColorLight); } |
| 136 | } | ||
| 137 | |||
| 138 | ._notif-right { | ||
| 139 | float: right; | ||
| 136 | } | 140 | } |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | max-width: 100%; | 23 | max-width: 100%; |
| 24 | margin-bottom: 1em; | 24 | margin-bottom: 1em; |
| 25 | padding: 1px; | 25 | padding: 1px; |
| 26 | border: 1px dotted $boxBorder; | 26 | border: 1px dotted var(--boxBorder); |
| 27 | border-radius: 3px; | 27 | border-radius: 3px; |
| 28 | @extend %border-box; | 28 | @extend %border-box; |
| 29 | } | 29 | } |
| @@ -50,7 +50,7 @@ · 20 unmodified lines | |||
| 50 | display: inline-block; | 50 | display: inline-block; |
| 51 | vertical-align: top; | 51 | vertical-align: top; |
| 52 | padding: 0 .5rem; | 52 | padding: 0 .5rem; |
| 53 | background: $contentBackground; | 53 | background: var(--contentBackground); |
| 54 | @extend %internal-link; | 54 | @extend %internal-link; |
| 55 | 55 | ||
| 56 | & + & { margin-left: .75rem; } | 56 | & + & { margin-left: .75rem; } |
| @@ -66,7 +66,7 @@ · 9 unmodified lines | |||
| 66 | clear: both; | 66 | clear: both; |
| 67 | margin: 2rem 0 1.5rem; | 67 | margin: 2rem 0 1.5rem; |
| 68 | font-size: .75rem; | 68 | font-size: .75rem; |
| 69 | color: $textColorLight; | 69 | color: var(--textColorLight); |
| 70 | text-align: center; | 70 | text-align: center; |
| 71 | -webkit-font-smoothing: subpixel-antialiased; | 71 | -webkit-font-smoothing: subpixel-antialiased; |
| 72 | 72 | ||
| @@ -78,7 +78,7 @@ · 5 unmodified lines | |||
| 78 | display: inline-block; | 78 | display: inline-block; |
| 79 | margin: 0; | 79 | margin: 0; |
| 80 | padding: .25rem .75rem; | 80 | padding: .25rem .75rem; |
| 81 | background: $labelBackground; | 81 | background: var(--labelBackground); |
| 82 | border-radius: 3px; | 82 | border-radius: 3px; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| @@ -1,17 +1,17 @@ | |||
| 1 | ._path { | 1 | ._path { |
| 2 | position: absolute; | 2 | position: absolute; |
| 3 | z-index: $noticeZ - 1; | 3 | z-index: var(--headerZ); |
| 4 | bottom: 0; | 4 | bottom: 0; |
| 5 | left: $sidebarWidth; | 5 | left: var(--sidebarWidth); |
| 6 | right: 0; | 6 | right: 0; |
| 7 | height: 2rem; | 7 | height: 2rem; |
| 8 | line-height: 2rem; | 8 | line-height: 2rem; |
| 9 | padding: 0 .375rem; | 9 | padding: 0 .375rem; |
| 10 | font-size: .875rem; | 10 | font-size: .875rem; |
| 11 | background: $pathBackground; | 11 | background: var(--pathBackground); |
| 12 | box-shadow: inset 0 1px $pathBorder; | 12 | box-shadow: inset 0 1px var(--pathBorder); |
| 13 | 13 | ||
| 14 | @media #{$mediumScreen} { left: $sidebarMediumWidth; } | 14 | @include mobile { left: var(--sidebarMediumWidth); } |
| 15 | 15 | ||
| 16 | ._sidebar-hidden & { left: 0; } | 16 | ._sidebar-hidden & { left: 0; } |
| 17 | 17 | ||
| @@ -24,7 +24,7 @@ · 6 unmodified lines | |||
| 24 | display: inline-block; | 24 | display: inline-block; |
| 25 | vertical-align: top; | 25 | vertical-align: top; |
| 26 | padding: 0 .375rem; | 26 | padding: 0 .375rem; |
| 27 | color: $textColor; | 27 | color: var(--textColor); |
| 28 | text-decoration: none; | 28 | text-decoration: none; |
| 29 | 29 | ||
| 30 | &:first-child:before { | 30 | &:first-child:before { |
| @@ -1,9 +1,26 @@ | |||
| 1 | html { | ||
| 2 | --prismValue: #905; | ||
| 3 | --prismText: #5e8e01; | ||
| 4 | --prismOperator: #a67f59; | ||
| 5 | --prismKeyword: #0070a3; | ||
| 6 | --prismFunction: #dd4a68; | ||
| 7 | --prismVariable: #e90; | ||
| 8 | } | ||
| 9 | html._theme-dark { | ||
| 10 | --prismValue: #eb8160; | ||
| 11 | --prismText: #ddcf88; | ||
| 12 | --prismOperator: #b1c676; | ||
| 13 | --prismKeyword: #91b3ed; | ||
| 14 | --prismFunction: #c79e6b; | ||
| 15 | --prismVariable: #e9c062; | ||
| 16 | } | ||
| 17 | |||
| 1 | .token.comment, | 18 | .token.comment, |
| 2 | .token.prolog, | 19 | .token.prolog, |
| 3 | .token.doctype, | 20 | .token.doctype, |
| 4 | .token.cdata, | 21 | .token.cdata, |
| 5 | .token.punctuation { | 22 | .token.punctuation { |
| 6 | color: $textColorLight; | 23 | color: var(--textColorLight); |
| 7 | } | 24 | } |
| 8 | 25 | ||
| 9 | .namespace { | 26 | .namespace { |
| @@ -17,11 +34,7 @@ · 7 unmodified lines | |||
| 17 | .token.constant, | 34 | .token.constant, |
| 18 | .token.symbol, | 35 | .token.symbol, |
| 19 | .token.deleted { | 36 | .token.deleted { |
| 20 | @if $style == 'dark' { | 37 | color: var(--prismValue); |
| 21 | color: #eb8160; | ||
| 22 | } @else { | ||
| 23 | color: #905; | ||
| 24 | } | ||
| 25 | } | 38 | } |
| 26 | 39 | ||
| 27 | .token.selector, | 40 | .token.selector, |
| @@ -30,11 +43,7 @@ · 2 unmodified lines | |||
| 30 | .token.char, | 43 | .token.char, |
| 31 | .token.builtin, | 44 | .token.builtin, |
| 32 | .token.inserted { | 45 | .token.inserted { |
| 33 | @if $style == 'dark' { | 46 | color: var(--prismText); |
| 34 | color: #ddcf88; | ||
| 35 | } @else { | ||
| 36 | color: #5e8e01; | ||
| 37 | } | ||
| 38 | } | 47 | } |
| 39 | 48 | ||
| 40 | .token.operator, | 49 | .token.operator, |
| @@ -42,44 +51,28 @@ · 1 unmodified line | |||
| 42 | .token.url, | 51 | .token.url, |
| 43 | .language-css .token.string, | 52 | .language-css .token.string, |
| 44 | .style .token.string { | 53 | .style .token.string { |
| 45 | @if $style == 'dark' { | 54 | color: var(--prismOperator); |
| 46 | color: #b1c676; | ||
| 47 | } @else { | ||
| 48 | color: #a67f59; | ||
| 49 | } | ||
| 50 | } | 55 | } |
| 51 | 56 | ||
| 52 | .token.atrule, | 57 | .token.atrule, |
| 53 | .token.attr-value, | 58 | .token.attr-value, |
| 54 | .token.keyword { | 59 | .token.keyword { |
| 55 | @if $style == 'dark' { | 60 | color: var(--prismKeyword); |
| 56 | color: #91b3ed; | ||
| 57 | } @else { | ||
| 58 | color: #0070a3; | ||
| 59 | } | ||
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | .token.function { | 63 | .token.function { |
| 63 | @if $style == 'dark' { | 64 | color: var(--prismFunction); |
| 64 | color: #c79e6b; | ||
| 65 | } @else { | ||
| 66 | color: #dd4a68; | ||
| 67 | } | ||
| 68 | } | 65 | } |
| 69 | 66 | ||
| 70 | .token.regex, | 67 | .token.regex, |
| 71 | .token.important, | 68 | .token.important, |
| 72 | .token.variable { | 69 | .token.variable { |
| 73 | @if $style == 'dark' { | 70 | color: var(--prismVariable); |
| 74 | color: #e9c062; | ||
| 75 | } @else { | ||
| 76 | color: #e90; | ||
| 77 | } | ||
| 78 | } | 71 | } |
| 79 | 72 | ||
| 80 | .token.important, | 73 | .token.important, |
| 81 | .token.bold { | 74 | .token.bold { |
| 82 | font-weight: $boldFontWeight; | 75 | font-weight: var(--boldFontWeight); |
| 83 | } | 76 | } |
| 84 | 77 | ||
| 85 | .token.italic { | 78 | .token.italic { |
| @@ -7,15 +7,15 @@ · 6 unmodified lines | |||
| 7 | position: absolute; | 7 | position: absolute; |
| 8 | top: 0; | 8 | top: 0; |
| 9 | bottom: 0; | 9 | bottom: 0; |
| 10 | z-index: $headerZ; | 10 | z-index: var(--headerZ); |
| 11 | 11 | ||
| 12 | &._in { display: block; } | 12 | &._in { display: block; } |
| 13 | 13 | ||
| 14 | > ._header { justify-content: space-between; } | 14 | > ._header { justify-content: space-between; } |
| 15 | 15 | ||
| 16 | &._dirty > ._header { | 16 | &._dirty > ._header { |
| 17 | background: $noteGreenBackground; | 17 | background: var(--noteGreenBackground); |
| 18 | border-color: $noteGreenBorder; | 18 | border-color: var(--noteGreenBorder); |
| 19 | } | 19 | } |
| 20 | } | 20 | } |
| 21 | 21 | ||
| @@ -37,7 +37,7 @@ · 15 unmodified lines | |||
| 37 | padding-right: .5rem; | 37 | padding-right: .5rem; |
| 38 | line-height: inherit; | 38 | line-height: inherit; |
| 39 | font-size: inherit; | 39 | font-size: inherit; |
| 40 | font-weight: $boldFontWeight; | 40 | font-weight: var(--boldFontWeight); |
| 41 | text-align: right; | 41 | text-align: right; |
| 42 | @extend %border-box; | 42 | @extend %border-box; |
| 43 | } | 43 | } |
| @@ -52,7 +52,7 @@ · 8 unmodified lines | |||
| 52 | 52 | ||
| 53 | > small { | 53 | > small { |
| 54 | display: block; | 54 | display: block; |
| 55 | color: $textColorLight; | 55 | color: var(--textColorLight); |
| 56 | margin-left: 1.75rem; | 56 | margin-left: 1.75rem; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| @@ -62,7 +62,7 @@ · 3 unmodified lines | |||
| 62 | } | 62 | } |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | @media (max-width: $maxWidth) { | 65 | @media (max-width: 80rem) { |
| 66 | ._setting-max-width { display: none; } | 66 | ._setting-max-width { display: none; } |
| 67 | } | 67 | } |
| 68 | 68 | ||
| @@ -80,7 +80,7 @@ · 11 unmodified lines | |||
| 80 | line-height: 1.5rem; | 80 | line-height: 1.5rem; |
| 81 | padding: 0 .75rem; | 81 | padding: 0 .75rem; |
| 82 | font-size: .875rem; | 82 | font-size: .875rem; |
| 83 | font-weight: $boldFontWeight; | 83 | font-weight: var(--boldFontWeight); |
| 84 | color: inherit; | 84 | color: inherit; |
| 85 | text-align: left; | 85 | text-align: left; |
| 86 | cursor: pointer; | 86 | cursor: pointer; |
| @@ -119,12 +119,12 @@ · 32 unmodified lines | |||
| 119 | position: relative; | 119 | position: relative; |
| 120 | vertical-align: top; | 120 | vertical-align: top; |
| 121 | padding: 0 .75rem; | 121 | padding: 0 .75rem; |
| 122 | line-height: $headerHeight; | 122 | line-height: var(--headerHeight); |
| 123 | color: $textColorLight; | 123 | color: var(--textColorLight); |
| 124 | 124 | ||
| 125 | &.active { | 125 | &.active { |
| 126 | color: $textColor; | 126 | color: var(--textColor); |
| 127 | font-weight: $boldFontWeight; | 127 | font-weight: var(--boldFontWeight); |
| 128 | box-shadow: inset 0 -2px $linkColor; | 128 | box-shadow: inset 0 -2px var(--linkColor); |
| 129 | } | 129 | } |
| 130 | } | 130 | } |
| @@ -4,14 +4,14 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | ._sidebar { | 5 | ._sidebar { |
| 6 | position: absolute; | 6 | position: absolute; |
| 7 | z-index: $sidebarZ; | 7 | z-index: var(--sidebarZ); |
| 8 | top: 0; | 8 | top: 0; |
| 9 | bottom: 0; | 9 | bottom: 0; |
| 10 | left: 0; | 10 | left: 0; |
| 11 | overflow-x: hidden; | 11 | overflow-x: hidden; |
| 12 | overflow-y: scroll; | 12 | overflow-y: scroll; |
| 13 | padding-top: $headerHeight; | 13 | padding-top: var(--headerHeight); |
| 14 | background: $sidebarBackground; | 14 | background: var(--sidebarBackground); |
| 15 | background-clip: content-box; | 15 | background-clip: content-box; |
| 16 | -webkit-overflow-scrolling: touch; | 16 | -webkit-overflow-scrolling: touch; |
| 17 | -ms-overflow-style: none; // IE 10 doesn't support pointer-events | 17 | -ms-overflow-style: none; // IE 10 doesn't support pointer-events |
| @@ -22,13 +22,13 @@ · 4 unmodified lines | |||
| 22 | 22 | ||
| 23 | ._overlay-scrollbars & { | 23 | ._overlay-scrollbars & { |
| 24 | padding-top: 0; | 24 | padding-top: 0; |
| 25 | top: $headerHeight; | 25 | top: var(--headerHeight); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | body:not(._native-scrollbars) & { | 28 | body:not(._native-scrollbars) & { |
| 29 | &::-webkit-scrollbar { width: 10px; } | 29 | &::-webkit-scrollbar { width: 10px; } |
| 30 | &::-webkit-scrollbar-track { | 30 | &::-webkit-scrollbar-track { |
| 31 | background: $contentBackground; | 31 | background: var(--contentBackground); |
| 32 | border: 0; | 32 | border: 0; |
| 33 | } | 33 | } |
| 34 | &::-webkit-scrollbar-thumb { | 34 | &::-webkit-scrollbar-thumb { |
| @@ -52,10 +52,10 @@ · 17 unmodified lines | |||
| 52 | 52 | ||
| 53 | ._resizer { | 53 | ._resizer { |
| 54 | position: absolute; | 54 | position: absolute; |
| 55 | z-index: $sidebarZ + 1; | 55 | z-index: var(--headerZ); |
| 56 | top: $headerHeight; | 56 | top: var(--headerHeight); |
| 57 | bottom: $headerHeight; | 57 | bottom: var(--headerHeight); |
| 58 | left: $sidebarWidth; | 58 | left: var(--sidebarWidth); |
| 59 | margin-left: -2px; | 59 | margin-left: -2px; |
| 60 | width: 3px; | 60 | width: 3px; |
| 61 | cursor: col-resize; | 61 | cursor: col-resize; |
| @@ -72,11 +72,11 @@ · 10 unmodified lines | |||
| 72 | margin: 0; | 72 | margin: 0; |
| 73 | padding: 0; | 73 | padding: 0; |
| 74 | list-style: none; | 74 | list-style: none; |
| 75 | width: $sidebarWidth; | 75 | width: var(--sidebarWidth); |
| 76 | box-shadow: inset -1px 0 $sidebarBorder; | 76 | box-shadow: inset -1px 0 var(--sidebarBorder); |
| 77 | @extend %border-box; | 77 | @extend %border-box; |
| 78 | 78 | ||
| 79 | @media #{$mediumScreen} { width: $sidebarMediumWidth; } | 79 | @include mobile { width: var(--sidebarMediumWidth); } |
| 80 | 80 | ||
| 81 | ._sidebar > & { min-height: 100%; } | 81 | ._sidebar > & { min-height: 100%; } |
| 82 | 82 | ||
| @@ -89,7 +89,7 @@ · 6 unmodified lines | |||
| 89 | padding: 0 .75rem 0 2.125rem; | 89 | padding: 0 .75rem 0 2.125rem; |
| 90 | line-height: 2rem; | 90 | line-height: 2rem; |
| 91 | font-size: .75rem; | 91 | font-size: .75rem; |
| 92 | color: $textColorLight; | 92 | color: var(--textColorLight); |
| 93 | text-transform: uppercase; | 93 | text-transform: uppercase; |
| 94 | cursor: default; | 94 | cursor: default; |
| 95 | } | 95 | } |
| @@ -110,8 +110,8 @@ · 14 unmodified lines | |||
| 110 | line-height: 1.5rem; | 110 | line-height: 1.5rem; |
| 111 | font-size: .875rem; | 111 | font-size: .875rem; |
| 112 | cursor: default; | 112 | cursor: default; |
| 113 | background: $sidebarBackground; | 113 | background: var(--sidebarBackground); |
| 114 | box-shadow: inset -1px 0 $sidebarBorder; | 114 | box-shadow: inset -1px 0 var(--sidebarBorder); |
| 115 | @extend %truncate-text; | 115 | @extend %truncate-text; |
| 116 | 116 | ||
| 117 | &, &:hover { | 117 | &, &:hover { |
| @@ -123,16 +123,16 @@ · 5 unmodified lines | |||
| 123 | &.focus:hover, | 123 | &.focus:hover, |
| 124 | &.active, | 124 | &.active, |
| 125 | &.active:hover { | 125 | &.active:hover { |
| 126 | color: $focusText; | 126 | color: var(--focusText); |
| 127 | background: $focusBackground; | 127 | background: var(--focusBackground); |
| 128 | box-shadow: inset -1px 0 $focusBorder; | 128 | box-shadow: inset -1px 0 var(--focusBorder); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | &.active, | 131 | &.active, |
| 132 | &.active:hover { | 132 | &.active:hover { |
| 133 | color: $selectionText; | 133 | color: var(--selectionText); |
| 134 | background: $selectionBackground; | 134 | background: var(--selectionBackground); |
| 135 | box-shadow: inset -1px 0 $selectionBorder; | 135 | box-shadow: inset -1px 0 var(--selectionBorder); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | &:before { | 138 | &:before { |
| @@ -160,7 +160,7 @@ · 21 unmodified lines | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | ._list-count { | 162 | ._list-count { |
| 163 | color: $textColorLighter; | 163 | color: var(--textColorLighter); |
| 164 | pointer-events: none; | 164 | pointer-events: none; |
| 165 | 165 | ||
| 166 | ._list-disabled:hover > & { display: none; } | 166 | ._list-disabled:hover > & { display: none; } |
| @@ -168,7 +168,7 @@ · 1 unmodified line | |||
| 168 | 168 | ||
| 169 | ._list-enable { | 169 | ._list-enable { |
| 170 | display: none; | 170 | display: none; |
| 171 | color: $linkColor; | 171 | color: var(--linkColor); |
| 172 | cursor: pointer; | 172 | cursor: pointer; |
| 173 | 173 | ||
| 174 | &:hover { text-decoration: underline; } | 174 | &:hover { text-decoration: underline; } |
| @@ -188,7 +188,7 @@ · 13 unmodified lines | |||
| 188 | ._list-disabled { | 188 | ._list-disabled { |
| 189 | @extend %_list-dir; | 189 | @extend %_list-dir; |
| 190 | 190 | ||
| 191 | &, &:hover { color: $textColorLight; } | 191 | &, &:hover { color: var(--textColorLight); } |
| 192 | &:before { opacity: .7; } | 192 | &:before { opacity: .7; } |
| 193 | } | 193 | } |
| 194 | 194 | ||
| @@ -200,11 +200,9 @@ · 5 unmodified lines | |||
| 200 | width: 1rem; | 200 | width: 1rem; |
| 201 | height: 1rem; | 201 | height: 1rem; |
| 202 | cursor: pointer; | 202 | cursor: pointer; |
| 203 | fill: black; | 203 | fill: var(--absolute); |
| 204 | opacity: .4; | 204 | opacity: .4; |
| 205 | 205 | ||
| 206 | @if $style == 'dark' { fill: white; } | ||
| 207 | |||
| 208 | &:hover { opacity: .65; } | 206 | &:hover { opacity: .65; } |
| 209 | 207 | ||
| 210 | ._list-rdir > & { | 208 | ._list-rdir > & { |
| @@ -239,11 +237,11 @@ · 28 unmodified lines | |||
| 239 | // | 237 | // |
| 240 | 238 | ||
| 241 | ._list-pagelink { | 239 | ._list-pagelink { |
| 242 | color: $linkColor; | 240 | color: var(--linkColor); |
| 243 | cursor: pointer; | 241 | cursor: pointer; |
| 244 | 242 | ||
| 245 | &:hover { | 243 | &:hover { |
| 246 | color: $linkColorHover; | 244 | color: var(--linkColorHover); |
| 247 | text-decoration: underline; | 245 | text-decoration: underline; |
| 248 | } | 246 | } |
| 249 | } | 247 | } |
| @@ -275,9 +273,9 @@ · 25 unmodified lines | |||
| 275 | left: .75rem; | 273 | left: .75rem; |
| 276 | width: .75rem; | 274 | width: .75rem; |
| 277 | height: 1px; | 275 | height: 1px; |
| 278 | background: rgba($selectionText, .9); | 276 | background: var(--transparentSelectionText); |
| 279 | box-shadow: 0 -3px rgba($selectionText, .9), // top line | 277 | box-shadow: 0 -3px var(--transparentSelectionText), // top line |
| 280 | 0 3px rgba($selectionText, .9); // bottom line | 278 | 0 3px var(--transparentSelectionText); // bottom line |
| 281 | } | 279 | } |
| 282 | } | 280 | } |
| 283 | 281 | ||
| @@ -289,7 +287,7 @@ · 5 unmodified lines | |||
| 289 | padding: .5rem .75rem; | 287 | padding: .5rem .75rem; |
| 290 | line-height: 1.25rem; | 288 | line-height: 1.25rem; |
| 291 | font-size: .8125rem; | 289 | font-size: .8125rem; |
| 292 | color: $textColorLight; | 290 | color: var(--textColorLight); |
| 293 | 291 | ||
| 294 | & + & { padding-top: 0; } | 292 | & + & { padding-top: 0; } |
| 295 | } | 293 | } |
| @@ -303,9 +301,9 @@ · 7 unmodified lines | |||
| 303 | ._list-hover.clone { | 301 | ._list-hover.clone { |
| 304 | position: fixed; | 302 | position: fixed; |
| 305 | overflow: visible; | 303 | overflow: visible; |
| 306 | z-index: $hoverZ; | 304 | z-index: var(--hoverZ); |
| 307 | left: 0; | 305 | left: 0; |
| 308 | min-width: $sidebarWidth; | 306 | min-width: var(--sidebarWidth); |
| 309 | padding: .25rem .75rem; | 307 | padding: .25rem .75rem; |
| 310 | pointer-events: none; | 308 | pointer-events: none; |
| 311 | -webkit-font-smoothing: subpixel-antialiased; | 309 | -webkit-font-smoothing: subpixel-antialiased; |
| @@ -313,7 +311,7 @@ · 1 unmodified line | |||
| 313 | transform: translate3d(0, 0, 0); | 311 | transform: translate3d(0, 0, 0); |
| 314 | @extend %border-box; | 312 | @extend %border-box; |
| 315 | 313 | ||
| 316 | @media #{$mediumScreen} { min-width: $sidebarMediumWidth; } | 314 | @include mobile { min-width: var(--sidebarMediumWidth); } |
| 317 | 315 | ||
| 318 | > ._list-text { display: inline; } | 316 | > ._list-text { display: inline; } |
| 319 | 317 | ||
| @@ -346,10 +344,10 @@ · 26 unmodified lines | |||
| 346 | padding: .5rem .75rem .25rem .75rem; | 344 | padding: .5rem .75rem .25rem .75rem; |
| 347 | line-height: 1.5rem; | 345 | line-height: 1.5rem; |
| 348 | font-size: .75rem; | 346 | font-size: .75rem; |
| 349 | font-weight: $bolderFontWeight; | 347 | font-weight: var(--bolderFontWeight); |
| 350 | color: $textColorLight; | 348 | color: var(--textColorLight); |
| 351 | text-transform: uppercase; | 349 | text-transform: uppercase; |
| 352 | background: linear-gradient(to bottom, $sidebarBackground, $sidebarBackground 75%, rgba($sidebarBackground, 0)); | 350 | background: linear-gradient(to bottom, var(--sidebarBackground), var(--sidebarBackground) 75%, var(--transparentSidebarBackground)); |
| 353 | cursor: default; | 351 | cursor: default; |
| 354 | } | 352 | } |
| 355 | 353 | ||
| @@ -1,9 +1,10 @@ | |||
| 1 | html { | 1 | html { |
| 2 | height: 100%; | 2 | height: 100%; |
| 3 | font-size: 100%; | 3 | font-size: 100%; |
| 4 | background: $documentBackground; | 4 | background: #fff; // fallback to show the error message to browsers that don't support CSS variables. |
| 5 | background: var(--documentBackground); | ||
| 5 | 6 | ||
| 6 | @media #{$mediumScreen} { font-size: 93.75%; } | 7 | @include mobile { font-size: 93.75%; } |
| 7 | 8 | ||
| 8 | @include print { background: none; } | 9 | @include print { background: none; } |
| 9 | @import 'global/print'; | 10 | @import 'global/print'; |
| @@ -17,10 +18,11 @@ body { · 7 unmodified lines | |||
| 17 | font-weight: normal; | 18 | font-weight: normal; |
| 18 | font-family: $baseFont; | 19 | font-family: $baseFont; |
| 19 | line-height: 1.7; | 20 | line-height: 1.7; |
| 20 | color: $textColor; | 21 | color: $textColor; // fallback to show the error message to browsers that don't support CSS variables. |
| 22 | color: var(--textColor); | ||
| 21 | word-wrap: break-word; | 23 | word-wrap: break-word; |
| 22 | overflow-wrap: break-word; | 24 | overflow-wrap: break-word; |
| 23 | background: $contentBackground; | 25 | background: var(--contentBackground); |
| 24 | touch-action: manipulation; | 26 | touch-action: manipulation; |
| 25 | -webkit-tap-highlight-color: rgba(black, 0); | 27 | -webkit-tap-highlight-color: rgba(black, 0); |
| 26 | -webkit-touch-callout: none; | 28 | -webkit-touch-callout: none; |
| @@ -29,11 +31,11 @@ body { · 2 unmodified lines | |||
| 29 | } | 31 | } |
| 30 | 32 | ||
| 31 | a { | 33 | a { |
| 32 | color: $linkColor; | 34 | color: var(--linkColor); |
| 33 | text-decoration: $linkTextDecoration; | 35 | text-decoration: var(--linkTextDecoration); |
| 34 | 36 | ||
| 35 | &:hover { | 37 | &:hover { |
| 36 | color: $linkColorHover; | 38 | color: var(--linkColorHover); |
| 37 | text-decoration: underline; | 39 | text-decoration: underline; |
| 38 | } | 40 | } |
| 39 | } | 41 | } |
| @@ -47,7 +49,7 @@ img { · 7 unmodified lines | |||
| 47 | h1, h2, h3, h4, h5, h6 { | 49 | h1, h2, h3, h4, h5, h6 { |
| 48 | margin: 1.5em 0 1em; | 50 | margin: 1.5em 0 1em; |
| 49 | line-height: 1.3; | 51 | line-height: 1.3; |
| 50 | font-weight: $bolderFontWeight; | 52 | font-weight: var(--bolderFontWeight); |
| 51 | } | 53 | } |
| 52 | 54 | ||
| 53 | h1 { font-size: 1.5em; } | 55 | h1 { font-size: 1.5em; } |
| @@ -59,7 +61,7 @@ h5, h6 { font-size: 1em; } · 5 unmodified lines | |||
| 59 | p { margin: 0 0 1em; } | 61 | p { margin: 0 0 1em; } |
| 60 | p:last-child { margin-bottom: 0; } | 62 | p:last-child { margin-bottom: 0; } |
| 61 | 63 | ||
| 62 | b, strong { font-weight: $boldFontWeight; } | 64 | b, strong { font-weight: var(--boldFontWeight); } |
| 63 | 65 | ||
| 64 | small { font-size: .9em; } | 66 | small { font-size: .9em; } |
| 65 | 67 | ||
| @@ -79,7 +81,7 @@ li > ul, li > ol, dd > ul, dd > ol { margin: .5em 0; } · 13 unmodified lines | |||
| 79 | li > p { margin-bottom: .25em; } | 81 | li > p { margin-bottom: .25em; } |
| 80 | 82 | ||
| 81 | dl { margin: 1.5em 0; } | 83 | dl { margin: 1.5em 0; } |
| 82 | dt { font-weight: $boldFontWeight; } | 84 | dt { font-weight: var(--boldFontWeight); } |
| 83 | dd { | 85 | dd { |
| 84 | margin: .375em; | 86 | margin: .375em; |
| 85 | padding-left: 1em; | 87 | padding-left: 1em; |
| @@ -91,15 +93,15 @@ dfn, var { font-style: normal; } · 5 unmodified lines | |||
| 91 | 93 | ||
| 92 | abbr, acronym, dfn { | 94 | abbr, acronym, dfn { |
| 93 | cursor: help; | 95 | cursor: help; |
| 94 | border-bottom: 1px dotted $textColor; | 96 | border-bottom: 1px dotted var(--textColor); |
| 95 | } | 97 | } |
| 96 | 98 | ||
| 97 | pre, code, samp, %pre, %code { | 99 | pre, code, samp, %pre, %code { |
| 98 | font-family: $monoFont; | 100 | font-family: var(--monoFont); |
| 99 | font-weight: normal; | 101 | font-weight: normal; |
| 100 | font-style: normal; | 102 | font-style: normal; |
| 101 | font-size: .9em; | 103 | font-size: .9em; |
| 102 | color: $textColor; | 104 | color: var(--textColor); |
| 103 | white-space: pre-wrap; | 105 | white-space: pre-wrap; |
| 104 | direction: ltr; | 106 | direction: ltr; |
| 105 | -moz-tab-size: 2; | 107 | -moz-tab-size: 2; |
| @@ -121,14 +123,14 @@ a > code { color: inherit; } · 15 unmodified lines | |||
| 121 | table { | 123 | table { |
| 122 | margin: 1.5em 0; | 124 | margin: 1.5em 0; |
| 123 | background: none; | 125 | background: none; |
| 124 | border: 1px solid $boxBorder; | 126 | border: 1px solid var(--boxBorder); |
| 125 | border-collapse: separate; | 127 | border-collapse: separate; |
| 126 | border-spacing: 0; | 128 | border-spacing: 0; |
| 127 | border-radius: 3px; | 129 | border-radius: 3px; |
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | caption { | 132 | caption { |
| 131 | font-weight: $boldFontWeight; | 133 | font-weight: var(--boldFontWeight); |
| 132 | padding: 0 .7em .3em; | 134 | padding: 0 .7em .3em; |
| 133 | } | 135 | } |
| 134 | 136 | ||
| @@ -142,15 +144,15 @@ th, td { · 7 unmodified lines | |||
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | th { | 146 | th { |
| 145 | font-weight: $boldFontWeight; | 147 | font-weight: var(--boldFontWeight); |
| 146 | border: 0; | 148 | border: 0; |
| 147 | border-bottom: 1px solid $boxBorder; | 149 | border-bottom: 1px solid var(--boxBorder); |
| 148 | border-radius: 0; | 150 | border-radius: 0; |
| 149 | @extend %heading-box; | 151 | @extend %heading-box; |
| 150 | 152 | ||
| 151 | &:empty { background: none; } | 153 | &:empty { background: none; } |
| 152 | 154 | ||
| 153 | + th, + td { border-left: 1px solid $boxBorder; } | 155 | + th, + td { border-left: 1px solid var(--boxBorder); } |
| 154 | 156 | ||
| 155 | tr:first-child > &:first-child { border-top-left-radius: 3px; } | 157 | tr:first-child > &:first-child { border-top-left-radius: 3px; } |
| 156 | tr:first-child > &:last-child { border-top-right-radius: 3px; } | 158 | tr:first-child > &:last-child { border-top-right-radius: 3px; } |
| @@ -161,10 +163,10 @@ th { · 4 unmodified lines | |||
| 161 | } | 163 | } |
| 162 | 164 | ||
| 163 | td { | 165 | td { |
| 164 | background: $contentBackground; | 166 | background: var(--contentBackground); |
| 165 | border-bottom: 1px solid $boxBorderLight; | 167 | border-bottom: 1px solid var(--boxBorderLight); |
| 166 | 168 | ||
| 167 | + td { border-left: 1px solid $boxBorderLight; } | 169 | + td { border-left: 1px solid var(--boxBorderLight); } |
| 168 | tr:last-child > & { border-bottom: 0; } | 170 | tr:last-child > & { border-bottom: 0; } |
| 169 | 171 | ||
| 170 | > pre:only-child, > p:only-child, > ul:only-child, > ol:only-child { | 172 | > pre:only-child, > p:only-child, > ul:only-child, > ol:only-child { |
| @@ -190,7 +192,7 @@ input, button { · 19 unmodified lines | |||
| 190 | margin: 0; | 192 | margin: 0; |
| 191 | font-family: inherit; | 193 | font-family: inherit; |
| 192 | font-size: 100%; | 194 | font-size: 100%; |
| 193 | color: $textColor; | 195 | color: var(--textColor); |
| 194 | line-height: normal; | 196 | line-height: normal; |
| 195 | @extend %border-box; | 197 | @extend %border-box; |
| 196 | } | 198 | } |
| @@ -218,6 +220,10 @@ button:focus { · 21 unmodified lines | |||
| 218 | outline: -webkit-focus-ring-color auto 5px; | 220 | outline: -webkit-focus-ring-color auto 5px; |
| 219 | } | 221 | } |
| 220 | 222 | ||
| 223 | img, iframe { | ||
| 224 | background: var(--externalsBackground); | ||
| 225 | } | ||
| 226 | |||
| 221 | input[type="search"]::-webkit-search-cancel-button, | 227 | input[type="search"]::-webkit-search-cancel-button, |
| 222 | input[type="search"]::-webkit-search-decoration { | 228 | input[type="search"]::-webkit-search-decoration { |
| 223 | -webkit-appearance: none; | 229 | -webkit-appearance: none; |
| @@ -230,9 +236,9 @@ input[type="search"]::-webkit-search-decoration { · 6 unmodified lines | |||
| 230 | border: 0 !important; | 236 | border: 0 !important; |
| 231 | } | 237 | } |
| 232 | 238 | ||
| 233 | ::-webkit-input-placeholder { color: $textColorLighter; } | 239 | ::-webkit-input-placeholder { color: var(--textColorLighter); } |
| 234 | ::-moz-placeholder { color: $textColorLighter; opacity: 1; } | 240 | ::-moz-placeholder { color: var(--textColorLighter); opacity: 1; } |
| 235 | :-ms-input-placeholder { color: $textColorLighter; } | 241 | :-ms-input-placeholder { color: var(--textColorLighter); } |
| 236 | 242 | ||
| 237 | body:not(._native-scrollbars) { | 243 | body:not(._native-scrollbars) { |
| 238 | *::-webkit-scrollbar { -webkit-appearance: none; } | 244 | *::-webkit-scrollbar { -webkit-appearance: none; } |
| @@ -243,12 +249,12 @@ body:not(._native-scrollbars) { · 4 unmodified lines | |||
| 243 | *::-webkit-scrollbar-corner { display: none; } | 249 | *::-webkit-scrollbar-corner { display: none; } |
| 244 | 250 | ||
| 245 | *::-webkit-scrollbar-track { | 251 | *::-webkit-scrollbar-track { |
| 246 | background: $contentBackground; | 252 | background: var(--contentBackground); |
| 247 | border: 1px solid $contentBackground; | 253 | border: 1px solid var(--contentBackground); |
| 248 | 254 | ||
| 249 | &:hover { | 255 | &:hover { |
| 250 | background: $sidebarBackground; | 256 | background: var(--sidebarBackground); |
| 251 | border-color: $sidebarBorder; | 257 | border-color: var(--sidebarBorder); |
| 252 | } | 258 | } |
| 253 | 259 | ||
| 254 | &:vertical { border-width: 0 0 0 1px; } | 260 | &:vertical { border-width: 0 0 0 1px; } |
| @@ -266,14 +272,14 @@ body:not(._native-scrollbars) { · 11 unmodified lines | |||
| 266 | 272 | ||
| 267 | *::-webkit-scrollbar-thumb { | 273 | *::-webkit-scrollbar-thumb { |
| 268 | min-height: 2rem; | 274 | min-height: 2rem; |
| 269 | background: $scrollbarColor; | 275 | background: var(--scrollbarColor); |
| 270 | background-clip: padding-box; | 276 | background-clip: padding-box; |
| 271 | border: 5px solid rgba(black, 0); | 277 | border: 5px solid rgba(black, 0); |
| 272 | border-radius: 10px; | 278 | border-radius: 10px; |
| 273 | 279 | ||
| 274 | &:hover, | 280 | &:hover, |
| 275 | &:active { | 281 | &:active { |
| 276 | background-color: $scrollbarColorHover; | 282 | background-color: var(--scrollbarColorHover); |
| 277 | border-width: 4px; | 283 | border-width: 4px; |
| 278 | } | 284 | } |
| 279 | } | 285 | } |
| @@ -36,15 +36,15 @@ · 35 unmodified lines | |||
| 36 | // | 36 | // |
| 37 | 37 | ||
| 38 | %box { | 38 | %box { |
| 39 | background: $boxBackground; | 39 | background: var(--boxBackground); |
| 40 | border: 1px solid $boxBorder; | 40 | border: 1px solid var(--boxBorder); |
| 41 | border-radius: 3px; | 41 | border-radius: 3px; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | %heading-box { | 44 | %heading-box { |
| 45 | color: $boxHeaderColor; | 45 | color: var(--boxHeaderColor); |
| 46 | background: $boxHeaderBackground; | 46 | background: var(--boxHeaderBackground); |
| 47 | border: 1px solid $boxBorder; | 47 | border: 1px solid var(--boxBorder); |
| 48 | border-radius: 3px; | 48 | border-radius: 3px; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| @@ -82,15 +82,15 @@ · 31 unmodified lines | |||
| 82 | %note { | 82 | %note { |
| 83 | margin: 1.5rem 0; | 83 | margin: 1.5rem 0; |
| 84 | padding: .5rem .875rem; | 84 | padding: .5rem .875rem; |
| 85 | background: $noteBackground; | 85 | background: var(--noteBackground); |
| 86 | border: 1px solid $noteBorder; | 86 | border: 1px solid var(--noteBorder); |
| 87 | border-radius: 3px; | 87 | border-radius: 3px; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | %label { | 90 | %label { |
| 91 | margin: 0 1px; | 91 | margin: 0 1px; |
| 92 | padding: 1px 4px 2px; | 92 | padding: 1px 4px 2px; |
| 93 | background: $labelBackground; | 93 | background: var(--labelBackground); |
| 94 | border-radius: 3px; | 94 | border-radius: 3px; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| @@ -102,35 +102,35 @@ · 5 unmodified lines | |||
| 102 | padding-right: .5em; | 102 | padding-right: .5em; |
| 103 | overflow: hidden; | 103 | overflow: hidden; |
| 104 | font-size: inherit; | 104 | font-size: inherit; |
| 105 | color: $boxHeaderColor; | 105 | color: var(--boxHeaderColor); |
| 106 | border: 1px solid $boxBorder; | 106 | border: 1px solid var(--boxBorder); |
| 107 | border-radius: 2px; | 107 | border-radius: 2px; |
| 108 | @extend %label; | 108 | @extend %label; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | %label-yellow { | 111 | %label-yellow { |
| 112 | background: $noteBackground; | 112 | background: var(--noteBackground); |
| 113 | border-color: $noteBorder; | 113 | border-color: var(--noteBorder); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | %note-green, %label-green { | 116 | %note-green, %label-green { |
| 117 | background: $noteGreenBackground; | 117 | background: var(--noteGreenBackground); |
| 118 | border-color: $noteGreenBorder; | 118 | border-color: var(--noteGreenBorder); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | %note-blue, %label-blue { | 121 | %note-blue, %label-blue { |
| 122 | background: $noteBlueBackground; | 122 | background: var(--noteBlueBackground); |
| 123 | border-color: $noteBlueBorder; | 123 | border-color: var(--noteBlueBorder); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | %note-orange, %label-orange { | 126 | %note-orange, %label-orange { |
| 127 | background: $noteOrangeBackground; | 127 | background: var(--noteOrangeBackground); |
| 128 | border-color: $noteOrangeBorder; | 128 | border-color: var(--noteOrangeBorder); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | %note-red, %label-red { | 131 | %note-red, %label-red { |
| 132 | background: $noteRedBackground; | 132 | background: var(--noteRedBackground); |
| 133 | border-color: $noteRedBorder; | 133 | border-color: var(--noteRedBorder); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | // | 136 | // |
| @@ -149,12 +149,11 @@ · 12 unmodified lines | |||
| 149 | pointer-events: none; | 149 | pointer-events: none; |
| 150 | 150 | ||
| 151 | // <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15,15H2V6h2.595c0,0,0.689-0.896,2.17-2H1C0.447,4,0,4.449,0,5v11c0,0.553,0.447,1,1,1h15c0.553,0,1-0.447,1-1v-3.746 l-2,1.645V15z M13.361,8.05v3.551L20,6.4l-6.639-4.999v3.131C5.3,4.532,5.3,12.5,5.3,12.5C7.582,8.752,8.986,8.05,13.361,8.05z"/></svg> | 151 | // <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15,15H2V6h2.595c0,0,0.689-0.896,2.17-2H1C0.447,4,0,4.449,0,5v11c0,0.553,0.447,1,1,1h15c0.553,0,1-0.447,1-1v-3.746 l-2,1.645V15z M13.361,8.05v3.551L20,6.4l-6.639-4.999v3.131C5.3,4.532,5.3,12.5,5.3,12.5C7.582,8.752,8.986,8.05,13.361,8.05z"/></svg> |
| 152 | @if $style == 'dark' { | 152 | background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iIzMzNzdjMCIgZD0iTTE1LDE1SDJWNmgyLjU5NWMwLDAsMC42ODktMC44OTYsMi4xNy0ySDFDMC40NDcsNCwwLDQuNDQ5LDAsNXYxMWMwLDAuNTUzLDAuNDQ3LDEsMSwxaDE1YzAuNTUzLDAsMS0wLjQ0NywxLTF2LTMuNzQ2IGwtMiwxLjY0NVYxNXogTTEzLjM2MSw4LjA1djMuNTUxTDIwLDYuNGwtNi42MzktNC45OTl2My4xMzFDNS4zLDQuNTMyLDUuMywxMi41LDUuMywxMi41QzcuNTgyLDguNzUyLDguOTg2LDguMDUsMTMuMzYxLDguMDV6Ii8+PC9zdmc+); |
| 153 | background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iI2NiZDBkMCIgZD0iTTE1LDE1SDJWNmgyLjU5NWMwLDAsMC42ODktMC44OTYsMi4xNy0ySDFDMC40NDcsNCwwLDQuNDQ5LDAsNXYxMWMwLDAuNTUzLDAuNDQ3LDEsMSwxaDE1YzAuNTUzLDAsMS0wLjQ0NywxLTF2LTMuNzQ2IGwtMiwxLjY0NVYxNXogTTEzLjM2MSw4LjA1djMuNTUxTDIwLDYuNGwtNi42MzktNC45OTl2My4xMzFDNS4zLDQuNTMyLDUuMywxMi41LDUuMywxMi41QzcuNTgyLDguNzUyLDguOTg2LDguMDUsMTMuMzYxLDguMDV6Ii8+PC9zdmc+); | ||
| 154 | } @else { | ||
| 155 | background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iIzMzNzdjMCIgZD0iTTE1LDE1SDJWNmgyLjU5NWMwLDAsMC42ODktMC44OTYsMi4xNy0ySDFDMC40NDcsNCwwLDQuNDQ5LDAsNXYxMWMwLDAuNTUzLDAuNDQ3LDEsMSwxaDE1YzAuNTUzLDAsMS0wLjQ0NywxLTF2LTMuNzQ2IGwtMiwxLjY0NVYxNXogTTEzLjM2MSw4LjA1djMuNTUxTDIwLDYuNGwtNi42MzktNC45OTl2My4xMzFDNS4zLDQuNTMyLDUuMywxMi41LDUuMywxMi41QzcuNTgyLDguNzUyLDguOTg2LDguMDUsMTMuMzYxLDguMDV6Ii8+PC9zdmc+); | ||
| 156 | } | ||
| 157 | } | 153 | } |
| 158 | } | 154 | } |
| 155 | html._theme-dark %external-link:after { | ||
| 156 | background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iI2NiZDBkMCIgZD0iTTE1LDE1SDJWNmgyLjU5NWMwLDAsMC42ODktMC44OTYsMi4xNy0ySDFDMC40NDcsNCwwLDQuNDQ5LDAsNXYxMWMwLDAuNTUzLDAuNDQ3LDEsMSwxaDE1YzAuNTUzLDAsMS0wLjQ0NywxLTF2LTMuNzQ2IGwtMiwxLjY0NVYxNXogTTEzLjM2MSw4LjA1djMuNTUxTDIwLDYuNGwtNi42MzktNC45OTl2My4xMzFDNS4zLDQuNTMyLDUuMywxMi41LDUuMywxMi41QzcuNTgyLDguNzUyLDguOTg2LDguMDUsMTMuMzYxLDguMDV6Ii8+PC9zdmc+); | ||
| 157 | } | ||
| 159 | 158 | ||
| 160 | %internal-link:after { content: none !important; } | 159 | %internal-link:after { content: none !important; } |
| @@ -23,8 +23,8 @@ · 22 unmodified lines | |||
| 23 | %doc-icon-2 { background-image: image-url('docs-2@2x.png') !important; } | 23 | %doc-icon-2 { background-image: image-url('docs-2@2x.png') !important; } |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | %darkIconFix { | 26 | html._theme-dark { |
| 27 | @if $style == 'dark' { | 27 | %darkIconFix { |
| 28 | filter: invert(100%) grayscale(100%); | 28 | filter: invert(100%) grayscale(100%); |
| 29 | -webkit-filter: invert(100%) grayscale(100%); | 29 | -webkit-filter: invert(100%) grayscale(100%); |
| 30 | } | 30 | } |
| @@ -178,3 +178,5 @@ · 147 unmodified lines | |||
| 178 | ._icon-bash:before { background-position: -6rem -3rem; @extend %doc-icon-2; } | 178 | ._icon-bash:before { background-position: -6rem -3rem; @extend %doc-icon-2; } |
| 179 | ._icon-dart:before { background-position: -7rem -3rem; @extend %doc-icon-2; } | 179 | ._icon-dart:before { background-position: -7rem -3rem; @extend %doc-icon-2; } |
| 180 | ._icon-qt:before { background-position: -8rem -3rem; @extend %doc-icon-2; } | 180 | ._icon-qt:before { background-position: -8rem -3rem; @extend %doc-icon-2; } |
| 181 | ._icon-puppeteer:before { background-position: -9rem -3rem; @extend %doc-icon-2; } | ||
| 182 | ._icon-handlebars:before { background-position: 0 -4rem; @extend %doc-icon-2; @extend %darkIconFix !optional; } | ||
| @@ -7,3 +7,9 @@ · 6 unmodified lines | |||
| 7 | @content; | 7 | @content; |
| 8 | } | 8 | } |
| 9 | } | 9 | } |
| 10 | |||
| 11 | @mixin mobile { | ||
| 12 | @media (max-width: 800px) { | ||
| 13 | @content; | ||
| 14 | } | ||
| 15 | } | ||
| @@ -25,14 +25,14 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | ._attribution-p { | 26 | ._attribution-p { |
| 27 | background: none; | 27 | background: none; |
| 28 | border: 2px solid $boxBorder; | 28 | border: 2px solid var(--boxBorder); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | ._attribution:last-child:after { | 31 | ._attribution:last-child:after { |
| 32 | content: 'Exported from DevDocs \2014 https://devdocs.io'; | 32 | content: 'Exported from DevDocs \2014 https://devdocs.io'; |
| 33 | display: block; | 33 | display: block; |
| 34 | margin-top: 1rem; | 34 | margin-top: 1rem; |
| 35 | font-weight: $bolderFontWeight; | 35 | font-weight: var(--bolderFontWeight); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | ._attribution { | 38 | ._attribution { |
| @@ -1,92 +1,76 @@ | |||
| 1 | $baseFont: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif; | 1 | html._theme-dark { |
| 2 | $monoFont: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; | 2 | --absolute: white; |
| 3 | $boldFontWeight: 500; | ||
| 4 | $bolderFontWeight: 600; | ||
| 5 | 3 | ||
| 6 | $style: 'dark'; | 4 | --documentBackground: #222; |
| 5 | --contentBackground: #33373a; | ||
| 7 | 6 | ||
| 8 | $maxWidth: 80rem; | 7 | --textColor: #cbd0d0; |
| 9 | $headerHeight: 3rem; | 8 | --textColorLight: #9da5ad; |
| 10 | $sidebarWidth: 20rem; | 9 | --textColorLighter: #77787a; |
| 11 | $sidebarMediumWidth: 16rem; | ||
| 12 | 10 | ||
| 13 | $documentBackground: #222; | 11 | --externalsBackground: #fff; |
| 14 | $contentBackground: #33373a; | ||
| 15 | 12 | ||
| 16 | $textColor: #cbd0d0; | 13 | --inputFocusBorder: transparent; |
| 17 | $textColorLight: #9da5ad; | ||
| 18 | $textColorLighter: #77787a; | ||
| 19 | $textColorRed: #f44336; | ||
| 20 | 14 | ||
| 21 | $inputFocusBorder: false; | 15 | --focusBackground: #3f4042; |
| 16 | --focusBorder: #000; | ||
| 17 | --focusText: #f7f2f2; | ||
| 22 | 18 | ||
| 23 | $focusBackground: #3f4042; | 19 | --loadingText: #5d6164; |
| 24 | $focusBorder: #000; | ||
| 25 | $focusText: #f7f2f2; | ||
| 26 | 20 | ||
| 27 | $loadingText: #5d6164; | 21 | --selectionBackground: #007acc; |
| 28 | $splashText: $loadingText; | 22 | --selectionBorder: #000; |
| 29 | 23 | ||
| 30 | $selectionBackground: #007acc; | 24 | --highlightBackground: #64675f; |
| 31 | $selectionBorder: #000; | ||
| 32 | $selectionText: #fff; | ||
| 33 | 25 | ||
| 34 | $highlightBackground: #64675f; | 26 | --linkColor: var(--textColor); |
| 27 | --linkColorHover: white; | ||
| 28 | --linkTextDecoration: underline; | ||
| 35 | 29 | ||
| 36 | $linkColor: $textColor; | 30 | --headerBackground: #1c1c1c; |
| 37 | $linkColorHover: white; | 31 | --headerBorder: #000; |
| 38 | $linkTextDecoration: underline; | 32 | --searchTagBackground: #{darken(#1c1c1c, 5%)}; |
| 33 | --searchBorder: #{darken(#000, 2%)}; | ||
| 39 | 34 | ||
| 40 | $headerBackground: #1c1c1c; | 35 | --sidebarBackground: #24282a; |
| 41 | $headerBorder: #000; | 36 | --transparentSidebarBackground: #{rgba(#24282a, 0)}; |
| 37 | --sidebarBorder: #000; | ||
| 42 | 38 | ||
| 43 | $sidebarBackground: #24282a; | 39 | --scrollbarColor: #6c6c6f; |
| 44 | $sidebarBorder: #000; | 40 | --scrollbarColorHover: #949697; |
| 45 | 41 | ||
| 46 | $scrollbarColor: #6c6c6f; | 42 | --pathBackground: var(--headerBackground); |
| 47 | $scrollbarColorHover: #949697; | 43 | --pathBorder: var(--headerBorder); |
| 48 | 44 | ||
| 49 | $pathBackground: $headerBackground; | 45 | --noticeBackground: var(--sidebarBackground); |
| 50 | $pathBorder: $headerBorder; | 46 | --noticeBorder: var(--sidebarBorder); |
| 51 | 47 | ||
| 52 | $noticeBackground: $sidebarBackground; | 48 | --boxBackground: var(--sidebarBackground); |
| 53 | $noticeBorder: $sidebarBorder; | 49 | --boxBorder: var(--headerBorder); |
| 50 | --boxBorderLight: var(--headerBorder); | ||
| 51 | --boxHeaderColor: #dbe4e4; | ||
| 52 | --boxHeaderBackground: var(--sidebarBackground); | ||
| 54 | 53 | ||
| 55 | $boxBackground: $sidebarBackground; | 54 | --noteBackground: #45474b; |
| 56 | $boxBorder: $headerBorder; | 55 | --noteBorder: #000; |
| 57 | $boxBorderLight: $headerBorder; | ||
| 58 | $boxHeaderColor: #dbe4e4; | ||
| 59 | $boxHeaderBackground: $sidebarBackground; | ||
| 60 | 56 | ||
| 61 | $noteBackground: #45474b; | 57 | --noteGreenBackground: #284a2a; |
| 62 | $noteBorder: #000; | 58 | --noteGreenBorder: #000; |
| 63 | 59 | ||
| 64 | $noteGreenBackground: #284a2a; | 60 | --noteBlueBackground: #2a4151; |
| 65 | $noteGreenBorder: #000; | 61 | --noteBlueBorder: #000; |
| 66 | 62 | ||
| 67 | $noteBlueBackground: #2a4151; | 63 | --noteOrangeBackground: #563322; |
| 68 | $noteBlueBorder: #000; | 64 | --noteOrangeBorder: #000; |
| 69 | 65 | ||
| 70 | $noteOrangeBackground: #563322; | 66 | --noteRedBackground: #603033; |
| 71 | $noteOrangeBorder: #000; | 67 | --noteRedBorder: #000; |
| 72 | 68 | ||
| 73 | $noteRedBackground: #603033; | 69 | --labelBackground: var(--boxBackground); |
| 74 | $noteRedBorder: #000; | ||
| 75 | 70 | ||
| 76 | $labelBackground: $boxBackground; | 71 | --notifBackground: #{rgba(#555, .95)}; |
| 72 | --notifBorder: 1px solid #000; | ||
| 77 | 73 | ||
| 78 | $notifBackground: rgba(#555, .95); | 74 | --tipBackground: var(--notifBackground); |
| 79 | $notifBorder: 1px solid #000; | 75 | --tipBorder: var(--notifBorder); |
| 80 | $notifColor: #fff; | 76 | } |
| 81 | $notifColorLight: #ccc; | ||
| 82 | |||
| 83 | $tipBackground: $notifBackground; | ||
| 84 | $tipBorder: $notifBorder; | ||
| 85 | |||
| 86 | $mediumScreen: '(max-width: 800px)'; | ||
| 87 | |||
| 88 | $contentZ: 1; | ||
| 89 | $sidebarZ: 2; | ||
| 90 | $headerZ: 3; | ||
| 91 | $noticeZ: 4; | ||
| 92 | $hoverZ: 5; | ||
| @@ -0,0 +1,76 @@ | |||
| 1 | html._theme-default { | ||
| 2 | --absolute: black; | ||
| 3 | |||
| 4 | --documentBackground: #f3f3f3; | ||
| 5 | --contentBackground: #fff; | ||
| 6 | |||
| 7 | --textColor: #333; | ||
| 8 | --textColorLight: #666; | ||
| 9 | --textColorLighter: #888; | ||
| 10 | |||
| 11 | --externalsBackground: #fff; | ||
| 12 | |||
| 13 | --inputFocusBorder: #35b5f4; | ||
| 14 | |||
| 15 | --focusBackground: #e5e5e5; | ||
| 16 | --focusBorder: #d4d4d4; | ||
| 17 | --focusText: #000; | ||
| 18 | |||
| 19 | --loadingText: #ccc; | ||
| 20 | |||
| 21 | --selectionBackground: #398df0; | ||
| 22 | --selectionBorder: #196fc2; | ||
| 23 | |||
| 24 | --highlightBackground: #fffdcd; | ||
| 25 | |||
| 26 | --linkColor: #3377c0; | ||
| 27 | --linkColorHover: #2f6cb6; | ||
| 28 | --linkTextDecoration: none; | ||
| 29 | |||
| 30 | --headerBackground: #eee; | ||
| 31 | --headerBorder: #d7d7d7; | ||
| 32 | --searchTagBackground: #{darken(#eee, 5%)}; | ||
| 33 | --searchBorder: #{darken(#d7d7d7, 2%)}; | ||
| 34 | |||
| 35 | --sidebarBackground: #f9f9f9; | ||
| 36 | --transparentSidebarBackground: #{rgba(#f9f9f9, 0)}; | ||
| 37 | --sidebarBorder: #e1e1e1; | ||
| 38 | |||
| 39 | --scrollbarColor: #ccc; | ||
| 40 | --scrollbarColorHover: #999; | ||
| 41 | |||
| 42 | --pathBackground: var(--sidebarBackground); | ||
| 43 | --pathBorder: var(--sidebarBorder); | ||
| 44 | |||
| 45 | --noticeBackground: #faf9e2; | ||
| 46 | --noticeBorder: #e2e2c1; | ||
| 47 | |||
| 48 | --boxBackground: #fafafa; | ||
| 49 | --boxBorder: #d8d8d8; | ||
| 50 | --boxBorderLight: #e5e5e5; | ||
| 51 | --boxHeaderColor: var(--textColor); | ||
| 52 | --boxHeaderBackground: #f5f5f5; | ||
| 53 | |||
| 54 | --noteBackground: #f8f8dd; | ||
| 55 | --noteBorder: #d3d952; | ||
| 56 | |||
| 57 | --noteGreenBackground: #e7f8e1; | ||
| 58 | --noteGreenBorder: #89da70; | ||
| 59 | |||
| 60 | --noteBlueBackground: #d4f3fd; | ||
| 61 | --noteBlueBorder: #94bbeb; | ||
| 62 | |||
| 63 | --noteOrangeBackground: #fbe6d1; | ||
| 64 | --noteOrangeBorder: #ec8b01; | ||
| 65 | |||
| 66 | --noteRedBackground: #fed5d3; | ||
| 67 | --noteRedBorder: #dc7874; | ||
| 68 | |||
| 69 | --labelBackground: #f4f4f4; | ||
| 70 | |||
| 71 | --notifBackground: #{rgba(#333, .85)}; | ||
| 72 | --notifBorder: none; | ||
| 73 | |||
| 74 | --tipBackground: #{rgba(#fffdcd, .95)}; | ||
| 75 | --tipBorder: 1px solid #e7dca9; | ||
| 76 | } | ||
| @@ -1,92 +1,35 @@ | |||
| 1 | // Variables needed to style the error message for browsers that don't support CSS variables. | ||
| 1 | $baseFont: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif; | 2 | $baseFont: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif; |
| 2 | $monoFont: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; | ||
| 3 | $boldFontWeight: 500; | ||
| 4 | $bolderFontWeight: 600; | ||
| 5 | |||
| 6 | $style: 'light'; | ||
| 7 | |||
| 8 | $maxWidth: 80rem; | ||
| 9 | $headerHeight: 3rem; | ||
| 10 | $sidebarWidth: 20rem; | ||
| 11 | $sidebarMediumWidth: 16rem; | ||
| 12 | |||
| 13 | $documentBackground: #f3f3f3; | ||
| 14 | $contentBackground: #fff; | ||
| 15 | |||
| 16 | $textColor: #333; | 3 | $textColor: #333; |
| 17 | $textColorLight: #666; | ||
| 18 | $textColorLighter: #888; | ||
| 19 | $textColorRed: #f44336; | ||
| 20 | |||
| 21 | $inputFocusBorder: #35b5f4; | ||
| 22 | |||
| 23 | $focusBackground: #e5e5e5; | ||
| 24 | $focusBorder: #d4d4d4; | ||
| 25 | $focusText: #000; | ||
| 26 | |||
| 27 | $loadingText: #ccc; | ||
| 28 | $splashText: #ccc; | ||
| 29 | |||
| 30 | $selectionBackground: #398df0; | ||
| 31 | $selectionBorder: #196fc2; | ||
| 32 | $selectionText: #fff; | ||
| 33 | |||
| 34 | $highlightBackground: #fffdcd; | ||
| 35 | |||
| 36 | $linkColor: #3377c0; | ||
| 37 | $linkColorHover: #2f6cb6; | ||
| 38 | $linkTextDecoration: none; | ||
| 39 | |||
| 40 | $headerBackground: #eee; | ||
| 41 | $headerBorder: #d7d7d7; | ||
| 42 | |||
| 43 | $sidebarBackground: #f9f9f9; | ||
| 44 | $sidebarBorder: #e1e1e1; | ||
| 45 | |||
| 46 | $scrollbarColor: #ccc; | ||
| 47 | $scrollbarColorHover: #999; | ||
| 48 | |||
| 49 | $pathBackground: $sidebarBackground; | ||
| 50 | $pathBorder: $sidebarBorder; | ||
| 51 | |||
| 52 | $noticeBackground: #faf9e2; | ||
| 53 | $noticeBorder: #e2e2c1; | ||
| 54 | |||
| 55 | $boxBackground: #fafafa; | ||
| 56 | $boxBorder: #d8d8d8; | ||
| 57 | $boxBorderLight: #e5e5e5; | ||
| 58 | $boxHeaderColor: $textColor; | ||
| 59 | $boxHeaderBackground: #f5f5f5; | ||
| 60 | |||
| 61 | $noteBackground: #f8f8dd; | ||
| 62 | $noteBorder: #d3d952; | ||
| 63 | |||
| 64 | $noteGreenBackground: #e7f8e1; | ||
| 65 | $noteGreenBorder: #89da70; | ||
| 66 | 4 | ||
| 67 | $noteBlueBackground: #d4f3fd; | 5 | html { |
| 68 | $noteBlueBorder: #94bbeb; | 6 | --baseFont: #{$baseFont}; |
| 7 | --monoFont: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; | ||
| 8 | --boldFontWeight: 500; | ||
| 9 | --bolderFontWeight: 600; | ||
| 69 | 10 | ||
| 70 | $noteOrangeBackground: #fbe6d1; | 11 | --textColorRed: #f44336; |
| 71 | $noteOrangeBorder: #ec8b01; | ||
| 72 | 12 | ||
| 73 | $noteRedBackground: #fed5d3; | 13 | --splashText: var(--loadingText); |
| 74 | $noteRedBorder: #dc7874; | ||
| 75 | 14 | ||
| 76 | $labelBackground: #f4f4f4; | 15 | --selectionText: #fff; |
| 16 | --transparentSelectionText: rgba(255, 255, 255, 0.9); | ||
| 77 | 17 | ||
| 78 | $notifBackground: rgba(#333, .85); | 18 | --notifColor: #fff; |
| 79 | $notifBorder: none; | 19 | --notifColorLight: #ccc; |
| 80 | $notifColor: #fff; | ||
| 81 | $notifColorLight: #ccc; | ||
| 82 | 20 | ||
| 83 | $tipBackground: rgba(#fffdcd, .95); | 21 | --maxWidth: 80rem; |
| 84 | $tipBorder: 1px solid #e7dca9; | 22 | --headerHeight: 3rem; |
| 23 | --sidebarWidth: 20rem; | ||
| 24 | --sidebarMediumWidth: 16rem; | ||
| 85 | 25 | ||
| 86 | $mediumScreen: '(max-width: 800px)'; | 26 | --focusBackground: #e5e5e5; |
| 27 | --focusBorder: #d4d4d4; | ||
| 28 | --focusText: #000; | ||
| 87 | 29 | ||
| 88 | $contentZ: 1; | 30 | --contentZ: 1; |
| 89 | $sidebarZ: 2; | 31 | --sidebarZ: 2; |
| 90 | $headerZ: 3; | 32 | --headerZ: 3; |
| 91 | $noticeZ: 4; | 33 | --noticeZ: 4; |
| 92 | $hoverZ: 5; | 34 | --hoverZ: 5; |
| 35 | } | ||
| @@ -8,7 +8,7 @@ · 7 unmodified lines | |||
| 8 | .nav-index-section { | 8 | .nav-index-section { |
| 9 | margin: 1.5em 0 1em -2em; | 9 | margin: 1.5em 0 1em -2em; |
| 10 | list-style: none; | 10 | list-style: none; |
| 11 | font-weight: $boldFontWeight; | 11 | font-weight: var(--boldFontWeight); |
| 12 | text-transform: capitalize; | 12 | text-transform: capitalize; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| @@ -3,13 +3,13 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | h3 > .type-signature { | 4 | h3 > .type-signature { |
| 5 | float: right; | 5 | float: right; |
| 6 | color: $textColorLight; | 6 | color: var(--textColorLight); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | h3 > .signature-attributes { | 9 | h3 > .signature-attributes { |
| 10 | font-size: .75rem; | 10 | font-size: .75rem; |
| 11 | font-weight: normal; | 11 | font-weight: normal; |
| 12 | font-style: italic; | 12 | font-style: italic; |
| 13 | color: $textColorLighter; | 13 | color: var(--textColorLighter); |
| 14 | } | 14 | } |
| 15 | } | 15 | } |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | th[align=left] { | 7 | th[align=left] { |
| 8 | border-left: 1px solid $boxBorder; | 8 | border-left: 1px solid var(--boxBorder); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | code { @extend %label; } | 11 | code { @extend %label; } |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | h4 > code, h5 > code, strong > code { @extend %label; } | 4 | h4 > code, h5 > code, strong > code { @extend %label; } |
| 5 | 5 | ||
| 6 | h2 > small { | 6 | h2 > small { |
| 7 | color: $textColorLight; | 7 | color: var(--textColorLight); |
| 8 | float: right; | 8 | float: right; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | .t-spar { // language/switch, language/for, etc. | 24 | .t-spar { // language/switch, language/for, etc. |
| 25 | font-style: italic; | 25 | font-style: italic; |
| 26 | color: $textColorLight; | 26 | color: var(--textColorLight); |
| 27 | } | 27 | } |
| 28 | .t-sdsc-nopad dl, .t-sdsc-nopad dd { margin: 0; } | 28 | .t-sdsc-nopad dl, .t-sdsc-nopad dd { margin: 0; } |
| 29 | 29 | ||
| @@ -57,7 +57,7 @@ · 27 unmodified lines | |||
| 57 | margin: 1rem 0; | 57 | margin: 1rem 0; |
| 58 | padding: .375rem; | 58 | padding: .375rem; |
| 59 | font-size: .75rem; | 59 | font-size: .75rem; |
| 60 | border: 1px solid $boxBorder; | 60 | border: 1px solid var(--boxBorder); |
| 61 | border-radius: 2px; | 61 | border-radius: 2px; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| @@ -5,6 +5,6 @@ · 4 unmodified lines | |||
| 5 | .type { | 5 | .type { |
| 6 | float: right; | 6 | float: right; |
| 7 | font-size: .9em; | 7 | font-size: .9em; |
| 8 | color: $textColorLight; | 8 | color: var(--textColorLight); |
| 9 | } | 9 | } |
| 10 | } | 10 | } |
| @@ -2,10 +2,10 @@ · 1 unmodified line | |||
| 2 | h2 { @extend %block-heading; } | 2 | h2 { @extend %block-heading; } |
| 3 | h3, .d_decl { @extend %block-label, %label-blue; } | 3 | h3, .d_decl { @extend %block-label, %label-blue; } |
| 4 | .d_decl { @extend %code; } | 4 | .d_decl { @extend %code; } |
| 5 | .d_decl > small { color: $textColorLight; } | 5 | .d_decl > small { color: var(--textColorLight); } |
| 6 | .d_decl > strong { font-weight: $bolderFontWeight; } | 6 | .d_decl > strong { font-weight: var(--bolderFontWeight); } |
| 7 | 7 | ||
| 8 | p > code, li > code, td > code, dd > code { @extend %label; } | 8 | p > code, li > code, td > code, dd > code { @extend %label; } |
| 9 | 9 | ||
| 10 | span.red { color: $textColorRed; } | 10 | span.red { color: var(--textColorRed); } |
| 11 | } | 11 | } |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | .features { | 7 | .features { |
| 8 | float: right; | 8 | float: right; |
| 9 | color: $textColorLight; | 9 | color: var(--textColorLight); |
| 10 | } | 10 | } |
| 11 | } | 11 | } |
| 12 | } | 12 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | ._dojo { | 1 | ._dojo { |
| 2 | @extend %simple; | 2 | @extend %simple; |
| 3 | 3 | ||
| 4 | .jsdoc-inheritance { color: $textColorLight; } | 4 | .jsdoc-inheritance { color: var(--textColorLight); } |
| 5 | } | 5 | } |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | h3 > .access { | 6 | h3 > .access { |
| 7 | float: right; | 7 | float: right; |
| 8 | color: $textColorLight; | 8 | color: var(--textColorLight); |
| 9 | font-weight: normal; | 9 | font-weight: normal; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| @@ -15,6 +15,6 @@ · 3 unmodified lines | |||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | p.github-link { | 17 | p.github-link { |
| 18 | color: $textColorLight; | 18 | color: var(--textColorLight); |
| 19 | } | 19 | } |
| 20 | } | 20 | } |
| @@ -5,5 +5,5 @@ · 4 unmodified lines | |||
| 5 | code.code { @extend %label; } | 5 | code.code { @extend %label; } |
| 6 | .note { @extend %note; } | 6 | .note { @extend %note; } |
| 7 | .warning { @extend %note, %note-red; } | 7 | .warning { @extend %note, %note-red; } |
| 8 | .note .label, .warning .label { font-weight: $boldFontWeight; } | 8 | .note .label, .warning .label { font-weight: var(--boldFontWeight); } |
| 9 | } | 9 | } |
| @@ -32,7 +32,7 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | .toc-list { | 33 | .toc-list { |
| 34 | margin-top: 0; | 34 | margin-top: 0; |
| 35 | font-weight: $boldFontWeight; | 35 | font-weight: var(--boldFontWeight); |
| 36 | 36 | ||
| 37 | > li + li { margin-top: 1em; } | 37 | > li + li { margin-top: 1em; } |
| 38 | > li > ul { font-weight: normal; } | 38 | > li > ul { font-weight: normal; } |
| @@ -48,7 +48,7 @@ · 9 unmodified lines | |||
| 48 | .returns, | 48 | .returns, |
| 49 | .option-type { | 49 | .option-type { |
| 50 | float: right; | 50 | float: right; |
| 51 | font-weight: $boldFontWeight; | 51 | font-weight: var(--boldFontWeight); |
| 52 | margin-left: 1em; | 52 | margin-left: 1em; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| @@ -12,6 +12,6 @@ · 11 unmodified lines | |||
| 12 | .smwtable { width: 100%; } | 12 | .smwtable { width: 100%; } |
| 13 | .smwtable td:nth-last-child(2), .smwtable td:last-child { width: 2.5em; } | 13 | .smwtable td:nth-last-child(2), .smwtable td:last-child { width: 2.5em; } |
| 14 | 14 | ||
| 15 | .cell-green { background: $noteGreenBackground; } | 15 | .cell-green { background: var(--noteGreenBackground); } |
| 16 | .cell-red { background: $noteRedBackground; } | 16 | .cell-red { background: var(--noteRedBackground); } |
| 17 | } | 17 | } |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | > span { | 7 | > span { |
| 8 | display: block; | 8 | display: block; |
| 9 | font-size: 1rem; | 9 | font-size: 1rem; |
| 10 | font-weight: $boldFontWeight; | 10 | font-weight: var(--boldFontWeight); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | ul, ol { | 13 | ul, ol { |
| @@ -30,6 +30,7 @@ · 16 unmodified lines | |||
| 30 | .notice, | 30 | .notice, |
| 31 | .warning, | 31 | .warning, |
| 32 | .overheadIndicator, | 32 | .overheadIndicator, |
| 33 | .blockIndicator, | ||
| 33 | .syntaxbox, // CSS, JavaScript | 34 | .syntaxbox, // CSS, JavaScript |
| 34 | .twopartsyntaxbox, // CSS | 35 | .twopartsyntaxbox, // CSS |
| 35 | .inheritsbox, // JavaScript | 36 | .inheritsbox, // JavaScript |
| @@ -42,7 +43,7 @@ · 6 unmodified lines | |||
| 42 | > .note { | 43 | > .note { |
| 43 | em { | 44 | em { |
| 44 | font-style: normal; | 45 | font-style: normal; |
| 45 | font-weight: $boldFontWeight; | 46 | font-weight: var(--boldFontWeight); |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | > ul { margin: 1em 0; } | 49 | > ul { margin: 1em 0; } |
| @@ -93,7 +94,7 @@ · 44 unmodified lines | |||
| 93 | dt > strong > code, // HTML element attribute | 94 | dt > strong > code, // HTML element attribute |
| 94 | dl > dt > code { // CSS property value, Javascript function argument | 95 | dl > dt > code { // CSS property value, Javascript function argument |
| 95 | font-family: inherit; | 96 | font-family: inherit; |
| 96 | font-weight: $boldFontWeight; | 97 | font-weight: var(--boldFontWeight); |
| 97 | font-size: inherit; | 98 | font-size: inherit; |
| 98 | } | 99 | } |
| 99 | 100 | ||
| @@ -104,4 +105,28 @@ · 4 unmodified lines | |||
| 104 | .cleared { clear: both; } // CSS/box-shadow | 105 | .cleared { clear: both; } // CSS/box-shadow |
| 105 | 106 | ||
| 106 | code > strong { font-weight: normal; } | 107 | code > strong { font-weight: normal; } |
| 108 | |||
| 109 | // Compatibility tablees | ||
| 110 | |||
| 111 | .bc-github-link { | ||
| 112 | float: right; | ||
| 113 | font-size: .75rem; | ||
| 114 | } | ||
| 115 | |||
| 116 | .bc-supports-yes, .bc-supports-yes + dd, .bc-supports-yes + dd + dd { background: var(--noteGreenBackground); } | ||
| 117 | .bc-supports-partial, .bc-supports-partial + dd, .bc-supports-partial + dd + dd { background: var(--noteOrangeBackground); } | ||
| 118 | .bc-supports-no, .bc-supports-no + dd, .bc-supports-no + dd + dd { background: var(--noteRedBackground); } | ||
| 119 | |||
| 120 | .bc-table { | ||
| 121 | min-width: 100%; | ||
| 122 | |||
| 123 | dl { | ||
| 124 | margin: .25rem 0 0; | ||
| 125 | padding: .25rem 0 0; | ||
| 126 | font-size: .75rem; | ||
| 127 | border-top: 1px solid var(--boxBorder); | ||
| 128 | } | ||
| 129 | |||
| 130 | dd { margin: 0; } | ||
| 131 | } | ||
| 107 | } | 132 | } |
| @@ -9,10 +9,10 @@ · 8 unmodified lines | |||
| 9 | dt > code { @extend %label; } | 9 | dt > code { @extend %label; } |
| 10 | 10 | ||
| 11 | .api-heading { overflow: hidden; } | 11 | .api-heading { overflow: hidden; } |
| 12 | .api-heading > code { font-weight: $boldFontWeight; } | 12 | .api-heading > code { font-weight: var(--boldFontWeight); } |
| 13 | .locus, .src-code { float: right; } | 13 | .locus, .src-code { float: right; } |
| 14 | .locus, .type, .src-code { margin-left: .5em; } | 14 | .locus, .type, .src-code { margin-left: .5em; } |
| 15 | h2 .subtext-api { margin-top: .25rem; } | 15 | h2 .subtext-api { margin-top: .25rem; } |
| 16 | .locus, .subtext-api, .subtext-api > code { font-size: .75rem; } | 16 | .locus, .subtext-api, .subtext-api > code { font-size: .75rem; } |
| 17 | .locus, .type { color: $textColorLight; } | 17 | .locus, .type { color: var(--textColorLight); } |
| 18 | } | 18 | } |
| @@ -20,5 +20,8 @@ · 19 unmodified lines | |||
| 20 | margin: 0 0 1em 1em; | 20 | margin: 0 0 1em 1em; |
| 21 | @extend %label; | 21 | @extend %label; |
| 22 | } | 22 | } |
| 23 | |||
| 24 | .srclink { float: right; } | ||
| 25 | details > table { margin: 0; } | ||
| 23 | } | 26 | } |
| 24 | 27 | ||
| @@ -8,7 +8,7 @@ · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | .faint.heading { | 9 | .faint.heading { |
| 10 | font-size: .9em; | 10 | font-size: .9em; |
| 11 | color: $textColorLight; | 11 | color: var(--textColorLight); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | .youtube-video iframe { width: 420px; height: 315px; } | 14 | .youtube-video iframe { width: 420px; height: 315px; } |
| @@ -3,6 +3,6 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | h3 > small { | 4 | h3 > small { |
| 5 | float: right; | 5 | float: right; |
| 6 | color: $textColorLight; | 6 | color: var(--textColorLight); |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | .verinfo { | 14 | .verinfo { |
| 15 | float: right; | 15 | float: right; |
| 16 | font-weight: $boldFontWeight; | 16 | font-weight: var(--boldFontWeight); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | .classsynopsis, | 19 | .classsynopsis, |
| @@ -21,7 +21,7 @@ · 1 unmodified line | |||
| 21 | .description > .methodsynopsis, | 21 | .description > .methodsynopsis, |
| 22 | .description > .fieldsynopsis { @extend %note, %note-blue; } | 22 | .description > .fieldsynopsis { @extend %note, %note-blue; } |
| 23 | 23 | ||
| 24 | .classsynopsisinfo_comment { color: $textColorLight; } | 24 | .classsynopsisinfo_comment { color: var(--textColorLight); } |
| 25 | 25 | ||
| 26 | .classsynopsisinfo_comment, | 26 | .classsynopsisinfo_comment, |
| 27 | .classsynopsis > .constructorsynopsis, | 27 | .classsynopsis > .constructorsynopsis, |
| @@ -16,7 +16,7 @@ · 15 unmodified lines | |||
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | p > code { @extend %label; } | 18 | p > code { @extend %label; } |
| 19 | p.c2 { font-weight: $boldFontWeight; } | 19 | p.c2 { font-weight: var(--boldFontWeight); } |
| 20 | 20 | ||
| 21 | .navfooter > table { width: 100%; } | 21 | .navfooter > table { width: 100%; } |
| 22 | td[align=center] { text-align: center; } | 22 | td[align=center] { text-align: center; } |
| @@ -4,6 +4,6 @@ · 3 unmodified lines | |||
| 4 | // Function headers | 4 | // Function headers |
| 5 | h3.fn > code { | 5 | h3.fn > code { |
| 6 | float: right; | 6 | float: right; |
| 7 | color: $textColorLight; | 7 | color: var(--textColorLight); |
| 8 | } | 8 | } |
| 9 | } | 9 | } |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | .method-description > h2, h3, h4, h5, h6 { font-size: 1em; } | 6 | .method-description > h2, h3, h4, h5, h6 { font-size: 1em; } |
| 7 | 7 | ||
| 8 | .method-heading { | 8 | .method-heading { |
| 9 | font-weight: $boldFontWeight; | 9 | font-weight: var(--boldFontWeight); |
| 10 | @extend %block-label, %label-blue; | 10 | @extend %block-label, %label-blue; |
| 11 | 11 | ||
| 12 | + .method-heading { margin-top: -.5em; } | 12 | + .method-heading { margin-top: -.5em; } |
| @@ -22,7 +22,7 @@ · 9 unmodified lines | |||
| 22 | a.method-click-advice { | 22 | a.method-click-advice { |
| 23 | float: right; | 23 | float: right; |
| 24 | font-size: .75rem; | 24 | font-size: .75rem; |
| 25 | color: $linkColor; | 25 | color: var(--linkColor); |
| 26 | cursor: pointer; | 26 | cursor: pointer; |
| 27 | @extend %user-select-none; | 27 | @extend %user-select-none; |
| 28 | 28 | ||
| @@ -33,19 +33,8 @@ · 4 unmodified lines | |||
| 33 | } | 33 | } |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | .method-description { position: relative; } | ||
| 37 | |||
| 38 | .method-source-code { | 36 | .method-source-code { |
| 39 | display: none; | 37 | display: none; |
| 40 | position: absolute; | ||
| 41 | z-index: 1; | ||
| 42 | top: 0; | ||
| 43 | left: -1em; | ||
| 44 | right: 0; | ||
| 45 | background: rgba($contentBackground, .95); | ||
| 46 | box-shadow: 0 1em 1em 1em $contentBackground; | ||
| 47 | |||
| 48 | > pre { margin: 0; } | ||
| 49 | } | 38 | } |
| 50 | 39 | ||
| 51 | // Rails guides | 40 | // Rails guides |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | @extend %simple; | 2 | @extend %simple; |
| 3 | 3 | ||
| 4 | .deprecated { @extend %note, %note-orange; } | 4 | .deprecated { @extend %note, %note-orange; } |
| 5 | .deprecatedTitle { font-weight: $boldFontWeight; } | 5 | .deprecatedTitle { font-weight: var(--boldFontWeight); } |
| 6 | 6 | ||
| 7 | span.platform { float: right; } | 7 | span.platform { float: right; } |
| 8 | span.propType, span.platform { font-weight: normal; } | 8 | span.propType, span.platform { font-weight: normal; } |
| @@ -14,7 +14,7 @@ · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | .args { | 15 | .args { |
| 16 | font-size: .75rem; | 16 | font-size: .75rem; |
| 17 | color: $textColorLight; | 17 | color: var(--textColorLight); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | // Others | 20 | // Others |
| @@ -35,7 +35,7 @@ · 14 unmodified lines | |||
| 35 | > .prompt { | 35 | > .prompt { |
| 36 | float: left; | 36 | float: left; |
| 37 | margin-right: .5em; | 37 | margin-right: .5em; |
| 38 | color: $textColorLight; | 38 | color: var(--textColorLight); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | > code { | 41 | > code { |
| @@ -10,6 +10,6 @@ · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | > h1, > h2, > h3, > h4, > h5 { | 11 | > h1, > h2, > h3, > h4, > h5 { |
| 12 | margin: 0; | 12 | margin: 0; |
| 13 | font-family: $baseFont; | 13 | font-family: var(--baseFont); |
| 14 | } | 14 | } |
| 15 | } | 15 | } |
| @@ -3,9 +3,18 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | h4 { @extend %block-label; } | 4 | h4 { @extend %block-label; } |
| 5 | .docblock { margin-left: 1em; } | 5 | .docblock { margin-left: 1em; } |
| 6 | div.information, div.important-traits { | ||
| 7 | @extend %note; | ||
| 8 | |||
| 9 | > pre { margin: .5rem 0; } | ||
| 10 | } | ||
| 6 | 11 | ||
| 7 | div.stability { margin-bottom: 1em; } | 12 | div.stability { margin-bottom: 1em; } |
| 8 | em.stab, span.stab { @extend %label; } | 13 | em.stab, span.stab { @extend %label; } |
| 9 | em.stab.unstable, span.stab.unstable { @extend %label-orange; } | 14 | em.stab.unstable, span.stab.unstable { @extend %label-orange; } |
| 10 | .since, .out-of-band { float: right; } | 15 | .out-of-band { float: right; } |
| 16 | .since, .srclink { | ||
| 17 | float: right; | ||
| 18 | margin-left: .5rem; | ||
| 19 | } | ||
| 11 | } | 20 | } |
| @@ -17,34 +17,4 @@ · 16 unmodified lines | |||
| 17 | blockquote > h4, blockquote > h5 { margin-top: .25rem; } | 17 | blockquote > h4, blockquote > h5 { margin-top: .25rem; } |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | ._apache_pig, | 20 | ._simple { @extend %simple; } |
| 21 | ._bower, | ||
| 22 | ._chai, | ||
| 23 | ._codeceptjs, | ||
| 24 | ._docker, | ||
| 25 | ._electron, | ||
| 26 | ._fish, | ||
| 27 | ._flow, | ||
| 28 | ._gnu, | ||
| 29 | ._grunt, | ||
| 30 | ._haxe, | ||
| 31 | ._immutable, | ||
| 32 | ._influxdata, | ||
| 33 | ._jasmine, | ||
| 34 | ._jest, | ||
| 35 | ._less, | ||
| 36 | ._lodash, | ||
| 37 | ._marionette, | ||
| 38 | ._markdown, | ||
| 39 | ._mocha, | ||
| 40 | ._mongoose, | ||
| 41 | ._nim, | ||
| 42 | ._redux, | ||
| 43 | ._requirejs, | ||
| 44 | ._simple, | ||
| 45 | ._typescript, | ||
| 46 | ._vagrant, | ||
| 47 | ._vulkan, | ||
| 48 | ._yarn { | ||
| 49 | @extend %simple; | ||
| 50 | } | ||
| @@ -14,7 +14,7 @@ · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | .versionmodified, span.title, .topic-title { | 15 | .versionmodified, span.title, .topic-title { |
| 16 | display: block; | 16 | display: block; |
| 17 | font-weight: $boldFontWeight; | 17 | font-weight: var(--boldFontWeight); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | p > code, li > code, dd > code, .docutils > dt > code { @extend %label; } | 20 | p > code, li > code, dd > code, .docutils > dt > code { @extend %label; } |
| @@ -26,7 +26,7 @@ · 5 unmodified lines | |||
| 26 | .admonition-title { | 26 | .admonition-title { |
| 27 | float: left; | 27 | float: left; |
| 28 | margin: 0 .5em 0 0; | 28 | margin: 0 .5em 0 0; |
| 29 | font-weight: $boldFontWeight; | 29 | font-weight: var(--boldFontWeight); |
| 30 | 30 | ||
| 31 | &:after { content: ':'; } | 31 | &:after { content: ':'; } |
| 32 | } | 32 | } |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | .admonition.tip { @extend %note-green; } | 6 | .admonition.tip { @extend %note-green; } |
| 7 | .admonition-title { | 7 | .admonition-title { |
| 8 | margin: 0 0 .25rem; | 8 | margin: 0 0 .25rem; |
| 9 | font-weight: $boldFontWeight; | 9 | font-weight: var(--boldFontWeight); |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | code { @extend %label; } | 12 | code { @extend %label; } |
| @@ -24,7 +24,7 @@ · 23 unmodified lines | |||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | tr.current { | 26 | tr.current { |
| 27 | font-weight: $boldFontWeight; | 27 | font-weight: var(--boldFontWeight); |
| 28 | font-size: 1rem; | 28 | font-size: 1rem; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | ._yard { | 1 | ._yard { |
| 2 | @extend %simple; | 2 | @extend %simple; |
| 3 | 3 | ||
| 4 | .tag_title { font-weight: $boldFontWeight; } | 4 | .tag_title { font-weight: var(--boldFontWeight); } |
| 5 | } | 5 | } |
| @@ -3,6 +3,6 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | .detail-header-tag, .detailHeaderTag { | 4 | .detail-header-tag, .detailHeaderTag { |
| 5 | float: right; | 5 | float: right; |
| 6 | color: $textColorLight; | 6 | color: var(--textColorLight); |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| @@ -0,0 +1,23 @@ | |||
| 1 | Adding a documentation may look like a daunting task but once you get the hang of it, it's actually quite simple. Don't hesitate to ask for help [in Gitter](https://gitter.im/FreeCodeCamp/DevDocs) if you ever get stuck. | ||
| 2 | |||
| 3 | **Note:** please read the [contributing guidelines](../.github/CONTRIBUTING.md) before submitting a new documentation. | ||
| 4 | |||
| 5 | 1. Create a subclass of `Docs::UrlScraper` or `Docs::FileScraper` in the `lib/docs/scrapers/` directory. Its name should be the [PascalCase](http://api.rubyonrails.org/classes/String.html#method-i-camelize) equivalent of the filename (e.g. `my_doc` → `MyDoc`) | ||
| 6 | 2. Add the appropriate class attributes and filter options (see the [Scraper Reference](./scraper-reference.md) page). | ||
| 7 | 3. Check that the scraper is listed in `thor docs:list`. | ||
| 8 | 4. Create filters specific to the scraper in the `lib/docs/filters/[my_doc]/` directory and add them to the class's [filter stacks](./scraper-reference.md#filter-stacks). You may create any number of filters but will need at least the following two: | ||
| 9 | * A [`CleanHtml`](./filter-reference.md#cleanhtmlfilter) filter whose task is to clean the HTML markup (e.g. adding `id` attributes to headings) and remove everything superfluous and/or nonessential. | ||
| 10 | * An [`Entries`](./filter-reference.md#entriesfilter) filter whose task is to determine the pages' metadata (the list of entries, each with a name, type and path). | ||
| 11 | The [Filter Reference](./filter-reference.md) page has all the details about filters. | ||
| 12 | 5. Using the `thor docs:page [my_doc] [path]` command, check that the scraper works properly. Files will appear in the `public/docs/[my_doc]/` directory (but not inside the app as the command doesn't touch the index). `path` in this case refers to either the remote path (if using `UrlScraper`) or the local path (if using `FileScraper`). | ||
| 13 | 6. Generate the full documentation using the `thor docs:generate [my_doc] --force` command. Additionally, you can use the `--verbose` option to see which files are being created/updated/deleted (useful to see what changed since the last run), and the `--debug` option to see which URLs are being requested and added to the queue (useful to pin down which page adds unwanted URLs to the queue). | ||
| 14 | 7. Start the server, open the app, enable the documentation, and see how everything plays out. | ||
| 15 | 8. Tweak the scraper/filters and repeat 5) and 6) until the pages and metadata are ok. | ||
| 16 | 9. To customize the pages' styling, create an SCSS file in the `assets/stylesheets/pages/` directory and import it in both `application.css.scss` AND `application-dark.css.scss`. Both the file and CSS class should be named `_[type]` where [type] is equal to the scraper's `type` attribute (documentations with the same type share the same custom CSS and JS). Setting the type to `simple` will apply the general styling rules in `assets/stylesheets/pages/_simple.scss`, which can be used for documentations where little to no CSS changes are needed. | ||
| 17 | 10. To add syntax highlighting or execute custom JavaScript on the pages, create a file in the `assets/javascripts/views/pages/` directory (take a look at the other files to see how it works). | ||
| 18 | 11. Add the documentation's icon in the `public/icons/docs/[my_doc]/` directory, in both 16x16 and 32x32-pixels formats. It'll be added to the icon spritesheet after your pull request is merged. | ||
| 19 | 12. Add the documentation's copyright details to the list in `assets/javascripts/templates/pages/about_tmpl.coffee`. This is the data shown in the table on the [about](https://devdocs.io/about) page, and is ordered alphabetically. Simply copying an existing item, placing it in the right slot and updating the values to match the new scraper will do the job. | ||
| 20 | |||
| 21 | If the documentation includes more than a few hundreds pages and is available for download, try to scrape it locally (e.g. using `FileScraper`). It'll make the development process much faster and avoids putting too much load on the source site. (It's not a problem if your scraper is coupled to your local setup, just explain how it works in your pull request.) | ||
| 22 | |||
| 23 | Finally, try to document your scraper and filters' behavior as much as possible using comments (e.g. why some URLs are ignored, HTML markup removed, metadata that way, etc.). It'll make updating the documentation much easier. | ||
| @@ -0,0 +1,224 @@ | |||
| 1 | **Table of contents:** | ||
| 2 | |||
| 3 | * [Overview](#overview) | ||
| 4 | * [Instance methods](#instance-methods) | ||
| 5 | * [Core filters](#core-filters) | ||
| 6 | * [Custom filters](#custom-filters) | ||
| 7 | - [CleanHtmlFilter](#cleanhtmlfilter) | ||
| 8 | - [EntriesFilter](#entriesfilter) | ||
| 9 | |||
| 10 | ## Overview | ||
| 11 | |||
| 12 | Filters use the [HTML::Pipeline](https://github.com/jch/html-pipeline) library. They take an HTML string or [Nokogiri](http://nokogiri.org/) node as input, optionally perform modifications and/or extract information from it, and then outputs the result. Together they form a pipeline where each filter hands its output to the next filter's input. Every documentation page passes through this pipeline before being copied on the local filesystem. | ||
| 13 | |||
| 14 | Filters are subclasses of the [`Docs::Filter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/core/filter.rb) class and require a `call` method. A basic implementation looks like this: | ||
| 15 | |||
| 16 | ```ruby | ||
| 17 | module Docs | ||
| 18 | class CustomFilter < Filter | ||
| 19 | def call | ||
| 20 | doc | ||
| 21 | end | ||
| 22 | end | ||
| 23 | end | ||
| 24 | ``` | ||
| 25 | |||
| 26 | Filters which manipulate the Nokogiri node object (`doc` and related methods) are _HTML filters_ and must not manipulate the HTML string (`html`). Vice-versa, filters which manipulate the string representation of the document are _text filters_ and must not manipulate the Nokogiri node object. The two types are divided into two stacks within the scrapers. These stacks are then combined into a pipeline that calls the HTML filters before the text filters (more details [here](./scraper-reference.md#filter-stacks)). This is to avoid parsing the document multiple times. | ||
| 27 | |||
| 28 | The `call` method must return either `doc` or `html`, depending on the type of filter. | ||
| 29 | |||
| 30 | ## Instance methods | ||
| 31 | |||
| 32 | * `doc` [Nokogiri::XML::Node] | ||
| 33 | The Nokogiri representation of the container element. | ||
| 34 | See [Nokogiri's API docs](http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/Node) for the list of available methods. | ||
| 35 | |||
| 36 | * `html` [String] | ||
| 37 | The string representation of the container element. | ||
| 38 | |||
| 39 | * `context` [Hash] **(frozen)** | ||
| 40 | The scraper's `options` along with a few additional keys: `:base_url`, `:root_url`, `:root_page` and `:url`. | ||
| 41 | |||
| 42 | * `result` [Hash] | ||
| 43 | Used to store the page's metadata and pass back information to the scraper. | ||
| 44 | Possible keys: | ||
| 45 | |||
| 46 | - `:path` — the page's normalized path | ||
| 47 | - `:store_path` — the path where the page will be stored (equal to `:path` with `.html` at the end) | ||
| 48 | - `:internal_urls` — the list of distinct internal URLs found within the page | ||
| 49 | - `:entries` — the [`Entry`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/core/models/entry.rb) objects to add to the index | ||
| 50 | |||
| 51 | * `css`, `at_css`, `xpath`, `at_xpath` | ||
| 52 | Shortcuts for `doc.css`, `doc.xpath`, etc. | ||
| 53 | |||
| 54 | * `base_url`, `current_url`, `root_url` [Docs::URL] | ||
| 55 | Shortcuts for `context[:base_url]`, `context[:url]`, and `context[:root_url]` respectively. | ||
| 56 | |||
| 57 | * `root_path` [String] | ||
| 58 | Shortcut for `context[:root_path]`. | ||
| 59 | |||
| 60 | * `subpath` [String] | ||
| 61 | The sub-path from the base URL of the current URL. | ||
| 62 | _Example: if `base_url` equals `example.com/docs` and `current_url` equals `example.com/docs/file?raw`, the returned value is `/file`._ | ||
| 63 | |||
| 64 | * `slug` [String] | ||
| 65 | The `subpath` removed of any leading slash or `.html` extension. | ||
| 66 | _Example: if `subpath` equals `/dir/file.html`, the returned value is `dir/file`._ | ||
| 67 | |||
| 68 | * `root_page?` [Boolean] | ||
| 69 | Returns `true` if the current page is the root page. | ||
| 70 | |||
| 71 | * `initial_page?` [Boolean] | ||
| 72 | Returns `true` if the current page is the root page or its subpath is one of the scraper's `initial_paths`. | ||
| 73 | |||
| 74 | ## Core filters | ||
| 75 | |||
| 76 | * [`ContainerFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/container.rb) — changes the root node of the document (remove everything outside) | ||
| 77 | * [`CleanHtmlFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/clean_html.rb) — removes HTML comments, `<script>`, `<style>`, etc. | ||
| 78 | * [`NormalizeUrlsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/normalize_urls.rb) — replaces all URLs with their fully qualified counterpart | ||
| 79 | * [`InternalUrlsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/internal_urls.rb) — detects internal URLs (the ones to scrape) and replaces them with their unqualified, relative counterpart | ||
| 80 | * [`NormalizePathsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/normalize_paths.rb) — makes the internal paths consistent (e.g. always end with `.html`) | ||
| 81 | * [`CleanLocalUrlsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/clean_local_urls.rb) — removes links, iframes and images pointing to localhost (`FileScraper` only) | ||
| 82 | * [`InnerHtmlFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/inner_html.rb) — converts the document to a string | ||
| 83 | * [`CleanTextFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/clean_text.rb) — removes empty nodes | ||
| 84 | * [`AttributionFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/attribution.rb) — appends the license info and link to the original document | ||
| 85 | * [`TitleFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/title.rb) — prepends the document with a title (disabled by default) | ||
| 86 | * [`EntriesFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/entries.rb) — abstract filter for extracting the page's metadata | ||
| 87 | |||
| 88 | ## Custom filters | ||
| 89 | |||
| 90 | Scrapers can have any number of custom filters but require at least the two described below. | ||
| 91 | |||
| 92 | **Note:** filters are located in the [`lib/docs/filters`](https://github.com/Thibaut/devdocs/tree/master/lib/docs/filters/) directory. The class's name must be the [CamelCase](http://api.rubyonrails.org/classes/String.html#method-i-camelize) equivalent of the filename. | ||
| 93 | |||
| 94 | ### `CleanHtmlFilter` | ||
| 95 | |||
| 96 | The `CleanHtml` filter is tasked with cleaning the HTML markup where necessary and removing anything superfluous or nonessential. Only the core documentation should remain at the end. | ||
| 97 | |||
| 98 | Nokogiri's many jQuery-like methods make it easy to search and modify elements — see the [API docs](http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/Node). | ||
| 99 | |||
| 100 | Here's an example implementation that covers the most common use-cases: | ||
| 101 | |||
| 102 | ```ruby | ||
| 103 | module Docs | ||
| 104 | class MyScraper | ||
| 105 | class CleanHtmlFilter < Filter | ||
| 106 | def call | ||
| 107 | css('hr').remove | ||
| 108 | css('#changelog').remove if root_page? | ||
| 109 | |||
| 110 | # Set id attributes on <h3> instead of an empty <a> | ||
| 111 | css('h3').each do |node| | ||
| 112 | node['id'] = node.at_css('a')['id'] | ||
| 113 | end | ||
| 114 | |||
| 115 | # Make proper table headers | ||
| 116 | css('td.header').each do |node| | ||
| 117 | node.name = 'th' | ||
| 118 | end | ||
| 119 | |||
| 120 | # Remove code highlighting | ||
| 121 | css('pre').each do |node| | ||
| 122 | node.content = node.content | ||
| 123 | end | ||
| 124 | |||
| 125 | doc | ||
| 126 | end | ||
| 127 | end | ||
| 128 | end | ||
| 129 | end | ||
| 130 | ``` | ||
| 131 | |||
| 132 | **Notes:** | ||
| 133 | |||
| 134 | * Empty elements will be automatically removed by the core `CleanTextFilter` later in the pipeline's execution. | ||
| 135 | * Although the goal is to end up with a clean version of the page, try to keep the number of modifications to a minimum, so as to make the code easier to maintain. Custom CSS is the preferred way of normalizing the pages (except for hiding stuff which should always be done by removing the markup). | ||
| 136 | * Try to document your filter's behavior as much as possible, particularly modifications that apply only to a subset of pages. It'll make updating the documentation easier. | ||
| 137 | |||
| 138 | ### `EntriesFilter` | ||
| 139 | |||
| 140 | The `Entries` filter is responsible for extracting the page's metadata, represented by a set of _entries_, each with a name, type and path. | ||
| 141 | |||
| 142 | The following two models are used under the hood to represent the metadata: | ||
| 143 | |||
| 144 | * [`Entry(name, type, path)`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/core/models/entry.rb) | ||
| 145 | * [`Type(name, slug, count)`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/core/models/type.rb) | ||
| 146 | |||
| 147 | Each scraper must implement its own `EntriesFilter` by subclassing the [`Docs::EntriesFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/entries.rb) class. The base class already implements the `call` method and includes four methods which the subclasses can override: | ||
| 148 | |||
| 149 | * `get_name` [String] | ||
| 150 | The name of the default entry (aka. the page's name). | ||
| 151 | It is usually guessed from the `slug` (documented above) or by searching the HTML markup. | ||
| 152 | **Default:** modified version of `slug` (underscores are replaced with spaces and forward slashes with dots) | ||
| 153 | |||
| 154 | * `get_type` [String] | ||
| 155 | The type of the default entry (aka. the page's type). | ||
| 156 | Entries without a type can be searched for but won't be listed in the app's sidebar (unless no other entries have a type). | ||
| 157 | **Default:** `nil` | ||
| 158 | |||
| 159 | * `include_default_entry?` [Boolean] | ||
| 160 | Whether to include the default entry. | ||
| 161 | Used when a page consists of multiple entries (returned by `additional_entries`) but doesn't have a name/type of its own, or to remove a page from the index (if it has no additional entries), in which case it won't be copied on the local filesystem and any link to it in the other pages will be broken (as explained on the [Scraper Reference](./scraper-reference.md) page, this is used to keep the `:skip` / `:skip_patterns` options to a maintainable size, or if the page includes links that can't reached from anywhere else). | ||
| 162 | **Default:** `true` | ||
| 163 | |||
| 164 | * `additional_entries` [Array] | ||
| 165 | The list of additional entries. | ||
| 166 | Each entry is represented by an Array of three attributes: its name, fragment identifier, and type. The fragment identifier refers to the `id` attribute of the HTML element (usually a heading) that the entry relates to. It is combined with the page's path to become the entry's path. If absent or `nil`, the page's path is used. If the type is absent or `nil`, the default `type` is used. | ||
| 167 | Example: `[ ['One'], ['Two', 'id'], ['Three', nil, 'type'] ]` adds three additional entries, the first one named "One" with the default path and type, the second one named "Two" with the URL fragment "#id" and the default type, and the third one named "Three" with the default path and the type "type". | ||
| 168 | The list is usually constructed by running through the markup. Exceptions can also be hard-coded for specific pages. | ||
| 169 | **Default:** `[]` | ||
| 170 | |||
| 171 | The following accessors are also available, but must not be overridden: | ||
| 172 | |||
| 173 | * `name` [String] | ||
| 174 | Memoized version of `get_name` (`nil` for the root page). | ||
| 175 | |||
| 176 | * `type` [String] | ||
| 177 | Memoized version of `get_type` (`nil` for the root page). | ||
| 178 | |||
| 179 | **Notes:** | ||
| 180 | |||
| 181 | * Leading and trailing whitespace is automatically removed from names and types. | ||
| 182 | * Names must be unique across the documentation and as short as possible (ideally less than 30 characters). Whenever possible, methods should be differentiated from properties by appending `()`, and instance methods should be differentiated from class methods using the `Class#method` or `object.method` conventions. | ||
| 183 | * You can call `name` from `get_type` or `type` from `get_name` but doing both will cause a stack overflow (i.e. you can infer the name from the type or the type from the name, but you can't do both at the same time). Don't call `get_name` or `get_type` directly as their value isn't memoized. | ||
| 184 | * The root page has no name and no type (both are `nil`). `get_name` and `get_type` won't get called with the page (but `additional_entries` will). | ||
| 185 | * `Docs::EntriesFilter` is an _HTML filter_. It must be added to the scraper's `html_filters` stack. | ||
| 186 | * Try to document the code as much as possible, particularly the special cases. It'll make updating the documentation easier. | ||
| 187 | |||
| 188 | **Example:** | ||
| 189 | |||
| 190 | ```ruby | ||
| 191 | module Docs | ||
| 192 | class MyScraper | ||
| 193 | class EntriesFilter < Docs::EntriesFilter | ||
| 194 | def get_name | ||
| 195 | node = at_css('h1') | ||
| 196 | result = node.content.strip | ||
| 197 | result << ' event' if type == 'Events' | ||
| 198 | result << '()' if node['class'].try(:include?, 'function') | ||
| 199 | result | ||
| 200 | end | ||
| 201 | |||
| 202 | def get_type | ||
| 203 | object, method = *slug.split('/') | ||
| 204 | method ? object : 'Miscellaneous' | ||
| 205 | end | ||
| 206 | |||
| 207 | def additional_entries | ||
| 208 | return [] if root_page? | ||
| 209 | |||
| 210 | css('h2').map do |node| | ||
| 211 | [node.content, node['id']] | ||
| 212 | end | ||
| 213 | end | ||
| 214 | |||
| 215 | def include_default_entry? | ||
| 216 | !at_css('.obsolete') | ||
| 217 | end | ||
| 218 | end | ||
| 219 | end | ||
| 220 | end | ||
| 221 | ``` | ||
| 222 | |||
| 223 | |||
| 224 | return [[Home]] | ||
| @@ -0,0 +1,102 @@ | |||
| 1 | # Maintainer's Guide | ||
| 2 | |||
| 3 | This document is intended for [DevDocs maintainers](#list-of-maintainers). | ||
| 4 | |||
| 5 | ## Merging pull requests | ||
| 6 | |||
| 7 | - PRs should be approved by at least one maintainer before being merged. | ||
| 8 | |||
| 9 | - PRs that add or update documentations should always be merged locally, and the app deployed, before the merge is pushed to GitHub. | ||
| 10 | |||
| 11 | This workflow is required because there is a dependency between the local and production environments. The `thor docs:download` command downloads documentations from production files uploaded by the `thor docs:upload` command. If a PR adding a new documentation is merged and pushed to GitHub before the files have been uploaded to production, the `thor docs:download` will fail for the new documentation and the docker container will not build properly until the new documentation is deployed to production. | ||
| 12 | |||
| 13 | ## Updating docs | ||
| 14 | |||
| 15 | The process for updating docs is as follow: | ||
| 16 | |||
| 17 | - Make version/release changes in the scraper file. | ||
| 18 | - If needed, update the copyright notice of the documentation in the scraper file (`options[:attribution]`) and the about page (`about_tmpl.coffee`). The copyright notice must be the same as the one on the original documentation. | ||
| 19 | - Run `thor docs:generate`. | ||
| 20 | - Make sure the documentation still works well. The `thor docs:generate` command outputs a summary of the changes, which helps identifying issues (e.g. deleted files) and new pages to check out in the app. Verify locally that everything works, especially the files that were created (if any), and that the categorization of entries is still good. Often, updates will require code changes to tweak some new markup in the source website or categorize new entries. | ||
| 21 | - Commit the changes (protip: use the `thor docs:commit` command documented below). | ||
| 22 | - Optional: do more updates. | ||
| 23 | - Run `thor docs:upload` (documented below). | ||
| 24 | - Push to GitHub to [deploy the app](#deploying-devdocs) and verify that everything works in production. | ||
| 25 | - Run `thor docs:clean` (documented below). | ||
| 26 | |||
| 27 | Note: changes to `public/docs/docs.json` should never be committed. This file reflects which documentations have been downloaded or generated locally, which is always none on a fresh `git clone`. | ||
| 28 | |||
| 29 | ## Setup requirements | ||
| 30 | |||
| 31 | In order to deploy DevDocs, you must: | ||
| 32 | |||
| 33 | - be given access to Heroku, [configure the Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) on your computer, and familiarize yourself with Heroku's UI and CLI, as well as that of New Relic (accessible through [the Heroku dashboard](https://dashboard.heroku.com/apps/devdocs)). | ||
| 34 | |||
| 35 | - be given access to DevDocs's [Sentry instance](https://sentry.io/devdocs/devdocs-js/) (for JS error tracking) and familiarize yourself with its UI. | ||
| 36 | |||
| 37 | - be provided with DevDocs's S3 credentials, and install (`brew install awscli` on macOS) and [configure](https://docs.aws.amazon.com/cli/latest/reference/configure/) the AWS CLI on your computer. The configuration must add a named profile called "devdocs": | ||
| 38 | ``` | ||
| 39 | aws configure --profile devdocs | ||
| 40 | ``` | ||
| 41 | |||
| 42 | - be provided with DevDocs's MaxCDN push zone credentials, and add them to your `.bash_profile` as such: | ||
| 43 | ``` | ||
| 44 | export DEVDOCS_DL_USERNAME="username" | ||
| 45 | export DEVDOCS_DL_PASSWORD="password" | ||
| 46 | ``` | ||
| 47 | |||
| 48 | ## Thor commands | ||
| 49 | |||
| 50 | In addition to the [publicly-documented commands](https://github.com/freeCodeCamp/devdocs#available-commands), the following commands are aimed at DevDocs maintainers: | ||
| 51 | |||
| 52 | - `thor docs:package` | ||
| 53 | |||
| 54 | Generates packages for one or more documentations. Those packages are intended to be uploaded to DevDocs's MaxCDN push zone by maintainers via the `thor docs:upload` command, and downloaded by users via the `thor docs:download` command. | ||
| 55 | |||
| 56 | Versions can be specified as such: `thor docs:package rails@5.2 node@10\ LTS`. | ||
| 57 | |||
| 58 | Packages can also be automatically generated during the scraping process by passing the `--package` option to `thor docs:generate`. | ||
| 59 | |||
| 60 | - `thor docs:upload` | ||
| 61 | |||
| 62 | This command does two operations: | ||
| 63 | |||
| 64 | 1. sync the files for the specified documentations with S3 (used by the Heroku app); | ||
| 65 | 2. upload the documentations' packages to DevDocs's MaxCDN push zone (used by the `thor docs:download` command). | ||
| 66 | |||
| 67 | For the command to work, you must have the AWS CLI and MaxCDN credentials configured as indicated above. | ||
| 68 | |||
| 69 | **Important:** the app should always be deployed immediately after this command has finished running. Do not run this command unless you are able and ready to deploy DevDocs. | ||
| 70 | |||
| 71 | To upload all documentations that are packaged on your computer, run `thor docs:upload --packaged`. | ||
| 72 | To test your configuration and the effect of this command without uploading anything, pass the `--dryrun` option. | ||
| 73 | |||
| 74 | - `thor docs:commit` | ||
| 75 | |||
| 76 | Shortcut command to create a Git commit for a given documentation once it has been updated. Scraper and `assets/` file changes will be committed. The commit message will include the most recent version that the documentation was updated to. If some files were missed by the commit, use `git commit --amend` to add them to the commit. The command may be run before `thor docs:upload` is run, but the commit should not be pushed to GitHub before the files have been uploaded and the app deployed. | ||
| 77 | |||
| 78 | - `thor docs:clean` | ||
| 79 | |||
| 80 | Shortcut command to delete all package files (once uploaded via `thor docs:upload`, they are not needed anymore). | ||
| 81 | |||
| 82 | ## Deploying DevDocs | ||
| 83 | |||
| 84 | Once docs have been uploaded via `thor docs:upload` (if applicable), you can push to the DevDocs master branch (or merge the PR containing the updates). If the Travis build succeeds, the Heroku application will be deployed automatically. | ||
| 85 | |||
| 86 | - If you're deploying documentation updates, verify that the documentations work properly once the deploy is done. Keep in mind that you'll need to wait a few seconds for the service worker to finish caching the new assets. You should see a "DevDocs has been updated" notification appear when the caching is done, after which you need to refresh the page to see the changes. | ||
| 87 | - If you're deploying frontend changes, monitor [Sentry](https://sentry.io/devdocs/devdocs-js/) for new JS errors once the deploy is done. | ||
| 88 | - If you're deploying server changes, monitor New Relic (accessible through [the Heroku dashboard](https://dashboard.heroku.com/apps/devdocs)) for Ruby exceptions and throughput or response time changes once the deploy is done. | ||
| 89 | |||
| 90 | If any issue arises, run `heroku rollback` to rollback to the previous version of the app (this can also be done via Heroku's UI). Note that this will not revert changes made to documentation files that were uploaded via `thor docs:upload`. Try and fix the issue as quickly as possible, then re-deploy the app. Reach out to other maintainers if you need help. | ||
| 91 | |||
| 92 | If this is your first deploy, make sure another maintainer is around to assist. | ||
| 93 | |||
| 94 | ## List of maintainers | ||
| 95 | |||
| 96 | - [Jed Fox](https://github.com/j-f1) | ||
| 97 | - [Jasper van Merle](https://github.com/jmerle) | ||
| 98 | - [Ahmad Abdolsaheb](https://github.com/ahmadabdolsaheb) | ||
| 99 | - [Mrugesh Mohapatra](https://github.com/raisedadead) | ||
| 100 | - [Thibaut Courouble](https://github.com/thibaut) | ||
| 101 | |||
| 102 | Interested in helping maintain DevDocs? Come talk to us on [Gitter](https://gitter.im/FreeCodeCamp/DevDocs) :) | ||
| @@ -0,0 +1,186 @@ | |||
| 1 | **Table of contents:** | ||
| 2 | |||
| 3 | * [Overview](#overview) | ||
| 4 | * [Configuration](#configuration) | ||
| 5 | - [Attributes](#attributes) | ||
| 6 | - [Filter stacks](#filter-stacks) | ||
| 7 | - [Filter options](#filter-options) | ||
| 8 | |||
| 9 | ## Overview | ||
| 10 | |||
| 11 | Starting from a root URL, scrapers recursively follow links that match a set of rules, passing each valid response through a chain of filters before writing the file on the local filesystem. They also create an index of the pages' metadata (determined by one filter), which is dumped into a JSON file at the end. | ||
| 12 | |||
| 13 | Scrapers rely on the following libraries: | ||
| 14 | |||
| 15 | * [Typhoeus](https://github.com/typhoeus/typhoeus) for making HTTP requests | ||
| 16 | * [HTML::Pipeline](https://github.com/jch/html-pipeline) for applying filters | ||
| 17 | * [Nokogiri](http://nokogiri.org/) for parsing HTML | ||
| 18 | |||
| 19 | There are currently two kinds of scrapers: [`UrlScraper`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/core/scrapers/url_scraper.rb) which downloads files via HTTP and [`FileScraper`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/core/scrapers/file_scraper.rb) which reads them from the local filesystem. They function almost identically (both use URLs), except that `FileScraper` substitutes the base URL with a local path before reading a file. `FileScraper` uses the placeholder `localhost` base URL by default and includes a filter to remove any URL pointing to it at the end. | ||
| 20 | |||
| 21 | To be processed, a response must meet the following requirements: | ||
| 22 | |||
| 23 | * 200 status code | ||
| 24 | * HTML content type | ||
| 25 | * effective URL (after redirection) contained in the base URL (explained below) | ||
| 26 | |||
| 27 | (`FileScraper` only checks if the file exists and is not empty.) | ||
| 28 | |||
| 29 | Each URL is requested only once (case-insensitive). | ||
| 30 | |||
| 31 | ## Configuration | ||
| 32 | |||
| 33 | Configuration is done via class attributes and divided into three main categories: | ||
| 34 | |||
| 35 | * [Attributes](#attributes) — essential information such as name, version, URL, etc. | ||
| 36 | * [Filter stacks](#filter-stacks) — the list of filters that will be applied to each page. | ||
| 37 | * [Filter options](#filter-options) — the options passed to said filters. | ||
| 38 | |||
| 39 | **Note:** scrapers are located in the [`lib/docs/scrapers`](https://github.com/Thibaut/devdocs/tree/master/lib/docs/scrapers/) directory. The class's name must be the [CamelCase](http://api.rubyonrails.org/classes/String.html#method-i-camelize) equivalent of the filename. | ||
| 40 | |||
| 41 | ### Attributes | ||
| 42 | |||
| 43 | * `name` [String] | ||
| 44 | Must be unique. | ||
| 45 | Defaults to the class's name. | ||
| 46 | |||
| 47 | * `slug` [String] | ||
| 48 | Must be unique, lowercase, and not include dashes (underscores are ok). | ||
| 49 | Defaults to `name` lowercased. | ||
| 50 | |||
| 51 | * `type` [String] **(required, inherited)** | ||
| 52 | Defines the CSS class name (`_[type]`) and custom JavaScript class (`app.views.[Type]Page`) that will be added/loaded on each page. Documentations sharing a similar structure (e.g. generated with the same tool or originating from the same website) should use the same `type` to avoid duplicating the CSS and JS. | ||
| 53 | Must include lowercase letters only. | ||
| 54 | |||
| 55 | * `release` [String] **(required)** | ||
| 56 | The version of the software at the time the scraper was last run. This is only informational and doesn't affect the scraper's behavior. | ||
| 57 | |||
| 58 | * `base_url` [String] **(required in `UrlScraper`)** | ||
| 59 | The documents' location. Only URLs _inside_ the `base_url` will be scraped. "inside" more or less means "starting with" except that `/docs` is outside `/doc` (but `/doc/` is inside). | ||
| 60 | Defaults to `localhost` in `FileScraper`. _(Note: any iframe, image, or skipped link pointing to localhost will be removed by the `CleanLocalUrls` filter; the value should be overridden if the documents are available online.)_ | ||
| 61 | Unless `root_path` is set, the root/initial URL is equal to `base_url`. | ||
| 62 | |||
| 63 | * `root_path` [String] **(inherited)** | ||
| 64 | The path from the `base_url` of the root URL. | ||
| 65 | |||
| 66 | * `initial_paths` [Array] **(inherited)** | ||
| 67 | A list of paths (from the `base_url`) to add to the initial queue. Useful for scraping isolated documents. | ||
| 68 | Defaults to `[]`. _(Note: the `root_path` is added to the array at runtime.)_ | ||
| 69 | |||
| 70 | * `dir` [String] **(required, `FileScraper` only)** | ||
| 71 | The absolute path where the files are located on the local filesystem. | ||
| 72 | _Note: `FileScraper` works exactly like `UrlScraper` (manipulating the same kind of URLs) except that it substitutes `base_url` with `dir` in order to read files instead of making HTTP requests._ | ||
| 73 | |||
| 74 | * `params` [Hash] **(inherited, `UrlScraper` only)** | ||
| 75 | Query string parameters to append to every URL. (e.g. `{ format: 'raw' }` → `?format=raw`) | ||
| 76 | Defaults to `{}`. | ||
| 77 | |||
| 78 | * `abstract` [Boolean] | ||
| 79 | Make the scraper abstract / not runnable. Used for sharing behavior with other scraper classes (e.g. all MDN scrapers inherit from the abstract [`Mdn`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/scrapers/mdn/mdn.rb) class). | ||
| 80 | Defaults to `false`. | ||
| 81 | |||
| 82 | ### Filter stacks | ||
| 83 | |||
| 84 | Each scraper has two [filter](https://github.com/Thibaut/devdocs/blob/master/lib/docs/core/filter.rb) [stacks](https://github.com/Thibaut/devdocs/blob/master/lib/docs/core/filter_stack.rb): `html_filters` and `text_filters`. They are combined into a pipeline (using the [HTML::Pipeline](https://github.com/jch/html-pipeline) library) which causes each filter to hand its output to the next filter's input. | ||
| 85 | |||
| 86 | HTML filters are executed first and manipulate a parsed version of the document (a [Nokogiri](http://nokogiri.org/Nokogiri/XML/Node.html) node object), whereas text filters manipulate the document as a string. This separation avoids parsing the document multiple times. | ||
| 87 | |||
| 88 | Filter stacks are like sorted sets. They can modified using the following methods: | ||
| 89 | |||
| 90 | ```ruby | ||
| 91 | push(*names) # append one or more filters at the end | ||
| 92 | insert_before(index, *names) # insert one filter before another (index can be a name) | ||
| 93 | insert_after(index, *names) # insert one filter after another (index can be a name) | ||
| 94 | replace(index, name) # replace one filter with another (index can be a name) | ||
| 95 | ``` | ||
| 96 | |||
| 97 | "names" are `require` paths relative to `Docs` (e.g. `jquery/clean_html` → `Docs::Jquery::CleanHtml`). | ||
| 98 | |||
| 99 | Default `html_filters`: | ||
| 100 | |||
| 101 | * [`ContainerFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/container.rb) — changes the root node of the document (remove everything outside) | ||
| 102 | * [`CleanHtmlFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/clean_html.rb) — removes HTML comments, `<script>`, `<style>`, etc. | ||
| 103 | * [`NormalizeUrlsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/normalize_urls.rb) — replaces all URLs with their fully qualified counterpart | ||
| 104 | * [`InternalUrlsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/internal_urls.rb) — detects internal URLs (the ones to scrape) and replaces them with their unqualified, relative counterpart | ||
| 105 | * [`NormalizePathsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/normalize_paths.rb) — makes the internal paths consistent (e.g. always end with `.html`) | ||
| 106 | * [`CleanLocalUrlsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/clean_local_urls.rb) — removes links, iframes and images pointing to localhost (`FileScraper` only) | ||
| 107 | |||
| 108 | Default `text_filters`: | ||
| 109 | |||
| 110 | * [`InnerHtmlFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/inner_html.rb) — converts the document to a string | ||
| 111 | * [`CleanTextFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/clean_text.rb) — removes empty nodes | ||
| 112 | * [`AttributionFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/attribution.rb) — appends the license info and link to the original document | ||
| 113 | |||
| 114 | Additionally: | ||
| 115 | |||
| 116 | * [`TitleFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/title.rb) is a core HTML filter, disabled by default, which prepends the document with a title (`<h1>`). | ||
| 117 | * [`EntriesFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/entries.rb) is an abstract HTML filter that each scraper must implement and responsible for extracting the page's metadata. | ||
| 118 | |||
| 119 | ### Filter options | ||
| 120 | |||
| 121 | The filter options are stored in the `options` Hash. The Hash is inheritable (a recursive copy) and empty by default. | ||
| 122 | |||
| 123 | More information about how filters work is available on the [Filter Reference](./filter-reference.md) page. | ||
| 124 | |||
| 125 | * [`ContainerFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/container.rb) | ||
| 126 | |||
| 127 | - `:container` [String or Proc] | ||
| 128 | A CSS selector of the container element. Everything outside of it will be removed and become unavailable to the other filters. If more than one element match the selector, the first one inside the DOM is used. If no elements match the selector, an error is raised. | ||
| 129 | If the value is a Proc, it is called for each page with the filter instance as argument, and should return a selector or `nil`. | ||
| 130 | The default container is the `<body>` element. | ||
| 131 | _Note: links outside of the container element will not be followed by the scraper. To remove links that should be followed, use a [`CleanHtml`](./filter-reference.md#cleanhtmlfilter) filter later in the stack._ | ||
| 132 | |||
| 133 | * [`NormalizeUrlsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/normalize_urls.rb) | ||
| 134 | The following options are used to modify URLs in the pages. They are useful to remove duplicates (when the same page is accessible from multiple URLs) and fix websites that have a bunch of redirections in place (when URLs that should be scraped, aren't, because they are behind a redirection which is outside of the `base_url` — see the MDN scrapers for examples of this). | ||
| 135 | |||
| 136 | - `:replace_urls` [Hash] | ||
| 137 | Replaces all instances of a URL with another. | ||
| 138 | Format: `{ 'original_url' => 'new_url' }` | ||
| 139 | - `:replace_paths` [Hash] | ||
| 140 | Replaces all instances of a sub-path (path from the `base_url`) with another. | ||
| 141 | Format: `{ 'original_path' => 'new_path' }` | ||
| 142 | - `:fix_urls` [Proc] | ||
| 143 | Called with each URL. If the returned value is `nil`, the URL isn't modified. Otherwise the returned value is used as replacement. | ||
| 144 | |||
| 145 | _Note: before these rules are applied, all URLs are converted to their fully qualified counterpart (http://...)._ | ||
| 146 | |||
| 147 | * [`InternalUrlsFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/internal_urls.rb) | ||
| 148 | |||
| 149 | Internal URLs are the ones _inside_ the scraper's `base_url` ("inside" more or less means "starting with", except that `/docs` is outside `/doc`). They will be scraped unless excluded by one of the following rules. All internal URLs are converted to relative URLs inside the pages. | ||
| 150 | |||
| 151 | - `:skip_links` [Boolean or Proc] | ||
| 152 | If `false`, does not convert or follow any internal URL (creating a single-page documentation). | ||
| 153 | If the value is a Proc, it is called for each page with the filter instance as argument. | ||
| 154 | - `:follow_links` [Proc] | ||
| 155 | Called for page with the filter instance as argument. If the returned value is `false`, does not add internal URLs to the queue. | ||
| 156 | - `:trailing_slash` [Boolean] | ||
| 157 | If `true`, adds a trailing slash to all internal URLs. If `false`, removes it. | ||
| 158 | This is another option used to remove duplicate pages. | ||
| 159 | - `:skip` [Array] | ||
| 160 | Ignores internal URLs whose sub-paths (path from the `base_url`) are in the Array (case-insensitive). | ||
| 161 | - `:skip_patterns` [Array] | ||
| 162 | Ignores internal URLs whose sub-paths match any Regexp in the Array. | ||
| 163 | - `:only` [Array] | ||
| 164 | Ignores internal URLs whose sub-paths aren't in the Array (case-insensitive) and don't match any Regexp in `:only_patterns`. | ||
| 165 | - `:only_patterns` [Array] | ||
| 166 | Ignores internal URLs whose sub-paths don't match any Regexp in the Array and aren't in `:only`. | ||
| 167 | |||
| 168 | If the scraper has a `root_path`, the empty and `/` paths are automatically skipped. | ||
| 169 | If `:only` or `:only_patterns` is set, the root path is automatically added to `:only`. | ||
| 170 | |||
| 171 | _Note: pages can be excluded from the index based on their content using the [`Entries`](./filter-reference.md#entriesfilter) filter. However, their URLs will still be converted to relative in the other pages and trying to open them will return a 404 error. Although not ideal, this is often better than having to maintain a long list of `:skip` URLs._ | ||
| 172 | |||
| 173 | * [`AttributionFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/attribution.rb) | ||
| 174 | |||
| 175 | - `:attribution` [String] **(required)** | ||
| 176 | An HTML string with the copyright and license information. See the other scrapers for examples. | ||
| 177 | |||
| 178 | * [`TitleFilter`](https://github.com/Thibaut/devdocs/blob/master/lib/docs/filters/core/title.rb) | ||
| 179 | |||
| 180 | - `:title` [String or Boolean or Proc] | ||
| 181 | Unless the value is `false`, adds a title to every page. | ||
| 182 | If the value is `nil`, the title is the name of the page as determined by the [`Entries`](./filter-reference.md#entriesfilter) filter. Otherwise the title is the String or the value returned by the Proc (called for each page, with the filter instance as argument). If the Proc returns `nil` or `false`, no title is added. | ||
| 183 | - `:root_title` [String or Boolean] | ||
| 184 | Overrides the `:title` option for the root page only. | ||
| 185 | |||
| 186 | _Note: this filter is disabled by default._ | ||
| @@ -12,6 +12,8 @@ class App < Sinatra::Application · 11 unmodified lines | |||
| 12 | Rack::Mime::MIME_TYPES['.webapp'] = 'application/x-web-app-manifest+json' | 12 | Rack::Mime::MIME_TYPES['.webapp'] = 'application/x-web-app-manifest+json' |
| 13 | 13 | ||
| 14 | configure do | 14 | configure do |
| 15 | use Rack::SslEnforcer, only_environments: ['production', 'test'], hsts: true, force_secure_cookies: false | ||
| 16 | |||
| 15 | set :sentry_dsn, ENV['SENTRY_DSN'] | 17 | set :sentry_dsn, ENV['SENTRY_DSN'] |
| 16 | set :protection, except: [:frame_options, :xss_header] | 18 | set :protection, except: [:frame_options, :xss_header] |
| 17 | 19 | ||
| @@ -35,6 +37,9 @@ class App < Sinatra::Application · 17 unmodified lines | |||
| 35 | 37 | ||
| 36 | set :csp, false | 38 | set :csp, false |
| 37 | 39 | ||
| 40 | require 'docs' | ||
| 41 | Docs.generate_manifest | ||
| 42 | |||
| 38 | Dir[docs_path, root.join(assets_prefix, '*/')].each do |path| | 43 | Dir[docs_path, root.join(assets_prefix, '*/')].each do |path| |
| 39 | sprockets.append_path(path) | 44 | sprockets.append_path(path) |
| 40 | end | 45 | end |
| @@ -67,7 +72,7 @@ class App < Sinatra::Application · 26 unmodified lines | |||
| 67 | set :static, false | 72 | set :static, false |
| 68 | set :cdn_origin, 'https://cdn.devdocs.io' | 73 | set :cdn_origin, 'https://cdn.devdocs.io' |
| 69 | set :docs_origin, '//docs.devdocs.io' | 74 | set :docs_origin, '//docs.devdocs.io' |
| 70 | set :csp, "default-src 'self' *; script-src 'self' 'nonce-devdocs' http://cdn.devdocs.io https://cdn.devdocs.io https://www.google-analytics.com https://secure.gaug.es http://*.jquery.com https://*.jquery.com; font-src 'none'; style-src 'self' 'unsafe-inline' *; img-src 'self' * data:;" | 75 | set :csp, "default-src 'self' *; script-src 'self' 'nonce-devdocs' https://cdn.devdocs.io https://www.google-analytics.com https://secure.gaug.es https://*.jquery.com; font-src 'none'; style-src 'self' 'unsafe-inline' *; img-src 'self' * data:;" |
| 71 | 76 | ||
| 72 | use Rack::ConditionalGet | 77 | use Rack::ConditionalGet |
| 73 | use Rack::ETag | 78 | use Rack::ETag |
| @@ -190,51 +195,47 @@ class App < Sinatra::Application · 116 unmodified lines | |||
| 190 | request.query_string.empty? ? nil : "?#{request.query_string}" | 195 | request.query_string.empty? ? nil : "?#{request.query_string}" |
| 191 | end | 196 | end |
| 192 | 197 | ||
| 193 | def manifest_asset_urls | 198 | def service_worker_asset_urls |
| 194 | @@manifest_asset_urls ||= [ | 199 | @@service_worker_asset_urls ||= [ |
| 195 | javascript_path('application', asset_host: false), | 200 | javascript_path('application', asset_host: false), |
| 196 | stylesheet_path('application'), | 201 | stylesheet_path('application'), |
| 197 | stylesheet_path('application-dark'), | ||
| 198 | image_path('docs-1.png'), | 202 | image_path('docs-1.png'), |
| 199 | image_path('docs-1@2x.png'), | 203 | image_path('docs-1@2x.png'), |
| 200 | image_path('docs-2.png'), | 204 | image_path('docs-2.png'), |
| 201 | image_path('docs-2@2x.png'), | 205 | image_path('docs-2@2x.png'), |
| 202 | asset_path('docs.js') | 206 | asset_path('docs.js'), |
| 203 | ] | 207 | App.production? ? nil : javascript_path('debug'), |
| 204 | end | 208 | ].compact |
| 205 | |||
| 206 | def main_stylesheet_path | ||
| 207 | stylesheet_paths[dark_theme? ? :dark : :default] | ||
| 208 | end | ||
| 209 | |||
| 210 | def alternate_stylesheet_path | ||
| 211 | stylesheet_paths[dark_theme? ? :default : :dark] | ||
| 212 | end | 209 | end |
| 213 | 210 | ||
| 214 | def stylesheet_paths | 211 | # Returns a cache name for the service worker to use which changes if any of the assets changes |
| 215 | @@stylesheet_paths ||= { | 212 | # When a manifest exist, this name is only created once based on the asset manifest because it never changes without a server restart |
| 216 | default: stylesheet_path('application'), | 213 | # If a manifest does not exist, it is created every time this method is called because the assets can change while the server is running |
| 217 | dark: stylesheet_path('application-dark') | 214 | def service_worker_cache_name |
| 218 | } | 215 | if File.exist?(App.assets_manifest_path) |
| 219 | end | 216 | if defined?(@@service_worker_cache_name) |
| 220 | 217 | return @@service_worker_cache_name | |
| 221 | def app_size | 218 | end |
| 222 | @app_size ||= memoized_cookies['size'].nil? ? '20rem' : "#{memoized_cookies['size']}px" | ||
| 223 | end | ||
| 224 | 219 | ||
| 225 | def app_layout | 220 | digest = Sprockets::Manifest |
| 226 | memoized_cookies['layout'] | 221 | .new(nil, App.assets_manifest_path) |
| 227 | end | 222 | .files |
| 223 | .values | ||
| 224 | .map {|file| file["digest"]} | ||
| 225 | .join | ||
| 228 | 226 | ||
| 229 | def app_theme | 227 | return @@service_worker_cache_name ||= Digest::MD5.hexdigest(digest) |
| 230 | @app_theme ||= memoized_cookies['dark'].nil? ? 'default' : 'dark' | 228 | else |
| 231 | end | 229 | paths = App.sprockets |
| 230 | .each_file | ||
| 231 | .to_a | ||
| 232 | .reject {|file| file.start_with?(App.docs_path)} | ||
| 232 | 233 | ||
| 233 | def dark_theme? | 234 | return App.sprockets.pack_hexdigest(App.sprockets.files_digest(paths)) |
| 234 | app_theme == 'dark' | 235 | end |
| 235 | end | 236 | end |
| 236 | 237 | ||
| 237 | def redirect_via_js(path) # courtesy of HTML5 App Cache | 238 | def redirect_via_js(path) |
| 238 | response.set_cookie :initial_path, value: path, expires: Time.now + 15, path: '/' | 239 | response.set_cookie :initial_path, value: path, expires: Time.now + 15, path: '/' |
| 239 | redirect '/', 302 | 240 | redirect '/', 302 |
| 240 | end | 241 | end |
| @@ -257,15 +258,15 @@ class App < Sinatra::Application · 16 unmodified lines | |||
| 257 | end | 258 | end |
| 258 | end | 259 | end |
| 259 | 260 | ||
| 260 | get '/manifest.appcache' do | 261 | get '/service-worker.js' do |
| 261 | content_type 'text/cache-manifest' | 262 | content_type 'application/javascript' |
| 262 | expires 0, :'no-cache' | 263 | expires 0, :'no-cache' |
| 263 | erb :manifest | 264 | erb :'service-worker.js' |
| 264 | end | 265 | end |
| 265 | 266 | ||
| 266 | get '/' do | 267 | get '/' do |
| 267 | return redirect "/#q=#{params[:q]}" if params[:q] | 268 | return redirect "/#q=#{params[:q]}" if params[:q] |
| 268 | return redirect '/' unless request.query_string.empty? # courtesy of HTML5 App Cache | 269 | return redirect '/' unless request.query_string.empty? |
| 269 | response.headers['Content-Security-Policy'] = settings.csp if settings.csp | 270 | response.headers['Content-Security-Policy'] = settings.csp if settings.csp |
| 270 | erb :index | 271 | erb :index |
| 271 | end | 272 | end |
| @@ -1,5 +1,5 @@ | |||
| 1 | require 'bundler/setup' | 1 | require 'bundler/setup' |
| 2 | Bundler.require :docs | 2 | Bundler.require :default, :docs |
| 3 | 3 | ||
| 4 | require 'active_support' | 4 | require 'active_support' |
| 5 | require 'active_support/core_ext' | 5 | require 'active_support/core_ext' |
| @@ -29,6 +29,7 @@ module Docs · 23 unmodified lines | |||
| 29 | self.rescue_errors = false | 29 | self.rescue_errors = false |
| 30 | 30 | ||
| 31 | class DocNotFound < NameError; end | 31 | class DocNotFound < NameError; end |
| 32 | class SetupError < StandardError; end | ||
| 32 | 33 | ||
| 33 | def self.all | 34 | def self.all |
| 34 | Dir["#{root_path}/docs/scrapers/**/*.rb"]. | 35 | Dir["#{root_path}/docs/scrapers/**/*.rb"]. |
| @@ -74,6 +75,22 @@ module Docs · 39 unmodified lines | |||
| 74 | end | 75 | end |
| 75 | end | 76 | end |
| 76 | 77 | ||
| 78 | def self.find_by_slug(slug, version = nil) | ||
| 79 | doc = all.find { |klass| klass.slug == slug } | ||
| 80 | |||
| 81 | unless doc | ||
| 82 | raise DocNotFound.new(%(could not find doc with "#{slug}"), slug) | ||
| 83 | end | ||
| 84 | |||
| 85 | if version.present? | ||
| 86 | version = doc.versions.find { |klass| klass.version == version || klass.version_slug == version } | ||
| 87 | raise DocNotFound.new(%(could not find version "#{version}" for doc "#{doc.name}"), doc.name) unless version | ||
| 88 | doc = version | ||
| 89 | end | ||
| 90 | |||
| 91 | doc | ||
| 92 | end | ||
| 93 | |||
| 77 | def self.generate_page(name, version, page_id) | 94 | def self.generate_page(name, version, page_id) |
| 78 | find(name, version).store_page(store, page_id) | 95 | find(name, version).store_page(store, page_id) |
| 79 | end | 96 | end |
| @@ -95,6 +95,9 @@ module Docs · 94 unmodified lines | |||
| 95 | false | 95 | false |
| 96 | end | 96 | end |
| 97 | end | 97 | end |
| 98 | rescue Docs::SetupError => error | ||
| 99 | puts "ERROR: #{error.message}" | ||
| 100 | false | ||
| 98 | end | 101 | end |
| 99 | 102 | ||
| 100 | def store_pages(store) | 103 | def store_pages(store) |
| @@ -118,6 +121,9 @@ module Docs · 17 unmodified lines | |||
| 118 | false | 121 | false |
| 119 | end | 122 | end |
| 120 | end | 123 | end |
| 124 | rescue Docs::SetupError => error | ||
| 125 | puts "ERROR: #{error.message}" | ||
| 126 | false | ||
| 121 | end | 127 | end |
| 122 | 128 | ||
| 123 | private | 129 | private |
| @@ -1,5 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Requester < Typhoeus::Hydra | 2 | class Requester < Typhoeus::Hydra |
| 3 | include Instrumentable | ||
| 4 | |||
| 3 | attr_reader :request_options | 5 | attr_reader :request_options |
| 4 | 6 | ||
| 5 | def self.run(urls, options = {}, &block) | 7 | def self.run(urls, options = {}, &block) |
| @@ -20,7 +22,7 @@ module Docs · 14 unmodified lines | |||
| 20 | def initialize(options = {}) | 22 | def initialize(options = {}) |
| 21 | @request_options = options.extract!(:request_options)[:request_options].try(:dup) || {} | 23 | @request_options = options.extract!(:request_options)[:request_options].try(:dup) || {} |
| 22 | options[:max_concurrency] ||= 20 | 24 | options[:max_concurrency] ||= 20 |
| 23 | options[:pipelining] = false | 25 | options[:pipelining] = 0 |
| 24 | super | 26 | super |
| 25 | end | 27 | end |
| 26 | 28 | ||
| @@ -52,9 +54,11 @@ module Docs · 25 unmodified lines | |||
| 52 | end | 54 | end |
| 53 | 55 | ||
| 54 | def handle_response(response) | 56 | def handle_response(response) |
| 55 | on_response.each do |callback| | 57 | instrument 'handle_response.requester', url: response.url do |
| 56 | result = callback.call(response) | 58 | on_response.each do |callback| |
| 57 | result.each { |url| request(url) } if result.is_a? Array | 59 | result = callback.call(response) |
| 60 | result.each { |url| request(url) } if result.is_a?(Array) | ||
| 61 | end | ||
| 58 | end | 62 | end |
| 59 | end | 63 | end |
| 60 | end | 64 | end |
| @@ -1,14 +1,13 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class FileScraper < Scraper | 2 | class FileScraper < Scraper |
| 3 | SOURCE_DIRECTORY = File.expand_path '../../../../../docs', __FILE__ | ||
| 4 | |||
| 3 | Response = Struct.new :body, :url | 5 | Response = Struct.new :body, :url |
| 4 | 6 | ||
| 5 | class << self | 7 | class << self |
| 6 | attr_accessor :dir | ||
| 7 | |||
| 8 | def inherited(subclass) | 8 | def inherited(subclass) |
| 9 | super | 9 | super |
| 10 | subclass.base_url = base_url | 10 | subclass.base_url = base_url |
| 11 | subclass.dir = dir | ||
| 12 | end | 11 | end |
| 13 | end | 12 | end |
| 14 | 13 | ||
| @@ -16,13 +15,25 @@ module Docs · 1 unmodified line | |||
| 16 | 15 | ||
| 17 | html_filters.push 'clean_local_urls' | 16 | html_filters.push 'clean_local_urls' |
| 18 | 17 | ||
| 18 | def source_directory | ||
| 19 | @source_directory ||= File.join(SOURCE_DIRECTORY, self.class.path) | ||
| 20 | end | ||
| 21 | |||
| 19 | private | 22 | private |
| 20 | 23 | ||
| 24 | def assert_source_directory_exists | ||
| 25 | unless Dir.exists?(source_directory) | ||
| 26 | raise SetupError, "The #{self.class.name} scraper requires the original documentation files to be stored in the \"#{source_directory}\" directory." | ||
| 27 | end | ||
| 28 | end | ||
| 29 | |||
| 21 | def request_one(url) | 30 | def request_one(url) |
| 22 | Response.new read_file(file_path_for(url)), URL.parse(url) | 31 | assert_source_directory_exists |
| 32 | Response.new read_file(File.join(source_directory, url_to_path(url))), URL.parse(url) | ||
| 23 | end | 33 | end |
| 24 | 34 | ||
| 25 | def request_all(urls) | 35 | def request_all(urls) |
| 36 | assert_source_directory_exists | ||
| 26 | queue = [urls].flatten | 37 | queue = [urls].flatten |
| 27 | until queue.empty? | 38 | until queue.empty? |
| 28 | result = yield request_one(queue.shift) | 39 | result = yield request_one(queue.shift) |
| @@ -34,8 +45,8 @@ module Docs · 5 unmodified lines | |||
| 34 | response.body.present? | 45 | response.body.present? |
| 35 | end | 46 | end |
| 36 | 47 | ||
| 37 | def file_path_for(url) | 48 | def url_to_path(url) |
| 38 | File.join self.class.dir, url.remove(base_url.to_s) | 49 | url.remove(base_url.to_s) |
| 39 | end | 50 | end |
| 40 | 51 | ||
| 41 | def read_file(path) | 52 | def read_file(path) |
| @@ -72,7 +72,7 @@ module Docs · 71 unmodified lines | |||
| 72 | 72 | ||
| 73 | if base == dest | 73 | if base == dest |
| 74 | '' | 74 | '' |
| 75 | elsif dest.start_with? File.join(base, '') | 75 | elsif dest.start_with?(::File.join(base, '')) |
| 76 | url.path[(path.length)..-1] | 76 | url.path[(path.length)..-1] |
| 77 | end | 77 | end |
| 78 | end | 78 | end |
| @@ -20,8 +20,8 @@ module Docs · 19 unmodified lines | |||
| 20 | def additional_entries | 20 | def additional_entries |
| 21 | return [] unless subpath.start_with?('helpers') && subpath != 'helpers/' | 21 | return [] unless subpath.start_with?('helpers') && subpath != 'helpers/' |
| 22 | 22 | ||
| 23 | css('h2').each_with_object [] do |node, entries| | 23 | css('h2, h3').each_with_object [] do |node, entries| |
| 24 | next if node['id'] == 'access-from-helpers' | 24 | next if node['id'] == 'access-from-helpers' || node.content !~ /\s*[a-z_]/ |
| 25 | entries << ["#{node.content} (#{name})", node['id']] | 25 | entries << ["#{node.content} (#{name})", node['id']] |
| 26 | end | 26 | end |
| 27 | end | 27 | end |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Cordova | 2 | class Cordova |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | @doc = at_css('.page-content > div') | 5 | @doc = at_css('#page-toc-source') || at_css('.page-content > div') |
| 6 | 6 | ||
| 7 | at_css('h1').content = 'Apache Cordova' if root_page? | 7 | at_css('h1').content = 'Apache Cordova' if root_page? |
| 8 | 8 | ||
| @@ -31,6 +31,8 @@ module Docs · 30 unmodified lines | |||
| 31 | 'Keywords' | 31 | 'Keywords' |
| 32 | elsif subpath.start_with?('experimental') | 32 | elsif subpath.start_with?('experimental') |
| 33 | 'Experimental libraries' | 33 | 'Experimental libraries' |
| 34 | elsif subpath.start_with?('language/') | ||
| 35 | 'Language' | ||
| 34 | elsif type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) | 36 | elsif type = at_css('.t-navbar > div:nth-child(4) > :first-child').try(:content) |
| 35 | type.strip! | 37 | type.strip! |
| 36 | type.remove! ' library' | 38 | type.remove! ' library' |
| @@ -6,13 +6,16 @@ module Docs · 5 unmodified lines | |||
| 6 | 'CSS_Background_and_Borders' => 'Backgrounds & Borders', | 6 | 'CSS_Background_and_Borders' => 'Backgrounds & Borders', |
| 7 | 'CSS_Columns' => 'Multi-column Layout', | 7 | 'CSS_Columns' => 'Multi-column Layout', |
| 8 | 'CSS_Flexible_Box_Layout' => 'Flexible Box Layout', | 8 | 'CSS_Flexible_Box_Layout' => 'Flexible Box Layout', |
| 9 | 'CSS_Fonts' => 'Fonts', | ||
| 9 | 'CSS_Grid_Layout' => 'Grid Layout', | 10 | 'CSS_Grid_Layout' => 'Grid Layout', |
| 10 | 'CSS_Images' => 'Images', | 11 | 'CSS_Images' => 'Images', |
| 11 | 'CSS_Lists_and_Counters' => 'Lists', | 12 | 'CSS_Lists_and_Counters' => 'Lists', |
| 12 | 'CSS_Transforms' => 'Transforms', | 13 | 'CSS_Transforms' => 'Transforms', |
| 13 | 'Media_Queries' => 'Media Queries', | 14 | 'Media_Queries' => 'Media Queries', |
| 15 | 'filter-function' => 'Filter Effects', | ||
| 14 | 'transform-function' => 'Transforms', | 16 | 'transform-function' => 'Transforms', |
| 15 | '@media' => 'Media Queries', | 17 | '@media' => 'Media Queries', |
| 18 | 'overscroll' => 'Overscroll', | ||
| 16 | 'text-size-adjust' => 'Miscellaneous', | 19 | 'text-size-adjust' => 'Miscellaneous', |
| 17 | 'resolved_value' => 'Miscellaneous', | 20 | 'resolved_value' => 'Miscellaneous', |
| 18 | 'touch-action' => 'Miscellaneous', | 21 | 'touch-action' => 'Miscellaneous', |
| @@ -42,7 +45,7 @@ module Docs · 23 unmodified lines | |||
| 42 | end | 45 | end |
| 43 | 46 | ||
| 44 | def get_type | 47 | def get_type |
| 45 | if slug.include?('-webkit') || slug.include?('-moz') | 48 | if slug.include?('-webkit') || slug.include?('-moz') || slug.include?('-ms') |
| 46 | 'Extensions' | 49 | 'Extensions' |
| 47 | elsif type = TYPE_BY_PATH[slug.split('/').first] | 50 | elsif type = TYPE_BY_PATH[slug.split('/').first] |
| 48 | type | 51 | type |
| @@ -66,19 +69,22 @@ module Docs · 17 unmodified lines | |||
| 66 | 'Pseudo-Elements' | 69 | 'Pseudo-Elements' |
| 67 | elsif name.start_with?(':') | 70 | elsif name.start_with?(':') |
| 68 | 'Selectors' | 71 | 'Selectors' |
| 72 | elsif name.start_with?('display-') | ||
| 73 | 'Display' | ||
| 69 | else | 74 | else |
| 70 | 'Miscellaneous' | 75 | 'Miscellaneous' |
| 71 | end | 76 | end |
| 72 | end | 77 | end |
| 73 | 78 | ||
| 74 | STATUSES = { | 79 | STATUSES = { |
| 75 | 'spec-Living' => 0, | 80 | 'spec-Living' => 0, |
| 76 | 'spec-REC' => 1, | 81 | 'spec-REC' => 1, |
| 77 | 'spec-CR' => 2, | 82 | 'spec-CR' => 2, |
| 78 | 'spec-PR' => 3, | 83 | 'spec-PR' => 3, |
| 79 | 'spec-LC' => 4, | 84 | 'spec-LC' => 4, |
| 80 | 'spec-WD' => 5, | 85 | 'spec-WD' => 5, |
| 81 | 'spec-ED' => 6 | 86 | 'spec-ED' => 6, |
| 87 | 'spec-Obsolete' => 7 | ||
| 82 | } | 88 | } |
| 83 | 89 | ||
| 84 | PRIORITY_STATUSES = %w(spec-REC spec-CR) | 90 | PRIORITY_STATUSES = %w(spec-REC spec-CR) |
| @@ -86,6 +92,7 @@ module Docs · 1 unmodified line | |||
| 86 | 92 | ||
| 87 | def get_spec | 93 | def get_spec |
| 88 | return unless table = at_css('#Specifications + table') || css('.standard-table').last | 94 | return unless table = at_css('#Specifications + table') || css('.standard-table').last |
| 95 | |||
| 89 | specs = table.css('tbody tr').to_a | 96 | specs = table.css('tbody tr').to_a |
| 90 | # [link, span] | 97 | # [link, span] |
| 91 | specs.map! { |node| [node.at_css('> td:nth-child(1) > a'), node.at_css('> td:nth-child(2) > span')] } | 98 | specs.map! { |node| [node.at_css('> td:nth-child(1) > a'), node.at_css('> td:nth-child(2) > span')] } |
| @@ -110,8 +117,8 @@ module Docs · 18 unmodified lines | |||
| 110 | 'shape' => [ | 117 | 'shape' => [ |
| 111 | %w(rect() Syntax) ], | 118 | %w(rect() Syntax) ], |
| 112 | 'timing-function' => [ | 119 | 'timing-function' => [ |
| 113 | %w(cubic-bezier() The_cubic-bezier()_class_of_timing-functions), | 120 | %w(cubic-bezier()), |
| 114 | %w(steps() The_steps()_class_of_timing-functions), | 121 | %w(steps()), |
| 115 | %w(linear linear), | 122 | %w(linear linear), |
| 116 | %w(ease ease), | 123 | %w(ease ease), |
| 117 | %w(ease-in ease-in), | 124 | %w(ease-in ease-in), |
| @@ -30,7 +30,7 @@ module Docs · 29 unmodified lines | |||
| 30 | end | 30 | end |
| 31 | 31 | ||
| 32 | # Remove <div> wrapping .overheadIndicator | 32 | # Remove <div> wrapping .overheadIndicator |
| 33 | css('div > .overheadIndicator:first-child:last-child').each do |node| | 33 | css('div > .overheadIndicator:first-child:last-child', 'div > .blockIndicator:first-child:last-child').each do |node| |
| 34 | node.parent.replace(node) | 34 | node.parent.replace(node) |
| 35 | end | 35 | end |
| 36 | 36 | ||
| @@ -6,6 +6,7 @@ module Docs · 5 unmodified lines | |||
| 6 | 'EXT_' => 'WebGL', | 6 | 'EXT_' => 'WebGL', |
| 7 | 'OES_' => 'WebGL', | 7 | 'OES_' => 'WebGL', |
| 8 | 'WEBGL_' => 'WebGL', | 8 | 'WEBGL_' => 'WebGL', |
| 9 | 'Sensor API' => 'Sensors', | ||
| 9 | 'Ambient Light' => 'Ambient Light', | 10 | 'Ambient Light' => 'Ambient Light', |
| 10 | 'Audio' => 'Audio', | 11 | 'Audio' => 'Audio', |
| 11 | 'Battery Status' => 'Battery Status', | 12 | 'Battery Status' => 'Battery Status', |
| @@ -22,10 +23,12 @@ module Docs · 10 unmodified lines | |||
| 22 | 'Encrypted Media Extensions' => 'Encrypted Media', | 23 | 'Encrypted Media Extensions' => 'Encrypted Media', |
| 23 | 'Fetch' => 'Fetch', | 24 | 'Fetch' => 'Fetch', |
| 24 | 'File API' => 'File', | 25 | 'File API' => 'File', |
| 26 | 'Fullscreen' => 'Fullscreen', | ||
| 25 | 'Geolocation' => 'Geolocation', | 27 | 'Geolocation' => 'Geolocation', |
| 26 | 'Geometry' => 'Geometry', | 28 | 'Geometry' => 'Geometry', |
| 27 | 'High Resolution Time' => 'Performance', | 29 | 'High Resolution Time' => 'Performance', |
| 28 | 'Intersection' => 'Intersection Observer', | 30 | 'Intersection' => 'Intersection Observer', |
| 31 | 'Keyboard' => 'Keyboard', | ||
| 29 | 'Media Capabilities' => 'Media', | 32 | 'Media Capabilities' => 'Media', |
| 30 | 'Media Capture' => 'Media', | 33 | 'Media Capture' => 'Media', |
| 31 | 'Media Session' => 'Media', | 34 | 'Media Session' => 'Media', |
| @@ -35,6 +38,7 @@ module Docs · 3 unmodified lines | |||
| 35 | 'MIDI' => 'Audio', | 38 | 'MIDI' => 'Audio', |
| 36 | 'Navigation Timing' => 'Performance', | 39 | 'Navigation Timing' => 'Performance', |
| 37 | 'Network Information' => 'Network Information', | 40 | 'Network Information' => 'Network Information', |
| 41 | 'Orientation Sensor' => 'Sensors', | ||
| 38 | 'Payment' => 'Payments', | 42 | 'Payment' => 'Payments', |
| 39 | 'Performance Timeline' => 'Performance', | 43 | 'Performance Timeline' => 'Performance', |
| 40 | 'Pointer Events' => 'Pointer Events', | 44 | 'Pointer Events' => 'Pointer Events', |
| @@ -53,11 +57,13 @@ module Docs · 12 unmodified lines | |||
| 53 | 'Web App Manifest' => 'Web App Manifest', | 57 | 'Web App Manifest' => 'Web App Manifest', |
| 54 | 'Budget' => 'Budget', | 58 | 'Budget' => 'Budget', |
| 55 | 'Web Authentication' => 'Authentication', | 59 | 'Web Authentication' => 'Authentication', |
| 60 | 'Web Locks' => 'Locks', | ||
| 56 | 'Web Workers' => 'Web Workers', | 61 | 'Web Workers' => 'Web Workers', |
| 57 | 'WebGL' => 'WebGL', | 62 | 'WebGL' => 'WebGL', |
| 58 | 'WebRTC' => 'WebRTC', | 63 | 'WebRTC' => 'WebRTC', |
| 59 | 'WebUSB' => 'WebUSB', | 64 | 'WebUSB' => 'WebUSB', |
| 60 | 'WebVR' => 'WebVR' } | 65 | 'WebVR' => 'WebVR', |
| 66 | 'WebVTT' => 'WebVTT' } | ||
| 61 | 67 | ||
| 62 | TYPE_BY_NAME_STARTS_WITH = { | 68 | TYPE_BY_NAME_STARTS_WITH = { |
| 63 | 'AbortController' => 'Fetch', | 69 | 'AbortController' => 'Fetch', |
| @@ -89,10 +95,12 @@ module Docs · 25 unmodified lines | |||
| 89 | 'Fetch' => 'Fetch', | 95 | 'Fetch' => 'Fetch', |
| 90 | 'File' => 'File', | 96 | 'File' => 'File', |
| 91 | 'GlobalEventHandlers' => 'GlobalEventHandlers', | 97 | 'GlobalEventHandlers' => 'GlobalEventHandlers', |
| 98 | 'HMDVR' => 'WebVR', | ||
| 92 | 'history' => 'History', | 99 | 'history' => 'History', |
| 93 | 'HTML Drag' => 'Drag & Drop', | 100 | 'HTML Drag' => 'Drag & Drop', |
| 94 | 'HTML' => 'Elements', | 101 | 'HTML' => 'Elements', |
| 95 | 'IDB' => 'IndexedDB', | 102 | 'IDB' => 'IndexedDB', |
| 103 | 'Keyboard' => 'Keyboard', | ||
| 96 | 'location' => 'Location', | 104 | 'location' => 'Location', |
| 97 | 'navigator' => 'Navigator', | 105 | 'navigator' => 'Navigator', |
| 98 | 'MediaKeySession' => 'Encrypted Media', | 106 | 'MediaKeySession' => 'Encrypted Media', |
| @@ -122,6 +130,7 @@ module Docs · 23 unmodified lines | |||
| 122 | 'StyleSheet' => 'CSS', | 130 | 'StyleSheet' => 'CSS', |
| 123 | 'Stylesheet' => 'CSS', | 131 | 'Stylesheet' => 'CSS', |
| 124 | 'SVG' => 'SVG', | 132 | 'SVG' => 'SVG', |
| 133 | 'TextTrack' => 'WebVTT', | ||
| 125 | 'TimeRanges' => 'Media', | 134 | 'TimeRanges' => 'Media', |
| 126 | 'timing' => 'Performance', | 135 | 'timing' => 'Performance', |
| 127 | 'Timing' => 'Performance', | 136 | 'Timing' => 'Performance', |
| @@ -160,6 +169,7 @@ module Docs · 32 unmodified lines | |||
| 160 | 'timing' => 'Performance', | 169 | 'timing' => 'Performance', |
| 161 | 'Timing' => 'Performance', | 170 | 'Timing' => 'Performance', |
| 162 | 'udio' => 'Audio', | 171 | 'udio' => 'Audio', |
| 172 | 'VRDevice' => 'WebVR', | ||
| 163 | 'WebGL' => 'WebGL', | 173 | 'WebGL' => 'WebGL', |
| 164 | 'WEBGL' => 'WebGL', | 174 | 'WEBGL' => 'WebGL', |
| 165 | 'WebRTC' => 'WebRTC', | 175 | 'WebRTC' => 'WebRTC', |
| @@ -239,7 +249,7 @@ module Docs · 73 unmodified lines | |||
| 239 | 249 | ||
| 240 | def include_default_entry? | 250 | def include_default_entry? |
| 241 | return true if type == 'Console' | 251 | return true if type == 'Console' |
| 242 | return true unless node = doc.at_css('.overheadIndicator') | 252 | return true unless node = doc.at_css('.overheadIndicator, .blockIndicator') |
| 243 | node = node.parent while node.parent != doc | 253 | node = node.parent while node.parent != doc |
| 244 | return true if node.previous_element.try(:name).in?(%w(h2 h3)) | 254 | return true if node.previous_element.try(:name).in?(%w(h2 h3)) |
| 245 | content = node.content | 255 | content = node.content |
| @@ -59,6 +59,7 @@ module Docs · 58 unmodified lines | |||
| 59 | 59 | ||
| 60 | css('pre').each do |node| | 60 | css('pre').each do |node| |
| 61 | node['data-language'] = 'elixir' | 61 | node['data-language'] = 'elixir' |
| 62 | node.content = node.content | ||
| 62 | end | 63 | end |
| 63 | end | 64 | end |
| 64 | end | 65 | end |
| @@ -42,6 +42,11 @@ module Docs · 41 unmodified lines | |||
| 42 | node.parent.content = node.parent.content | 42 | node.parent.content = node.parent.content |
| 43 | end | 43 | end |
| 44 | 44 | ||
| 45 | # Fix links to the method reference | ||
| 46 | css('a').each do |node| | ||
| 47 | node['href'] = node['href'].sub('4x/api', 'index') | ||
| 48 | end | ||
| 49 | |||
| 45 | doc | 50 | doc |
| 46 | end | 51 | end |
| 47 | end | 52 | end |
| @@ -0,0 +1,44 @@ | |||
| 1 | module Docs | ||
| 2 | class Handlebars | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | # Remove the t-shirt shop advertisement | ||
| 6 | css('#callout').remove | ||
| 7 | |||
| 8 | # The title filter is used to add titles to pages without one, remove original headers | ||
| 9 | css('h1').remove | ||
| 10 | |||
| 11 | # Remove the link to the issue tracker | ||
| 12 | css('.issue-tracker').remove | ||
| 13 | |||
| 14 | css('pre').each do |node| | ||
| 15 | # Remove nested nodes inside pre tags | ||
| 16 | node.content = node.content | ||
| 17 | |||
| 18 | # Add syntax highlighting | ||
| 19 | node['data-language'] = 'html' | ||
| 20 | end | ||
| 21 | |||
| 22 | # Transform 'Learn More' links to headers in the "Getting Started" part of the homepage | ||
| 23 | # If this step is skipped, that section looks cluttered with 4 sub-sections without any dividers | ||
| 24 | css('#getting-started + .contents a.more-info').each do |node| | ||
| 25 | clone = node.clone | ||
| 26 | |||
| 27 | # Move it to the top of the sub-section | ||
| 28 | node.parent.prepend_child(clone) | ||
| 29 | |||
| 30 | # Turn it into a header | ||
| 31 | clone.name = 'h3' | ||
| 32 | |||
| 33 | # Remove the "Learn More: " part | ||
| 34 | clone.content = clone.content[12..-1] | ||
| 35 | end | ||
| 36 | |||
| 37 | # Remove class attributes from div elements to reduce file size | ||
| 38 | css('div').remove_attr('class') | ||
| 39 | |||
| 40 | doc | ||
| 41 | end | ||
| 42 | end | ||
| 43 | end | ||
| 44 | end | ||
| @@ -0,0 +1,19 @@ | |||
| 1 | module Docs | ||
| 2 | class Handlebars | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | def get_name | ||
| 5 | subpath[0..-6].titleize | ||
| 6 | end | ||
| 7 | |||
| 8 | def get_type | ||
| 9 | name | ||
| 10 | end | ||
| 11 | |||
| 12 | def additional_entries | ||
| 13 | css('h2, h3').to_a.map do |node| | ||
| 14 | [node.content.strip, node['id'], root_page? ? 'Manual' : nil] | ||
| 15 | end | ||
| 16 | end | ||
| 17 | end | ||
| 18 | end | ||
| 19 | end | ||
| @@ -65,6 +65,10 @@ module Docs · 64 unmodified lines | |||
| 65 | end | 65 | end |
| 66 | end | 66 | end |
| 67 | 67 | ||
| 68 | css('pre code').each do |node| | ||
| 69 | node.before(node.children).remove | ||
| 70 | end | ||
| 71 | |||
| 68 | doc | 72 | doc |
| 69 | end | 73 | end |
| 70 | end | 74 | end |
| @@ -52,7 +52,7 @@ module Docs · 51 unmodified lines | |||
| 52 | return [] if subpath.start_with?('users_guide') | 52 | return [] if subpath.start_with?('users_guide') |
| 53 | return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last) | 53 | return [] if IGNORE_ENTRIES_PATHS.include?(subpath.split('/').last) |
| 54 | 54 | ||
| 55 | css('#synopsis > ul > li').each_with_object [] do |node, entries| | 55 | css('#synopsis > details > ul > li').each_with_object [] do |node, entries| |
| 56 | link = node.at_css('a') | 56 | link = node.at_css('a') |
| 57 | name = node.content.strip | 57 | name = node.content.strip |
| 58 | name.remove! %r{\A(?:module|data|newtype|class|type family m|type)\s+} | 58 | name.remove! %r{\A(?:module|data|newtype|class|type family m|type)\s+} |
| @@ -75,7 +75,7 @@ module Docs · 16 unmodified lines | |||
| 75 | end | 75 | end |
| 76 | 76 | ||
| 77 | def include_default_entry? | 77 | def include_default_entry? |
| 78 | subpath.start_with?('users_guide') || at_css('#synopsis > ul > li') | 78 | subpath.start_with?('users_guide') || at_css('#synopsis > details > ul > li') |
| 79 | end | 79 | end |
| 80 | end | 80 | end |
| 81 | end | 81 | end |
| @@ -28,7 +28,7 @@ module Docs · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | def include_default_entry? | 29 | def include_default_entry? |
| 30 | return false if %w(Element/Heading_Elements).include?(slug) | 30 | return false if %w(Element/Heading_Elements).include?(slug) |
| 31 | (node = doc.at_css '.overheadIndicator').nil? || node.content.exclude?('not on a standards track') | 31 | (node = doc.at_css '.overheadIndicator, .blockIndicator').nil? || node.content.exclude?('not on a standards track') |
| 32 | end | 32 | end |
| 33 | 33 | ||
| 34 | def additional_entries | 34 | def additional_entries |
| @@ -11,12 +11,12 @@ module Docs · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | def other | 12 | def other |
| 13 | # Remove "style" attribute | 13 | # Remove "style" attribute |
| 14 | css('.inheritsbox', '.overheadIndicator').each do |node| | 14 | css('.inheritsbox', '.overheadIndicator', '.blockIndicator').each do |node| |
| 15 | node.remove_attribute 'style' | 15 | node.remove_attribute 'style' |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | # Remove <div> wrapping .overheadIndicator | 18 | # Remove <div> wrapping .overheadIndicator |
| 19 | css('div > .overheadIndicator:first-child:last-child').each do |node| | 19 | css('div > .overheadIndicator:first-child:last-child', 'div > .blockIndicator:first-child:last-child').each do |node| |
| 20 | node.parent.replace(node) | 20 | node.parent.replace(node) |
| 21 | end | 21 | end |
| 22 | end | 22 | end |
| @@ -88,7 +88,7 @@ module Docs · 87 unmodified lines | |||
| 88 | end | 88 | end |
| 89 | 89 | ||
| 90 | def include_default_entry? | 90 | def include_default_entry? |
| 91 | node = doc.at_css '.overheadIndicator, .warning' | 91 | node = doc.at_css '.blockIndicator, .warning' |
| 92 | 92 | ||
| 93 | # Can't use :first-child because #doc is a DocumentFragment | 93 | # Can't use :first-child because #doc is a DocumentFragment |
| 94 | return true unless node && node.parent == doc && !node.previous_element | 94 | return true unless node && node.parent == doc && !node.previous_element |
| @@ -14,6 +14,8 @@ module Docs · 13 unmodified lines | |||
| 14 | '#Quick_Links', | 14 | '#Quick_Links', |
| 15 | 'hr'] | 15 | 'hr'] |
| 16 | 16 | ||
| 17 | BROWSER_UNNECESSARY_CLASS_REGEX = /\s*bc-browser[\w_-]+/ | ||
| 18 | |||
| 17 | def call | 19 | def call |
| 18 | css(*REMOVE_NODES).remove | 20 | css(*REMOVE_NODES).remove |
| 19 | 21 | ||
| @@ -61,6 +63,94 @@ module Docs · 41 unmodified lines | |||
| 61 | node.previous_element << node | 63 | node.previous_element << node |
| 62 | end | 64 | end |
| 63 | 65 | ||
| 66 | # New compatibility tables | ||
| 67 | |||
| 68 | css('.bc-data #Legend + dl', '.bc-data #Legend', '.bc-data #Legend_2 + dl', '.bc-data #Legend_2', '.bc-browser-name').remove | ||
| 69 | |||
| 70 | css('abbr.only-icon[title="Full support"]', | ||
| 71 | 'abbr.only-icon[title="Partial support"]', | ||
| 72 | 'abbr.only-icon[title="No support"]', | ||
| 73 | 'abbr.only-icon[title="See implementation notes"]').remove | ||
| 74 | |||
| 75 | css('.bc-data .ic-altname', '.bc-data .ic-deprecated', '.bc-data .ic-non-standard', '.bc-data .ic-experimental').each do |node| | ||
| 76 | node.parent.remove | ||
| 77 | end | ||
| 78 | |||
| 79 | css('abbr.only-icon').each do |node| | ||
| 80 | node.replace(node.content) | ||
| 81 | end | ||
| 82 | |||
| 83 | css('.bc-table .bc-platforms td', '.bc-table .bc-browsers td').each do |node| | ||
| 84 | node.name = 'th' | ||
| 85 | end | ||
| 86 | |||
| 87 | css('.bc-data').each do |node| | ||
| 88 | link = node.at_css('.bc-github-link') | ||
| 89 | prev = node.previous_element | ||
| 90 | prev = prev.previous_element until prev.name == 'h2' | ||
| 91 | prev.add_child(link) | ||
| 92 | |||
| 93 | node.before(node.children).remove | ||
| 94 | end | ||
| 95 | |||
| 96 | css('.bc-table').each do |node| | ||
| 97 | desktop_table = node | ||
| 98 | |||
| 99 | mobile_table = node.dup | ||
| 100 | desktop_table.after(mobile_table) | ||
| 101 | |||
| 102 | if desktop_table.at_css('.bc-platform-server') | ||
| 103 | server_table = node.dup | ||
| 104 | mobile_table.after(server_table) | ||
| 105 | end | ||
| 106 | |||
| 107 | desktop_columns = desktop_table.at_css('th.bc-platform-desktop')['colspan'].to_i | ||
| 108 | mobile_columns = desktop_table.at_css('th.bc-platform-mobile')['colspan'].to_i | ||
| 109 | |||
| 110 | desktop_table.css('.bc-platform-mobile').remove | ||
| 111 | desktop_table.css('.bc-platform-server').remove | ||
| 112 | desktop_table.css('.bc-browsers th').to_a[(desktop_columns + 1)..-1].each(&:remove) | ||
| 113 | desktop_table.css('tr:not(.bc-platforms):not(.bc-browsers)').each do |line| | ||
| 114 | line.css('td').to_a[(desktop_columns)..-1].each(&:remove) | ||
| 115 | end | ||
| 116 | |||
| 117 | mobile_table.css('.bc-platform-desktop').remove | ||
| 118 | mobile_table.css('.bc-platform-server').remove | ||
| 119 | mobile_table.css('.bc-browsers th').to_a[1..(desktop_columns)].each(&:remove) | ||
| 120 | mobile_table.css('.bc-browsers th').to_a[(mobile_columns + 1)..-1].each(&:remove) | ||
| 121 | mobile_table.css('tr:not(.bc-platforms):not(.bc-browsers)').each do |line| | ||
| 122 | line.css('td').to_a[0..(desktop_columns - 1)].each(&:remove) | ||
| 123 | line.css('td').to_a[(mobile_columns)..-1].each(&:remove) | ||
| 124 | end | ||
| 125 | |||
| 126 | if server_table | ||
| 127 | server_table.css('.bc-platform-desktop').remove | ||
| 128 | server_table.css('.bc-platform-mobile').remove | ||
| 129 | server_table.css('.bc-browsers th').to_a[1..(desktop_columns + mobile_columns)].each(&:remove) | ||
| 130 | server_table.css('tr:not(.bc-platforms):not(.bc-browsers)').each do |line| | ||
| 131 | line.css('td').to_a[0..(desktop_columns + mobile_columns - 1)].each(&:remove) | ||
| 132 | end | ||
| 133 | end | ||
| 134 | end | ||
| 135 | |||
| 136 | # Reduce page size to make the offline bundle smaller. | ||
| 137 | css('.bc-supports-unknown').remove_attr('class') | ||
| 138 | css('td[class*="bc-platform"], th[class*="bc-platform"]').remove_attr('class') | ||
| 139 | css('td[class*="bc-browser"], th[class*="bc-browser"]').each do |node| | ||
| 140 | class_name = node['class'] | ||
| 141 | class_name.remove!(BROWSER_UNNECESSARY_CLASS_REGEX) | ||
| 142 | |||
| 143 | if class_name.present? | ||
| 144 | node['class'] = class_name | ||
| 145 | else | ||
| 146 | node.remove_attribute('class') | ||
| 147 | end | ||
| 148 | end | ||
| 149 | |||
| 150 | css('abbr[title*="Compatibility unknown"]').each do |node| | ||
| 151 | node.before(node.children).remove | ||
| 152 | end | ||
| 153 | |||
| 64 | doc | 154 | doc |
| 65 | end | 155 | end |
| 66 | end | 156 | end |
| @@ -16,7 +16,7 @@ module Docs · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | css('pre').each do |node| | 17 | css('pre').each do |node| |
| 18 | if lang = node.at_css('code')['class'] | 18 | if lang = node.at_css('code')['class'] |
| 19 | node['data-language'] = lang.remove('lang-') | 19 | node['data-language'] = lang.remove(%r{lang(uage)?-}) |
| 20 | end | 20 | end |
| 21 | 21 | ||
| 22 | node.content = node.content | 22 | node.content = node.content |
| @@ -26,6 +26,7 @@ module Docs · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | def get_type | 27 | def get_type |
| 28 | type = at_css('h1').content.strip | 28 | type = at_css('h1').content.strip |
| 29 | type.remove! %r{\[.*\]} | ||
| 29 | REPLACE_TYPES[type] || "#{type.first.upcase}#{type[1..-1]}" | 30 | REPLACE_TYPES[type] || "#{type.first.upcase}#{type[1..-1]}" |
| 30 | end | 31 | end |
| 31 | 32 | ||
| @@ -40,6 +41,7 @@ module Docs · 8 unmodified lines | |||
| 40 | 41 | ||
| 41 | klass = nil if node.name == 'h2' | 42 | klass = nil if node.name == 'h2' |
| 42 | name = node.content.strip | 43 | name = node.content.strip |
| 44 | name.remove! %r{\s*\[src\]} | ||
| 43 | 45 | ||
| 44 | # Skip constructors | 46 | # Skip constructors |
| 45 | if name.start_with? 'new ' | 47 | if name.start_with? 'new ' |
| @@ -0,0 +1,24 @@ | |||
| 1 | module Docs | ||
| 2 | class Puppeteer | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | at_css('h1').content = 'Puppeteer Documentation' | ||
| 6 | |||
| 7 | # None of the elements to remove have classes, so the order of the remove calls is trivial | ||
| 8 | |||
| 9 | # Remove links to previous versions of the reference | ||
| 10 | at_css('h1 + ul').remove | ||
| 11 | |||
| 12 | # Remove table of contents | ||
| 13 | at_css('h1 + h5').remove | ||
| 14 | at_css('h1 + ul').remove | ||
| 15 | |||
| 16 | # Make headers bigger by transforming them into a bigger variant | ||
| 17 | css('h3').each { |node| node.name = 'h2' } | ||
| 18 | css('h4').each { |node| node.name = 'h3' } | ||
| 19 | |||
| 20 | doc | ||
| 21 | end | ||
| 22 | end | ||
| 23 | end | ||
| 24 | end | ||
| @@ -0,0 +1,41 @@ | |||
| 1 | module Docs | ||
| 2 | class Puppeteer | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | # The entire reference is one big page, so get_name and get_type are not necessary | ||
| 5 | |||
| 6 | def additional_entries | ||
| 7 | entries = [] | ||
| 8 | |||
| 9 | css('h3').each do |node| | ||
| 10 | name = node.content.split(': ').last | ||
| 11 | |||
| 12 | # Find all sub-items (all h4's between the current h3 and the next) | ||
| 13 | current = node.next | ||
| 14 | while !current.nil? && current.name != 'h3' | ||
| 15 | if current.name == 'h4' | ||
| 16 | current_name = current.content | ||
| 17 | |||
| 18 | # Prepend events with the class name | ||
| 19 | if current_name.start_with?('event: ') | ||
| 20 | current_name = "#{name} event: #{current_name[/'(.*)'/, 1]}" | ||
| 21 | end | ||
| 22 | |||
| 23 | # Remove arguments from functions | ||
| 24 | if current_name.include?('(') | ||
| 25 | current_name = current_name.split('(')[0] + '()' | ||
| 26 | end | ||
| 27 | |||
| 28 | entries << [current_name, current['id'], name] | ||
| 29 | end | ||
| 30 | |||
| 31 | current = current.next | ||
| 32 | end | ||
| 33 | |||
| 34 | entries << [name, node['id'], name] | ||
| 35 | end | ||
| 36 | |||
| 37 | entries | ||
| 38 | end | ||
| 39 | end | ||
| 40 | end | ||
| 41 | end | ||
| @@ -15,15 +15,17 @@ module Docs · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | def other | 16 | def other |
| 17 | css('h1').each do |node| | 17 | css('h1').each do |node| |
| 18 | node.content = node.content.sub!(/\A[\d\.]+/) do |str| | 18 | node.content = node.content.sub(/\A[\d\.]+/) do |str| |
| 19 | rgx = /\A#{str}/ | 19 | rgx = /\A#{str}/ |
| 20 | @levelRegexp = @levelRegexp ? Regexp.union(@levelRegexp, rgx) : rgx | 20 | @levelRegexp = @levelRegexp ? Regexp.union(@levelRegexp, rgx) : rgx |
| 21 | '' | 21 | '' |
| 22 | end | 22 | end |
| 23 | end | 23 | end |
| 24 | 24 | ||
| 25 | css('h2', 'h3', 'h4').each do |node| | 25 | unless @levelRegexp.nil? |
| 26 | node.inner_html = node.inner_html.remove @levelRegexp | 26 | css('h2', 'h3', 'h4').each do |node| |
| 27 | node.inner_html = node.inner_html.remove @levelRegexp | ||
| 28 | end | ||
| 27 | end | 29 | end |
| 28 | end | 30 | end |
| 29 | end | 31 | end |
| @@ -2,16 +2,18 @@ module Docs · 1 unmodified line | |||
| 2 | class Python | 2 | class Python |
| 3 | class EntriesV3Filter < Docs::EntriesFilter | 3 | class EntriesV3Filter < Docs::EntriesFilter |
| 4 | REPLACE_TYPES = { | 4 | REPLACE_TYPES = { |
| 5 | 'Cryptographic' => 'Cryptography', | 5 | 'contextvars — Context Variables' => 'Context Variables', |
| 6 | 'Custom Interpreters' => 'Interpreters', | 6 | 'Cryptographic' => 'Cryptography', |
| 7 | 'Data Compression & Archiving' => 'Data Compression', | 7 | 'Custom Interpreters' => 'Interpreters', |
| 8 | 'Generic Operating System' => 'Operating System', | 8 | 'Data Compression & Archiving' => 'Data Compression', |
| 9 | 'Graphical User Interfaces with Tk' => 'Tk', | 9 | 'email — An email & MIME handling package' => 'Email', |
| 10 | 'Internet Data Handling' => 'Internet Data', | 10 | 'Generic Operating System' => 'Operating System', |
| 11 | 'Internet Protocols & Support' => 'Internet', | 11 | 'Graphical User Interfaces with Tk' => 'Tk', |
| 12 | 'Interprocess Communication & Networking' => 'Networking', | 12 | 'Internet Data Handling' => 'Internet Data', |
| 13 | 'Program Frameworks' => 'Frameworks', | 13 | 'Internet Protocols & Support' => 'Internet', |
| 14 | 'Structured Markup Processing Tools' => 'Structured Markup' } | 14 | 'Interprocess Communication & Networking' => 'Networking', |
| 15 | 'Program Frameworks' => 'Frameworks', | ||
| 16 | 'Structured Markup Processing Tools' => 'Structured Markup' } | ||
| 15 | 17 | ||
| 16 | def get_name | 18 | def get_name |
| 17 | name = at_css('h1').content | 19 | name = at_css('h1').content |
| @@ -37,8 +37,10 @@ module Docs · 36 unmodified lines | |||
| 37 | end | 37 | end |
| 38 | 38 | ||
| 39 | # Add class to differentiate Ruby code from C code | 39 | # Add class to differentiate Ruby code from C code |
| 40 | css('.method-source-code > pre').each do |node| | 40 | css('.method-source-code').each do |node| |
| 41 | node['class'] = node.at_css('.ruby-keyword') ? 'ruby' : 'c' | 41 | node.parent.prepend_child(node) |
| 42 | pre = node.at_css('pre') | ||
| 43 | pre['class'] = pre.at_css('.ruby-keyword') ? 'ruby' : 'c' | ||
| 42 | end | 44 | end |
| 43 | 45 | ||
| 44 | # Remove code highlighting | 46 | # Remove code highlighting |
| @@ -6,9 +6,11 @@ module Docs · 5 unmodified lines | |||
| 6 | end | 6 | end |
| 7 | 7 | ||
| 8 | def get_type | 8 | def get_type |
| 9 | link = at_css("nav a[href='#{result[:path].split('/').last}']") | 9 | link = css("nav a[href='#{result[:path].split('/').last}']").last |
| 10 | return 'Miscellaneous' unless link | 10 | return 'Miscellaneous' unless link |
| 11 | link.ancestors('ul').last.previous_element.content | 11 | type = link.ancestors('ul').last.previous_element.content |
| 12 | type.remove! %r{\s*\(.*\)} | ||
| 13 | type | ||
| 12 | end | 14 | end |
| 13 | 15 | ||
| 14 | def additional_entries | 16 | def additional_entries |
| @@ -25,6 +27,8 @@ module Docs · 10 unmodified lines | |||
| 25 | 'Reference: Component' | 27 | 'Reference: Component' |
| 26 | elsif slug == 'react-api' | 28 | elsif slug == 'react-api' |
| 27 | 'Reference: React' | 29 | 'Reference: React' |
| 30 | elsif slug == 'hooks-reference' | ||
| 31 | 'Hooks' | ||
| 28 | else | 32 | else |
| 29 | 'Reference' | 33 | 'Reference' |
| 30 | end | 34 | end |
| @@ -21,7 +21,7 @@ module Docs · 20 unmodified lines | |||
| 21 | when 'PFADD' then 'HyperLogLog' | 21 | when 'PFADD' then 'HyperLogLog' |
| 22 | when 'CLUSTER ADDSLOTS' then 'Cluster' | 22 | when 'CLUSTER ADDSLOTS' then 'Cluster' |
| 23 | when 'GEOADD' then 'Geo' | 23 | when 'GEOADD' then 'Geo' |
| 24 | when 'XADD' then 'Stream' | 24 | when 'XACK' then 'Stream' |
| 25 | else 'Miscellaneous' | 25 | else 'Miscellaneous' |
| 26 | end | 26 | end |
| 27 | end | 27 | end |
| @@ -1,9 +1,9 @@ | |||
| 1 | # frozen_string_literal: true | ||
| 2 | |||
| 1 | module Docs | 3 | module Docs |
| 2 | class Rust | 4 | class Rust |
| 3 | class CleanHtmlFilter < Filter | 5 | class CleanHtmlFilter < Filter |
| 4 | def call | 6 | def call |
| 5 | puts subpath if at_css('#versioninfo') | ||
| 6 | |||
| 7 | if slug.start_with?('book') || slug.start_with?('reference') | 7 | if slug.start_with?('book') || slug.start_with?('reference') |
| 8 | @doc = at_css('#content main') | 8 | @doc = at_css('#content main') |
| 9 | elsif slug == 'error-index' | 9 | elsif slug == 'error-index' |
| @@ -29,12 +29,16 @@ module Docs · 19 unmodified lines | |||
| 29 | 29 | ||
| 30 | css('.rusttest', '.test-arrow', 'hr').remove | 30 | css('.rusttest', '.test-arrow', 'hr').remove |
| 31 | 31 | ||
| 32 | css('.docblock.attributes').each do |node| | ||
| 33 | node.remove if node.content.include?('#[must_use]') | ||
| 34 | end | ||
| 35 | |||
| 32 | css('a.header').each do |node| | 36 | css('a.header').each do |node| |
| 33 | node.first_element_child['id'] = node['name'] || node['id'] | 37 | node.first_element_child['id'] = node['name'] || node['id'] |
| 34 | node.before(node.children).remove | 38 | node.before(node.children).remove |
| 35 | end | 39 | end |
| 36 | 40 | ||
| 37 | css('.docblock > h1').each { |node| node.name = 'h4' } | 41 | css('.docblock > h1:not(.section-header)').each { |node| node.name = 'h4' } |
| 38 | css('h2.section-header').each { |node| node.name = 'h3' } | 42 | css('h2.section-header').each { |node| node.name = 'h3' } |
| 39 | css('h1.section-header').each { |node| node.name = 'h2' } | 43 | css('h1.section-header').each { |node| node.name = 'h2' } |
| 40 | 44 | ||
| @@ -44,7 +48,7 @@ module Docs · 3 unmodified lines | |||
| 44 | end | 48 | end |
| 45 | end | 49 | end |
| 46 | 50 | ||
| 47 | css('> .impl-items', '> .docblock', 'pre > pre').each do |node| | 51 | css('> .impl-items', '> .docblock', 'pre > pre', '.tooltiptext', '.tooltip').each do |node| |
| 48 | node.before(node.children).remove | 52 | node.before(node.children).remove |
| 49 | end | 53 | end |
| 50 | 54 | ||
| @@ -65,6 +69,32 @@ module Docs · 14 unmodified lines | |||
| 65 | doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2' | 69 | doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2' |
| 66 | at_css('h1').content = 'Rust Documentation' if root_page? | 70 | at_css('h1').content = 'Rust Documentation' if root_page? |
| 67 | 71 | ||
| 72 | css('.table-display').each do |node| | ||
| 73 | node.css('td').each do |td| | ||
| 74 | node.before(td.children) | ||
| 75 | end | ||
| 76 | node.remove | ||
| 77 | end | ||
| 78 | |||
| 79 | css('.important-traits').to_a.each_with_index do |node, index| | ||
| 80 | content = node.at_css('.content.hidden .content') | ||
| 81 | node.at_css('.content.hidden').replace(content) if content | ||
| 82 | node.parent.after(node) if node.parent.name.in?(%(h2 h3 h4)) | ||
| 83 | end | ||
| 84 | |||
| 85 | css('code.content').each do |node| | ||
| 86 | node.name = 'pre' | ||
| 87 | node.css('.fmt-newline').each do |line| | ||
| 88 | line.inner_html = line.inner_html + "\n" | ||
| 89 | end | ||
| 90 | node.inner_html = node.inner_html.gsub('<br>', "\n") | ||
| 91 | node.content = node.content | ||
| 92 | end | ||
| 93 | |||
| 94 | css('.since + .srclink').each do |node| | ||
| 95 | node.previous_element.before(node) | ||
| 96 | end | ||
| 97 | |||
| 68 | doc | 98 | doc |
| 69 | end | 99 | end |
| 70 | end | 100 | end |
| @@ -42,11 +42,13 @@ module Docs · 41 unmodified lines | |||
| 42 | entries << [node.content, node['id']] unless node.content.include?('Note:') | 42 | entries << [node.content, node['id']] unless node.content.include?('Note:') |
| 43 | end | 43 | end |
| 44 | else | 44 | else |
| 45 | css('#methods + * + div > .method', '#required-methods + div > .method', '#provided-methods + div > .method').map do |node| | 45 | css('.method') |
| 46 | name = node.at_css('.fnname').content | 46 | .each_with_object({}) { |node, entries| |
| 47 | name.prepend "#{self.name}::" | 47 | name = node.at_css('.fnname').try(:content) |
| 48 | [name, node['id']] | 48 | next unless name |
| 49 | end | 49 | name.prepend "#{self.name}::" |
| 50 | entries[name] ||= [name, node['id']] | ||
| 51 | }.values | ||
| 50 | end | 52 | end |
| 51 | end | 53 | end |
| 52 | end | 54 | end |
| @@ -34,7 +34,8 @@ module Docs · 33 unmodified lines | |||
| 34 | 'rtree' => 'R*Tree Module', | 34 | 'rtree' => 'R*Tree Module', |
| 35 | 'rbu' => 'RBU Extension', | 35 | 'rbu' => 'RBU Extension', |
| 36 | 'limits' => 'Limits', | 36 | 'limits' => 'Limits', |
| 37 | 'howtocorrupt' => 'How To Corrupt' | 37 | 'howtocorrupt' => 'How To Corrupt', |
| 38 | 'geopoly' => 'Geopoly' | ||
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | def get_type | 41 | def get_type |
| @@ -15,8 +15,28 @@ module Docs · 14 unmodified lines | |||
| 15 | Licensed under the GNU General Public License version 3. | 15 | Licensed under the GNU General Public License version 3. |
| 16 | HTML | 16 | HTML |
| 17 | 17 | ||
| 18 | version '2.7' do | ||
| 19 | self.release = '2.7.1' | ||
| 20 | self.base_url = 'https://docs.ansible.com/ansible/2.7/' | ||
| 21 | |||
| 22 | options[:skip] = %w( | ||
| 23 | installation_guide/index.html | ||
| 24 | reference_appendices/glossary.html | ||
| 25 | reference_appendices/faq.html | ||
| 26 | reference_appendices/tower.html | ||
| 27 | user_guide/quickstart.html | ||
| 28 | modules/modules_by_category.html | ||
| 29 | modules/list_of_all_modules.html) | ||
| 30 | |||
| 31 | options[:skip_patterns] = [ | ||
| 32 | /\Acommunity.*/i, | ||
| 33 | /\Adev_guide.*/i, | ||
| 34 | /\Aroadmap.*/i, | ||
| 35 | ] | ||
| 36 | end | ||
| 37 | |||
| 18 | version '2.6' do | 38 | version '2.6' do |
| 19 | self.release = '2.6.1' | 39 | self.release = '2.6.7' |
| 20 | self.base_url = 'https://docs.ansible.com/ansible/2.6/' | 40 | self.base_url = 'https://docs.ansible.com/ansible/2.6/' |
| 21 | 41 | ||
| 22 | options[:skip] = %w( | 42 | options[:skip] = %w( |
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | |||
| 3 | self.name = 'Apache HTTP Server' | 3 | self.name = 'Apache HTTP Server' |
| 4 | self.slug = 'apache_http_server' | 4 | self.slug = 'apache_http_server' |
| 5 | self.type = 'apache' | 5 | self.type = 'apache' |
| 6 | self.release = '2.4.34' | 6 | self.release = '2.4.37' |
| 7 | self.base_url = 'https://httpd.apache.org/docs/2.4/en/' | 7 | self.base_url = 'https://httpd.apache.org/docs/2.4/en/' |
| 8 | self.links = { | 8 | self.links = { |
| 9 | home: 'https://httpd.apache.org/' | 9 | home: 'https://httpd.apache.org/' |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class ApachePig < UrlScraper | 2 | class ApachePig < UrlScraper |
| 3 | self.name = 'Apache Pig' | 3 | self.name = 'Apache Pig' |
| 4 | self.slug = 'apache_pig' | 4 | self.slug = 'apache_pig' |
| 5 | self.type = 'apache_pig' | 5 | self.type = 'simple' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://pig.apache.org/' | 7 | home: 'https://pig.apache.org/' |
| 8 | } | 8 | } |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Async < UrlScraper | 2 | class Async < UrlScraper |
| 3 | self.type = 'async' | 3 | self.type = 'async' |
| 4 | self.release = '2.6.0' | 4 | self.release = '2.6.1' |
| 5 | self.base_url = 'https://caolan.github.io/async/' | 5 | self.base_url = 'https://caolan.github.io/async/' |
| 6 | self.root_path = 'docs.html' | 6 | self.root_path = 'docs.html' |
| 7 | self.links = { | 7 | self.links = { |
| @@ -14,7 +14,7 @@ module Docs · 6 unmodified lines | |||
| 14 | options[:skip_links] = true | 14 | options[:skip_links] = true |
| 15 | 15 | ||
| 16 | options[:attribution] = <<-HTML | 16 | options[:attribution] = <<-HTML |
| 17 | © 2010–2017 Caolan McMahon<br> | 17 | © 2010–2018 Caolan McMahon<br> |
| 18 | Licensed under the MIT License. | 18 | Licensed under the MIT License. |
| 19 | HTML | 19 | HTML |
| 20 | end | 20 | end |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Bower < UrlScraper | 2 | class Bower < UrlScraper |
| 3 | self.name = 'Bower' | 3 | self.name = 'Bower' |
| 4 | self.type = 'bower' | 4 | self.type = 'simple' |
| 5 | self.release = '1.8.4' | 5 | self.release = '1.8.4' |
| 6 | self.base_url = 'https://bower.io/docs/' | 6 | self.base_url = 'https://bower.io/docs/' |
| 7 | self.root_path = 'api' | 7 | self.root_path = 'api' |
| @@ -1,7 +1,6 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class C < FileScraper | 2 | class C < FileScraper |
| 3 | self.type = 'c' | 3 | self.type = 'c' |
| 4 | self.dir = '/Users/Thibaut/DevDocs/Docs/c' | ||
| 5 | self.base_url = 'http://en.cppreference.com/w/c/' | 4 | self.base_url = 'http://en.cppreference.com/w/c/' |
| 6 | self.root_path = 'header.html' | 5 | self.root_path = 'header.html' |
| 7 | 6 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Chai < UrlScraper | 2 | class Chai < UrlScraper |
| 3 | self.name = 'Chai' | 3 | self.name = 'Chai' |
| 4 | self.type = 'chai' | 4 | self.type = 'simple' |
| 5 | self.release = '4.1.0' | 5 | self.release = '4.1.0' |
| 6 | self.base_url = 'http://chaijs.com' | 6 | self.base_url = 'http://chaijs.com' |
| 7 | self.root_path = '/api/' | 7 | self.root_path = '/api/' |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Codeception < UrlScraper | 2 | class Codeception < UrlScraper |
| 3 | self.name = 'Codeception' | 3 | self.name = 'Codeception' |
| 4 | self.type = 'codeception' | 4 | self.type = 'codeception' |
| 5 | self.release = '2.4.0' | 5 | self.release = '2.5.1' |
| 6 | self.base_url = 'https://codeception.com/docs/' | 6 | self.base_url = 'https://codeception.com/docs/' |
| 7 | self.root_path = 'index.html' | 7 | self.root_path = 'index.html' |
| 8 | self.links = { | 8 | self.links = { |
| @@ -1,9 +1,9 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Codeceptjs < UrlScraper | 2 | class Codeceptjs < UrlScraper |
| 3 | self.name = 'CodeceptJS' | 3 | self.name = 'CodeceptJS' |
| 4 | self.type = 'codeceptjs' | 4 | self.type = 'simple' |
| 5 | self.root_path = 'index.html' | 5 | self.root_path = 'index.html' |
| 6 | self.release = '1.3.1' | 6 | self.release = '1.4.4' |
| 7 | self.base_url = 'https://codecept.io/' | 7 | self.base_url = 'https://codecept.io/' |
| 8 | self.links = { | 8 | self.links = { |
| 9 | home: 'https://codecept.io/', | 9 | home: 'https://codecept.io/', |
| @@ -24,10 +24,15 @@ module Docs · 23 unmodified lines | |||
| 24 | end | 24 | end |
| 25 | 25 | ||
| 26 | options[:attribution] = <<-HTML | 26 | options[:attribution] = <<-HTML |
| 27 | © 2012–2017 The Apache Software Foundation<br> | 27 | © 2012–2018 The Apache Software Foundation<br> |
| 28 | Licensed under the Apache License 2.0. | 28 | Licensed under the Apache License 2.0. |
| 29 | HTML | 29 | HTML |
| 30 | 30 | ||
| 31 | version '8' do | ||
| 32 | self.release = '8.1.2' | ||
| 33 | self.base_url = 'https://cordova.apache.org/docs/en/8.x/' | ||
| 34 | end | ||
| 35 | |||
| 31 | version '7' do | 36 | version '7' do |
| 32 | self.release = '7.1.0' | 37 | self.release = '7.1.0' |
| 33 | self.base_url = 'https://cordova.apache.org/docs/en/7.x/' | 38 | self.base_url = 'https://cordova.apache.org/docs/en/7.x/' |
| @@ -3,7 +3,6 @@ module Docs · 2 unmodified lines | |||
| 3 | self.name = 'C++' | 3 | self.name = 'C++' |
| 4 | self.slug = 'cpp' | 4 | self.slug = 'cpp' |
| 5 | self.type = 'c' | 5 | self.type = 'c' |
| 6 | self.dir = '/Users/Thibaut/DevDocs/Docs/cpp' | ||
| 7 | self.base_url = 'http://en.cppreference.com/w/cpp/' | 6 | self.base_url = 'http://en.cppreference.com/w/cpp/' |
| 8 | self.root_path = 'header.html' | 7 | self.root_path = 'header.html' |
| 9 | 8 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Crystal < UrlScraper | 2 | class Crystal < UrlScraper |
| 3 | self.type = 'crystal' | 3 | self.type = 'crystal' |
| 4 | self.release = '0.26.0' | 4 | self.release = '0.27.0' |
| 5 | self.base_url = 'https://crystal-lang.org/' | 5 | self.base_url = 'https://crystal-lang.org/' |
| 6 | self.root_path = "api/#{release}/index.html" | 6 | self.root_path = "api/#{release}/index.html" |
| 7 | self.initial_paths = %w(docs/index.html) | 7 | self.initial_paths = %w(docs/index.html) |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class D < UrlScraper | 2 | class D < UrlScraper |
| 3 | include MultipleBaseUrls | 3 | include MultipleBaseUrls |
| 4 | 4 | ||
| 5 | self.release = '2.081.0' | 5 | self.release = '2.083.0' |
| 6 | self.type = 'd' | 6 | self.type = 'd' |
| 7 | self.base_urls = ['https://dlang.org/phobos/', 'https://dlang.org/spec/'] | 7 | self.base_urls = ['https://dlang.org/phobos/', 'https://dlang.org/spec/'] |
| 8 | self.root_path = 'index.html' | 8 | self.root_path = 'index.html' |
| @@ -17,7 +17,7 @@ module Docs · 16 unmodified lines | |||
| 17 | HTML | 17 | HTML |
| 18 | 18 | ||
| 19 | version '5' do | 19 | version '5' do |
| 20 | self.release = '5.4.0' | 20 | self.release = '5.7.0' |
| 21 | self.base_url = 'https://github.com/d3/' | 21 | self.base_url = 'https://github.com/d3/' |
| 22 | self.root_path = 'd3/blob/master/API.md' | 22 | self.root_path = 'd3/blob/master/API.md' |
| 23 | 23 | ||
| @@ -24,13 +24,11 @@ module Docs · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | version '2' do | 25 | version '2' do |
| 26 | self.release = '2.0.0' | 26 | self.release = '2.0.0' |
| 27 | self.dir = '/Users/Thibaut/DevDocs/Docs/Dart2' | ||
| 28 | self.base_url = "https://api.dartlang.org/stable/#{release}/" | 27 | self.base_url = "https://api.dartlang.org/stable/#{release}/" |
| 29 | end | 28 | end |
| 30 | 29 | ||
| 31 | version '1' do | 30 | version '1' do |
| 32 | self.release = '1.24.3' | 31 | self.release = '1.24.3' |
| 33 | self.dir = '/Users/Thibaut/DevDocs/Docs/Dart1' | ||
| 34 | self.base_url = "https://api.dartlang.org/stable/#{release}/" | 32 | self.base_url = "https://api.dartlang.org/stable/#{release}/" |
| 35 | end | 33 | end |
| 36 | end | 34 | end |
| @@ -36,37 +36,31 @@ module Docs · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | version '2.1' do | 37 | version '2.1' do |
| 38 | self.release = '2.1.0' | 38 | self.release = '2.1.0' |
| 39 | self.dir = '/Users/Thibaut/DevDocs/Docs/Django21' | ||
| 40 | self.base_url = 'https://docs.djangoproject.com/en/2.1/' | 39 | self.base_url = 'https://docs.djangoproject.com/en/2.1/' |
| 41 | end | 40 | end |
| 42 | 41 | ||
| 43 | version '2.0' do | 42 | version '2.0' do |
| 44 | self.release = '2.0.7' | 43 | self.release = '2.0.7' |
| 45 | self.dir = '/Users/Thibaut/DevDocs/Docs/Django20' | ||
| 46 | self.base_url = 'https://docs.djangoproject.com/en/2.0/' | 44 | self.base_url = 'https://docs.djangoproject.com/en/2.0/' |
| 47 | end | 45 | end |
| 48 | 46 | ||
| 49 | version '1.11' do | 47 | version '1.11' do |
| 50 | self.release = '1.11.9' | 48 | self.release = '1.11.9' |
| 51 | self.dir = '/Users/Thibaut/DevDocs/Docs/Django111' | ||
| 52 | self.base_url = 'https://docs.djangoproject.com/en/1.11/' | 49 | self.base_url = 'https://docs.djangoproject.com/en/1.11/' |
| 53 | end | 50 | end |
| 54 | 51 | ||
| 55 | version '1.10' do | 52 | version '1.10' do |
| 56 | self.release = '1.10.8' | 53 | self.release = '1.10.8' |
| 57 | self.dir = '/Users/Thibaut/DevDocs/Docs/Django110' | ||
| 58 | self.base_url = 'https://docs.djangoproject.com/en/1.10/' | 54 | self.base_url = 'https://docs.djangoproject.com/en/1.10/' |
| 59 | end | 55 | end |
| 60 | 56 | ||
| 61 | version '1.9' do | 57 | version '1.9' do |
| 62 | self.release = '1.9.13' | 58 | self.release = '1.9.13' |
| 63 | self.dir = '/Users/Thibaut/DevDocs/Docs/Django19' | ||
| 64 | self.base_url = 'https://docs.djangoproject.com/en/1.9/' | 59 | self.base_url = 'https://docs.djangoproject.com/en/1.9/' |
| 65 | end | 60 | end |
| 66 | 61 | ||
| 67 | version '1.8' do | 62 | version '1.8' do |
| 68 | self.release = '1.8.18' | 63 | self.release = '1.8.18' |
| 69 | self.dir = '/Users/Thibaut/DevDocs/Docs/Django18' | ||
| 70 | self.base_url = 'https://docs.djangoproject.com/en/1.8/' | 64 | self.base_url = 'https://docs.djangoproject.com/en/1.8/' |
| 71 | end | 65 | end |
| 72 | end | 66 | end |
| @@ -1,6 +1,6 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Docker < UrlScraper | 2 | class Docker < UrlScraper |
| 3 | self.type = 'docker' | 3 | self.type = 'simple' |
| 4 | self.links = { | 4 | self.links = { |
| 5 | home: 'https://docker.com/', | 5 | home: 'https://docker.com/', |
| 6 | code: 'https://github.com/docker/docker' | 6 | code: 'https://github.com/docker/docker' |
| @@ -1,6 +1,6 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Electron < UrlScraper | 2 | class Electron < UrlScraper |
| 3 | self.type = 'electron' | 3 | self.type = 'simple' |
| 4 | self.base_url = 'https://electronjs.org/docs' | 4 | self.base_url = 'https://electronjs.org/docs' |
| 5 | self.release = '2.0.2' | 5 | self.release = '2.0.2' |
| 6 | self.links = { | 6 | self.links = { |
| @@ -34,7 +34,7 @@ module Docs · 33 unmodified lines | |||
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | version '1.7' do | 36 | version '1.7' do |
| 37 | self.release = '1.7.2' | 37 | self.release = '1.7.3' |
| 38 | self.base_urls = [ | 38 | self.base_urls = [ |
| 39 | "https://hexdocs.pm/elixir/#{release}/", | 39 | "https://hexdocs.pm/elixir/#{release}/", |
| 40 | "https://hexdocs.pm/eex/#{release}/", | 40 | "https://hexdocs.pm/eex/#{release}/", |
| @@ -42,22 +42,18 @@ module Docs · 41 unmodified lines | |||
| 42 | 42 | ||
| 43 | version '21' do | 43 | version '21' do |
| 44 | self.release = '21.0' | 44 | self.release = '21.0' |
| 45 | self.dir = '/Users/Thibaut/DevDocs/Docs/Erlang21' | ||
| 46 | end | 45 | end |
| 47 | 46 | ||
| 48 | version '20' do | 47 | version '20' do |
| 49 | self.release = '20.3' | 48 | self.release = '20.3' |
| 50 | self.dir = '/Users/Thibaut/DevDocs/Docs/Erlang20' | ||
| 51 | end | 49 | end |
| 52 | 50 | ||
| 53 | version '19' do | 51 | version '19' do |
| 54 | self.release = '19.3' | 52 | self.release = '19.3' |
| 55 | self.dir = '/Users/Thibaut/DevDocs/Docs/Erlang19' | ||
| 56 | end | 53 | end |
| 57 | 54 | ||
| 58 | version '18' do | 55 | version '18' do |
| 59 | self.release = '18.3' | 56 | self.release = '18.3' |
| 60 | self.dir = '/Users/Thibaut/DevDocs/Docs/Erlang18' | ||
| 61 | end | 57 | end |
| 62 | end | 58 | end |
| 63 | end | 59 | end |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Eslint < UrlScraper | 2 | class Eslint < UrlScraper |
| 3 | self.name = 'ESLint' | 3 | self.name = 'ESLint' |
| 4 | self.type = 'simple' | 4 | self.type = 'simple' |
| 5 | self.release = '4.19.0' | 5 | self.release = '5.8.0' |
| 6 | self.base_url = 'https://eslint.org/docs/' | 6 | self.base_url = 'https://eslint.org/docs/' |
| 7 | self.root_path = 'user-guide/getting-started' | 7 | self.root_path = 'user-guide/getting-started' |
| 8 | self.links = { | 8 | self.links = { |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Express < UrlScraper | 2 | class Express < UrlScraper |
| 3 | self.name = 'Express' | 3 | self.name = 'Express' |
| 4 | self.type = 'express' | 4 | self.type = 'express' |
| 5 | self.release = '4.16.1' | 5 | self.release = '4.16.3' |
| 6 | self.base_url = 'http://expressjs.com/en/' | 6 | self.base_url = 'http://expressjs.com/en/' |
| 7 | self.root_path = '4x/api.html' | 7 | self.root_path = '4x/api.html' |
| 8 | self.initial_paths = %w( | 8 | self.initial_paths = %w( |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Fish < UrlScraper | 2 | class Fish < UrlScraper |
| 3 | self.name = 'Fish' | 3 | self.name = 'Fish' |
| 4 | self.type = 'fish' | 4 | self.type = 'simple' |
| 5 | self.root_path = 'index.html' | 5 | self.root_path = 'index.html' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://fishshell.com/', | 7 | home: 'https://fishshell.com/', |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Flow < UrlScraper | 2 | class Flow < UrlScraper |
| 3 | self.type = 'flow' | 3 | self.type = 'simple' |
| 4 | self.release = '0.79.1' | 4 | self.release = '0.85.0' |
| 5 | self.base_url = 'https://flow.org/en/docs/' | 5 | self.base_url = 'https://flow.org/en/docs/' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://flow.org/', | 7 | home: 'https://flow.org/', |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Git < UrlScraper | 2 | class Git < UrlScraper |
| 3 | self.type = 'git' | 3 | self.type = 'git' |
| 4 | self.release = '2.17.0' | 4 | self.release = '2.19.1' |
| 5 | self.base_url = 'https://git-scm.com/docs' | 5 | self.base_url = 'https://git-scm.com/docs' |
| 6 | self.initial_paths = %w(/git.html) | 6 | self.initial_paths = %w(/git.html) |
| 7 | self.links = { | 7 | self.links = { |
| @@ -1,6 +1,6 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Gnu < FileScraper | 2 | class Gnu < FileScraper |
| 3 | self.type = 'gnu' | 3 | self.type = 'simple' |
| 4 | self.root_path = 'index.html' | 4 | self.root_path = 'index.html' |
| 5 | self.abstract = 'true' | 5 | self.abstract = 'true' |
| 6 | 6 | ||
| @@ -48,13 +48,11 @@ module Docs · 47 unmodified lines | |||
| 48 | 48 | ||
| 49 | version '7' do | 49 | version '7' do |
| 50 | self.release = '7.3.0' | 50 | self.release = '7.3.0' |
| 51 | self.dir = '/Users/Thibaut/DevDocs/Docs/gcc7' | ||
| 52 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/" | 51 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/" |
| 53 | end | 52 | end |
| 54 | 53 | ||
| 55 | version '7 CPP' do | 54 | version '7 CPP' do |
| 56 | self.release = '7.3.0' | 55 | self.release = '7.3.0' |
| 57 | self.dir = '/Users/Thibaut/DevDocs/Docs/gcpp7' | ||
| 58 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/" | 56 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/" |
| 59 | 57 | ||
| 60 | options[:replace_paths] = CPP_PATHS | 58 | options[:replace_paths] = CPP_PATHS |
| @@ -62,7 +60,6 @@ module Docs · 1 unmodified line | |||
| 62 | 60 | ||
| 63 | version '6' do | 61 | version '6' do |
| 64 | self.release = '6.4.0' | 62 | self.release = '6.4.0' |
| 65 | self.dir = '/Users/Thibaut/DevDocs/Docs/gcc6' | ||
| 66 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/" | 63 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/" |
| 67 | 64 | ||
| 68 | options[:root_title] = 'Using the GNU Compiler Collection (GCC)' | 65 | options[:root_title] = 'Using the GNU Compiler Collection (GCC)' |
| @@ -70,7 +67,6 @@ module Docs · 1 unmodified line | |||
| 70 | 67 | ||
| 71 | version '6 CPP' do | 68 | version '6 CPP' do |
| 72 | self.release = '6.4.0' | 69 | self.release = '6.4.0' |
| 73 | self.dir = '/Users/Thibaut/DevDocs/Docs/gcpp6' | ||
| 74 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/" | 70 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/" |
| 75 | 71 | ||
| 76 | options[:replace_paths] = CPP_PATHS | 72 | options[:replace_paths] = CPP_PATHS |
| @@ -78,7 +74,6 @@ module Docs · 1 unmodified line | |||
| 78 | 74 | ||
| 79 | version '5' do | 75 | version '5' do |
| 80 | self.release = '5.4.0' | 76 | self.release = '5.4.0' |
| 81 | self.dir = '/Users/Thibaut/DevDocs/Docs/gcc5' | ||
| 82 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/" | 77 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/" |
| 83 | 78 | ||
| 84 | options[:root_title] = 'Using the GNU Compiler Collection (GCC)' | 79 | options[:root_title] = 'Using the GNU Compiler Collection (GCC)' |
| @@ -86,7 +81,6 @@ module Docs · 1 unmodified line | |||
| 86 | 81 | ||
| 87 | version '5 CPP' do | 82 | version '5 CPP' do |
| 88 | self.release = '5.4.0' | 83 | self.release = '5.4.0' |
| 89 | self.dir = '/Users/Thibaut/DevDocs/Docs/gcpp5' | ||
| 90 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/" | 84 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/" |
| 91 | 85 | ||
| 92 | options[:replace_paths] = CPP_PATHS | 86 | options[:replace_paths] = CPP_PATHS |
| @@ -94,7 +88,6 @@ module Docs · 1 unmodified line | |||
| 94 | 88 | ||
| 95 | version '4' do | 89 | version '4' do |
| 96 | self.release = '4.9.3' | 90 | self.release = '4.9.3' |
| 97 | self.dir = '/Users/Thibaut/DevDocs/Docs/gcc4' | ||
| 98 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/" | 91 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gcc/" |
| 99 | 92 | ||
| 100 | options[:root_title] = 'Using the GNU Compiler Collection (GCC)' | 93 | options[:root_title] = 'Using the GNU Compiler Collection (GCC)' |
| @@ -102,7 +95,6 @@ module Docs · 1 unmodified line | |||
| 102 | 95 | ||
| 103 | version '4 CPP' do | 96 | version '4 CPP' do |
| 104 | self.release = '4.9.3' | 97 | self.release = '4.9.3' |
| 105 | self.dir = '/Users/Thibaut/DevDocs/Docs/gcpp4' | ||
| 106 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/" | 98 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/cpp/" |
| 107 | 99 | ||
| 108 | options[:replace_paths] = CPP_PATHS | 100 | options[:replace_paths] = CPP_PATHS |
| @@ -8,25 +8,21 @@ module Docs · 7 unmodified lines | |||
| 8 | 8 | ||
| 9 | version '7' do | 9 | version '7' do |
| 10 | self.release = '7.3.0' | 10 | self.release = '7.3.0' |
| 11 | self.dir = '/Users/Thibaut/DevDocs/Docs/gfortran7' | ||
| 12 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" | 11 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" |
| 13 | end | 12 | end |
| 14 | 13 | ||
| 15 | version '6' do | 14 | version '6' do |
| 16 | self.release = '6.4.0' | 15 | self.release = '6.4.0' |
| 17 | self.dir = '/Users/Thibaut/DevDocs/Docs/gfortran6' | ||
| 18 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" | 16 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" |
| 19 | end | 17 | end |
| 20 | 18 | ||
| 21 | version '5' do | 19 | version '5' do |
| 22 | self.release = '5.4.0' | 20 | self.release = '5.4.0' |
| 23 | self.dir = '/Users/Thibaut/DevDocs/Docs/gfortran5' | ||
| 24 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" | 21 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" |
| 25 | end | 22 | end |
| 26 | 23 | ||
| 27 | version '4' do | 24 | version '4' do |
| 28 | self.release = '4.9.3' | 25 | self.release = '4.9.3' |
| 29 | self.dir = '/Users/Thibaut/DevDocs/Docs/gfortran4' | ||
| 30 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" | 26 | self.base_url = "https://gcc.gnu.org/onlinedocs/gcc-#{release}/gfortran/" |
| 31 | end | 27 | end |
| 32 | end | 28 | end |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Go < UrlScraper | 2 | class Go < UrlScraper |
| 3 | self.type = 'go' | 3 | self.type = 'go' |
| 4 | self.release = '1.10.1' | 4 | self.release = '1.11.2' |
| 5 | self.base_url = 'https://golang.org/pkg/' | 5 | self.base_url = 'https://golang.org/pkg/' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://golang.org/', | 7 | home: 'https://golang.org/', |
| @@ -29,7 +29,7 @@ module Docs · 28 unmodified lines | |||
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | version '3.0' do | 31 | version '3.0' do |
| 32 | self.release = '3.0' | 32 | self.release = '3.0.6' |
| 33 | self.base_url = "http://docs.godotengine.org/en/#{self.version}/" | 33 | self.base_url = "http://docs.godotengine.org/en/#{self.version}/" |
| 34 | end | 34 | end |
| 35 | 35 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Graphite < UrlScraper | 2 | class Graphite < UrlScraper |
| 3 | self.type = 'graphite' | 3 | self.type = 'graphite' |
| 4 | self.release = '1.1.3' | 4 | self.release = '1.1.4' |
| 5 | self.base_url = 'https://graphite.readthedocs.io/en/latest/' | 5 | self.base_url = 'https://graphite.readthedocs.io/en/latest/' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | code: 'https://github.com/graphite-project/graphite-web' | 7 | code: 'https://github.com/graphite-project/graphite-web' |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Grunt < UrlScraper | 2 | class Grunt < UrlScraper |
| 3 | self.name = 'Grunt' | 3 | self.name = 'Grunt' |
| 4 | self.type = 'grunt' | 4 | self.type = 'simple' |
| 5 | self.release = '1.0.1' | 5 | self.release = '1.0.1' |
| 6 | self.base_url = 'https://gruntjs.com/' | 6 | self.base_url = 'https://gruntjs.com/' |
| 7 | self.root_path = 'getting-started' | 7 | self.root_path = 'getting-started' |
| @@ -0,0 +1,23 @@ | |||
| 1 | module Docs | ||
| 2 | class Handlebars < UrlScraper | ||
| 3 | self.name = 'Handlebars.js' | ||
| 4 | self.slug = 'handlebars' | ||
| 5 | self.type = 'simple' | ||
| 6 | self.release = '4.0.12' | ||
| 7 | self.base_url = 'https://handlebarsjs.com/' | ||
| 8 | self.links = { | ||
| 9 | home: 'https://handlebarsjs.com/', | ||
| 10 | code: 'https://github.com/wycats/handlebars.js/' | ||
| 11 | } | ||
| 12 | |||
| 13 | html_filters.push 'handlebars/entries', 'handlebars/clean_html', 'title' | ||
| 14 | |||
| 15 | options[:container] = '#contents' | ||
| 16 | options[:root_title] = 'Handlebars.js' | ||
| 17 | |||
| 18 | options[:attribution] = <<-HTML | ||
| 19 | © 2011–2017 by Yehuda Katz<br> | ||
| 20 | Licensed under the MIT License. | ||
| 21 | HTML | ||
| 22 | end | ||
| 23 | end | ||
| @@ -57,7 +57,7 @@ module Docs · 56 unmodified lines | |||
| 57 | end | 57 | end |
| 58 | 58 | ||
| 59 | version '8' do | 59 | version '8' do |
| 60 | self.release = '8.2.1' | 60 | self.release = '8.6.1' |
| 61 | self.base_url = "https://downloads.haskell.org/~ghc/#{release}/docs/html/" | 61 | self.base_url = "https://downloads.haskell.org/~ghc/#{release}/docs/html/" |
| 62 | end | 62 | end |
| 63 | 63 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Haxe < UrlScraper | 2 | class Haxe < UrlScraper |
| 3 | self.name = 'Haxe' | 3 | self.name = 'Haxe' |
| 4 | self.type = 'haxe' | 4 | self.type = 'simple' |
| 5 | self.release = '3.4.7' | 5 | self.release = '3.4.7' |
| 6 | self.base_url = 'https://api.haxe.org/' | 6 | self.base_url = 'https://api.haxe.org/' |
| 7 | 7 | ||
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Homebrew < UrlScraper | 2 | class Homebrew < UrlScraper |
| 3 | self.name = 'Homebrew' | 3 | self.name = 'Homebrew' |
| 4 | self.type = 'simple' | 4 | self.type = 'simple' |
| 5 | self.release = '1.4.2' | 5 | self.release = '1.8.1' |
| 6 | self.base_url = 'https://docs.brew.sh/' | 6 | self.base_url = 'https://docs.brew.sh/' |
| 7 | self.links = { | 7 | self.links = { |
| 8 | home: 'https://brew.sh', | 8 | home: 'https://brew.sh', |
| @@ -13,8 +13,7 @@ module Docs · 4 unmodified lines | |||
| 13 | 13 | ||
| 14 | options[:container] = ->(filter) { filter.root_page? ? '#home' : '#page' } | 14 | options[:container] = ->(filter) { filter.root_page? ? '#home' : '#page' } |
| 15 | 15 | ||
| 16 | options[:skip_patterns] = [/maintainer/i, /core\-contributor/i] | 16 | options[:skip_patterns] = [/maintainer/i, /core\-contributor/i, /kickstarter/i] |
| 17 | options[:skip] = %w(Kickstarter-Supporters.html) | ||
| 18 | 17 | ||
| 19 | options[:attribution] = <<-HTML | 18 | options[:attribution] = <<-HTML |
| 20 | © 2009–present Homebrew contributors<br> | 19 | © 2009–present Homebrew contributors<br> |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Immutable < UrlScraper | 2 | class Immutable < UrlScraper |
| 3 | self.name = 'Immutable.js' | 3 | self.name = 'Immutable.js' |
| 4 | self.slug = 'immutable' | 4 | self.slug = 'immutable' |
| 5 | self.type = 'immutable' | 5 | self.type = 'simple' |
| 6 | self.release = '3.8.1' | 6 | self.release = '3.8.1' |
| 7 | self.base_url = 'https://facebook.github.io/immutable-js/docs/' | 7 | self.base_url = 'https://facebook.github.io/immutable-js/docs/' |
| 8 | self.links = { | 8 | self.links = { |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Influxdata < UrlScraper | 2 | class Influxdata < UrlScraper |
| 3 | self.name = 'InfluxData' | 3 | self.name = 'InfluxData' |
| 4 | self.type = 'influxdata' | 4 | self.type = 'simple' |
| 5 | self.release = '1.3' | 5 | self.release = '1.3' |
| 6 | self.base_url = 'https://docs.influxdata.com/' | 6 | self.base_url = 'https://docs.influxdata.com/' |
| 7 | self.links = { | 7 | self.links = { |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Jasmine < UrlScraper | 2 | class Jasmine < UrlScraper |
| 3 | self.type = 'jasmine' | 3 | self.type = 'simple' |
| 4 | self.release = '3.2.1' | 4 | self.release = '3.3.0' |
| 5 | self.base_url = 'https://jasmine.github.io/api/3.2/' | 5 | self.base_url = 'https://jasmine.github.io/api/3.2/' |
| 6 | self.root_path = 'index.html' | 6 | self.root_path = 'index.html' |
| 7 | self.links = { | 7 | self.links = { |
| @@ -1,6 +1,6 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Jest < UrlScraper | 2 | class Jest < UrlScraper |
| 3 | self.type = 'jest' | 3 | self.type = 'simple' |
| 4 | self.release = '23.5.0' | 4 | self.release = '23.5.0' |
| 5 | self.base_url = 'https://jestjs.io/docs/en/' | 5 | self.base_url = 'https://jestjs.io/docs/en/' |
| 6 | self.root_path = 'getting-started' | 6 | self.root_path = 'getting-started' |
| @@ -8,12 +8,12 @@ module Docs · 7 unmodified lines | |||
| 8 | options[:only_patterns] = [/\Amanual\//, /\Astdlib\//] | 8 | options[:only_patterns] = [/\Amanual\//, /\Astdlib\//] |
| 9 | 9 | ||
| 10 | options[:attribution] = <<-HTML | 10 | options[:attribution] = <<-HTML |
| 11 | © 2009–2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors<br> | 11 | © 2009–2018 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors<br> |
| 12 | Licensed under the MIT License. | 12 | Licensed under the MIT License. |
| 13 | HTML | 13 | HTML |
| 14 | 14 | ||
| 15 | version '1.0' do | 15 | version '1.0' do |
| 16 | self.release = '1.0.0' | 16 | self.release = '1.0.1' |
| 17 | self.base_url = "https://docs.julialang.org/en/v#{release}/" | 17 | self.base_url = "https://docs.julialang.org/en/v#{release}/" |
| 18 | self.type = 'julia' | 18 | self.type = 'julia' |
| 19 | 19 | ||
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | module Docs | 3 | module Docs |
| 4 | class Koa < Github | 4 | class Koa < Github |
| 5 | self.base_url = 'https://github.com/koajs/koa/blob/master/docs/' | 5 | self.base_url = 'https://github.com/koajs/koa/blob/master/docs/' |
| 6 | self.release = '2.5.1' | 6 | self.release = '2.6.1' |
| 7 | 7 | ||
| 8 | self.root_path = 'api/index.md' | 8 | self.root_path = 'api/index.md' |
| 9 | self.initial_paths = %w[ | 9 | self.initial_paths = %w[ |
| @@ -29,6 +29,19 @@ module Docs · 28 unmodified lines | |||
| 29 | Laravel is a trademark of Taylor Otwell. | 29 | Laravel is a trademark of Taylor Otwell. |
| 30 | HTML | 30 | HTML |
| 31 | 31 | ||
| 32 | version '5.7' do | ||
| 33 | self.release = '5.7.7' | ||
| 34 | self.root_path = '/api/5.7/index.html' | ||
| 35 | self.initial_paths = %w(/docs/5.7/installation /api/5.7/classes.html) | ||
| 36 | |||
| 37 | options[:only_patterns] = [%r{\A/api/5\.7/}, %r{\A/docs/5\.7/}] | ||
| 38 | |||
| 39 | options[:fix_urls] = ->(url) do | ||
| 40 | url.sub! %r{#{Regexp.escape(Laravel.base_url)}/docs\/(?!\d)}, "#{Laravel.base_url}/docs/5.7/" | ||
| 41 | url | ||
| 42 | end | ||
| 43 | end | ||
| 44 | |||
| 32 | version '5.6' do | 45 | version '5.6' do |
| 33 | self.release = '5.6.33' | 46 | self.release = '5.6.33' |
| 34 | self.root_path = '/api/5.6/index.html' | 47 | self.root_path = '/api/5.6/index.html' |
| @@ -20,7 +20,7 @@ module Docs · 19 unmodified lines | |||
| 20 | HTML | 20 | HTML |
| 21 | 21 | ||
| 22 | version '1.3' do | 22 | version '1.3' do |
| 23 | self.release = '1.3.0' | 23 | self.release = '1.3.4' |
| 24 | self.base_url = "https://leafletjs.com/reference-#{release}.html" | 24 | self.base_url = "https://leafletjs.com/reference-#{release}.html" |
| 25 | end | 25 | end |
| 26 | 26 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Less < UrlScraper | 2 | class Less < UrlScraper |
| 3 | self.type = 'less' | 3 | self.type = 'simple' |
| 4 | self.release = '2.7.2' | 4 | self.release = '2.7.2' |
| 5 | self.base_url = 'http://lesscss.org' | 5 | self.base_url = 'http://lesscss.org' |
| 6 | self.root_path = '/features' | 6 | self.root_path = '/features' |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Lodash < UrlScraper | 2 | class Lodash < UrlScraper |
| 3 | self.name = 'lodash' | 3 | self.name = 'lodash' |
| 4 | self.slug = 'lodash' | 4 | self.slug = 'lodash' |
| 5 | self.type = 'lodash' | 5 | self.type = 'simple' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://lodash.com/', | 7 | home: 'https://lodash.com/', |
| 8 | code: 'https://github.com/lodash/lodash/' | 8 | code: 'https://github.com/lodash/lodash/' |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Marionette < UrlScraper | 2 | class Marionette < UrlScraper |
| 3 | self.name = 'Marionette.js' | 3 | self.name = 'Marionette.js' |
| 4 | self.slug = 'marionette' | 4 | self.slug = 'marionette' |
| 5 | self.type = 'marionette' | 5 | self.type = 'simple' |
| 6 | self.root_path = 'index' | 6 | self.root_path = 'index' |
| 7 | self.links = { | 7 | self.links = { |
| 8 | home: 'https://marionettejs.com/', | 8 | home: 'https://marionettejs.com/', |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Markdown < UrlScraper | 2 | class Markdown < UrlScraper |
| 3 | self.name = 'Markdown' | 3 | self.name = 'Markdown' |
| 4 | self.type = 'markdown' | 4 | self.type = 'simple' |
| 5 | self.base_url = 'http://daringfireball.net/projects/markdown/syntax' | 5 | self.base_url = 'http://daringfireball.net/projects/markdown/syntax' |
| 6 | 6 | ||
| 7 | html_filters.push 'markdown/clean_html', 'markdown/entries' | 7 | html_filters.push 'markdown/clean_html', 'markdown/entries' |
| @@ -6,7 +6,7 @@ module Docs · 5 unmodified lines | |||
| 6 | self.type = 'sphinx' | 6 | self.type = 'sphinx' |
| 7 | self.root_path = 'index.html' | 7 | self.root_path = 'index.html' |
| 8 | self.links = { | 8 | self.links = { |
| 9 | home: 'http://matplotlib.org/', | 9 | home: 'https://matplotlib.org/', |
| 10 | code: 'https://github.com/matplotlib/matplotlib' | 10 | code: 'https://github.com/matplotlib/matplotlib' |
| 11 | } | 11 | } |
| 12 | 12 | ||
| @@ -16,34 +16,52 @@ module Docs · 3 unmodified lines | |||
| 16 | options[:skip] = %w(api_changes.html tutorial.html faq.html) | 16 | options[:skip] = %w(api_changes.html tutorial.html faq.html) |
| 17 | 17 | ||
| 18 | options[:attribution] = <<-HTML | 18 | options[:attribution] = <<-HTML |
| 19 | © 2012–2017 Matplotlib Development Team. All rights reserved.<br> | 19 | © 2012–2018 Matplotlib Development Team. All rights reserved.<br> |
| 20 | Licensed under the Matplotlib License Agreement. | 20 | Licensed under the Matplotlib License Agreement. |
| 21 | HTML | 21 | HTML |
| 22 | 22 | ||
| 23 | version '3.0' do | ||
| 24 | self.release = '3.0.0' | ||
| 25 | self.base_urls = [ | ||
| 26 | "https://matplotlib.org/#{release}/api/", | ||
| 27 | "https://matplotlib.org/#{release}/mpl_toolkits/mplot3d/", | ||
| 28 | "https://matplotlib.org/#{release}/mpl_toolkits/axes_grid/api/" | ||
| 29 | ] | ||
| 30 | end | ||
| 31 | |||
| 32 | version '2.2' do | ||
| 33 | self.release = '2.2.3' | ||
| 34 | self.base_urls = [ | ||
| 35 | "https://matplotlib.org/#{release}/api/", | ||
| 36 | "https://matplotlib.org/#{release}/mpl_toolkits/mplot3d/", | ||
| 37 | "https://matplotlib.org/#{release}/mpl_toolkits/axes_grid/api/" | ||
| 38 | ] | ||
| 39 | end | ||
| 40 | |||
| 23 | version '2.1' do | 41 | version '2.1' do |
| 24 | self.release = '2.1.0' | 42 | self.release = '2.1.0' |
| 25 | self.base_urls = [ | 43 | self.base_urls = [ |
| 26 | "http://matplotlib.org/#{release}/api/", | 44 | "https://matplotlib.org/#{release}/api/", |
| 27 | "http://matplotlib.org/#{release}/mpl_toolkits/mplot3d/", | 45 | "https://matplotlib.org/#{release}/mpl_toolkits/mplot3d/", |
| 28 | "http://matplotlib.org/#{release}/mpl_toolkits/axes_grid/api/" | 46 | "https://matplotlib.org/#{release}/mpl_toolkits/axes_grid/api/" |
| 29 | ] | 47 | ] |
| 30 | end | 48 | end |
| 31 | 49 | ||
| 32 | version '2.0' do | 50 | version '2.0' do |
| 33 | self.release = '2.0.2' | 51 | self.release = '2.0.2' |
| 34 | self.base_urls = [ | 52 | self.base_urls = [ |
| 35 | "http://matplotlib.org/#{release}/api/", | 53 | "https://matplotlib.org/#{release}/api/", |
| 36 | "http://matplotlib.org/#{release}/mpl_toolkits/mplot3d/", | 54 | "https://matplotlib.org/#{release}/mpl_toolkits/mplot3d/", |
| 37 | "http://matplotlib.org/#{release}/mpl_toolkits/axes_grid/api/" | 55 | "https://matplotlib.org/#{release}/mpl_toolkits/axes_grid/api/" |
| 38 | ] | 56 | ] |
| 39 | end | 57 | end |
| 40 | 58 | ||
| 41 | version '1.5' do | 59 | version '1.5' do |
| 42 | self.release = '1.5.3' | 60 | self.release = '1.5.3' |
| 43 | self.base_urls = [ | 61 | self.base_urls = [ |
| 44 | "http://matplotlib.org/#{release}/api/", | 62 | "https://matplotlib.org/#{release}/api/", |
| 45 | "http://matplotlib.org/#{release}/mpl_toolkits/mplot3d/", | 63 | "https://matplotlib.org/#{release}/mpl_toolkits/mplot3d/", |
| 46 | "http://matplotlib.org/#{release}/mpl_toolkits/axes_grid/api/" | 64 | "https://matplotlib.org/#{release}/mpl_toolkits/axes_grid/api/" |
| 47 | ] | 65 | ] |
| 48 | end | 66 | end |
| 49 | end | 67 | end |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Mocha < UrlScraper | 2 | class Mocha < UrlScraper |
| 3 | self.type = 'mocha' | 3 | self.type = 'simple' |
| 4 | self.release = '5.0.1' | 4 | self.release = '5.2.0' |
| 5 | self.base_url = 'https://mochajs.org/' | 5 | self.base_url = 'https://mochajs.org/' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://mochajs.org/', | 7 | home: 'https://mochajs.org/', |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Mongoose < UrlScraper | 2 | class Mongoose < UrlScraper |
| 3 | self.name = 'Mongoose' | 3 | self.name = 'Mongoose' |
| 4 | self.type = 'mongoose' | 4 | self.type = 'simple' |
| 5 | self.release = '4.13.1' | 5 | self.release = '4.13.1' |
| 6 | self.base_url = 'http://mongoosejs.com/docs/' | 6 | self.base_url = 'http://mongoosejs.com/docs/' |
| 7 | self.root_path = 'index.html' | 7 | self.root_path = 'index.html' |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Nginx < UrlScraper | 2 | class Nginx < UrlScraper |
| 3 | self.name = 'nginx' | 3 | self.name = 'nginx' |
| 4 | self.type = 'nginx' | 4 | self.type = 'nginx' |
| 5 | self.release = '1.15.0' | 5 | self.release = '1.15.5' |
| 6 | self.base_url = 'https://nginx.org/en/docs/' | 6 | self.base_url = 'https://nginx.org/en/docs/' |
| 7 | self.links = { | 7 | self.links = { |
| 8 | home: 'https://nginx.org/', | 8 | home: 'https://nginx.org/', |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Nim < UrlScraper | 2 | class Nim < UrlScraper |
| 3 | self.type = 'nim' | 3 | self.type = 'simple' |
| 4 | self.release = '0.18.0' | 4 | self.release = '0.19.0' |
| 5 | self.base_url = 'https://nim-lang.org/docs/' | 5 | self.base_url = 'https://nim-lang.org/docs/' |
| 6 | self.root_path = 'overview.html' | 6 | self.root_path = 'overview.html' |
| 7 | self.links = { | 7 | self.links = { |
| @@ -14,7 +14,7 @@ module Docs · 6 unmodified lines | |||
| 14 | options[:skip] = %w(theindex.html docgen.txt) | 14 | options[:skip] = %w(theindex.html docgen.txt) |
| 15 | 15 | ||
| 16 | options[:attribution] = <<-HTML | 16 | options[:attribution] = <<-HTML |
| 17 | © 2006–2017 Andreas Rumpf<br> | 17 | © 2006–2018 Andreas Rumpf<br> |
| 18 | Licensed under the MIT License. | 18 | Licensed under the MIT License. |
| 19 | HTML | 19 | HTML |
| 20 | end | 20 | end |
| @@ -23,12 +23,17 @@ module Docs · 22 unmodified lines | |||
| 23 | HTML | 23 | HTML |
| 24 | 24 | ||
| 25 | version do | 25 | version do |
| 26 | self.release = '10.9.0' | 26 | self.release = '11.1.0' |
| 27 | self.base_url = 'https://nodejs.org/dist/latest-v11.x/docs/api/' | ||
| 28 | end | ||
| 29 | |||
| 30 | version '10 LTS' do | ||
| 31 | self.release = '10.13.0' | ||
| 27 | self.base_url = 'https://nodejs.org/dist/latest-v10.x/docs/api/' | 32 | self.base_url = 'https://nodejs.org/dist/latest-v10.x/docs/api/' |
| 28 | end | 33 | end |
| 29 | 34 | ||
| 30 | version '8 LTS' do | 35 | version '8 LTS' do |
| 31 | self.release = '8.11.4' | 36 | self.release = '8.12.0' |
| 32 | self.base_url = 'https://nodejs.org/dist/latest-v8.x/docs/api/' | 37 | self.base_url = 'https://nodejs.org/dist/latest-v8.x/docs/api/' |
| 33 | end | 38 | end |
| 34 | 39 | ||
| @@ -1,9 +1,13 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Nokogiri2 < Rdoc | 2 | class Nokogiri2 < Rdoc |
| 3 | # Instructions: | ||
| 4 | # 1. Download the latest release at https://github.com/sparklemotion/nokogiri/releases | ||
| 5 | # 2. Run "bundle install && bundle exec rake docs" (in the Nokogiri directory) | ||
| 6 | # 4. Copy the "doc" directory to "docs/nokgiri" | ||
| 7 | |||
| 3 | self.name = 'Nokogiri' | 8 | self.name = 'Nokogiri' |
| 4 | self.slug = 'nokogiri' | 9 | self.slug = 'nokogiri' |
| 5 | self.release = '1.8.1' | 10 | self.release = '1.9.0' |
| 6 | self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Nokogiri' | ||
| 7 | 11 | ||
| 8 | html_filters.replace 'rdoc/entries', 'nokogiri2/entries' | 12 | html_filters.replace 'rdoc/entries', 'nokogiri2/entries' |
| 9 | 13 | ||
| @@ -11,8 +15,8 @@ module Docs · 1 unmodified line | |||
| 11 | options[:only_patterns] = [/\ANokogiri/, /\AXSD/] | 15 | options[:only_patterns] = [/\ANokogiri/, /\AXSD/] |
| 12 | 16 | ||
| 13 | options[:attribution] = <<-HTML | 17 | options[:attribution] = <<-HTML |
| 14 | © 2008–2017 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo<br> | 18 | © 2008–2018 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo,<br> |
| 15 | Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid<br> | 19 | Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid, Lars Kanis<br> |
| 16 | Licensed under the MIT License. | 20 | Licensed under the MIT License. |
| 17 | HTML | 21 | HTML |
| 18 | end | 22 | end |
| @@ -2,7 +2,6 @@ module Docs · 1 unmodified line | |||
| 2 | class Numpy < FileScraper | 2 | class Numpy < FileScraper |
| 3 | self.name = 'NumPy' | 3 | self.name = 'NumPy' |
| 4 | self.type = 'sphinx' | 4 | self.type = 'sphinx' |
| 5 | self.dir = '/Users/Thibaut/DevDocs/Docs/numpy/reference/' | ||
| 6 | self.root_path = 'index.html' | 5 | self.root_path = 'index.html' |
| 7 | self.links = { | 6 | self.links = { |
| 8 | home: 'http://www.numpy.org/', | 7 | home: 'http://www.numpy.org/', |
| @@ -1,11 +1,10 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Openjdk < FileScraper | 2 | class Openjdk < FileScraper |
| 3 | # Downloaded from packages.debian.org/sid/openjdk-8-doc | ||
| 4 | # Extracting subdirectory /usr/share/doc/openjdk-8-jre-headless/api | ||
| 3 | self.name = 'OpenJDK' | 5 | self.name = 'OpenJDK' |
| 4 | self.type = 'openjdk' | 6 | self.type = 'openjdk' |
| 5 | self.root_path = 'overview-summary.html' | 7 | self.root_path = 'overview-summary.html' |
| 6 | # Downloaded from packages.debian.org/sid/openjdk-8-doc | ||
| 7 | # Extracting subdirectory /usr/share/doc/openjdk-8-jre-headless/api | ||
| 8 | self.dir = '/Users/Thibaut/DevDocs/Docs/OpenJDK' | ||
| 9 | 8 | ||
| 10 | html_filters.insert_after 'internal_urls', 'openjdk/clean_urls' | 9 | html_filters.insert_after 'internal_urls', 'openjdk/clean_urls' |
| 11 | html_filters.push 'openjdk/entries', 'openjdk/clean_html' | 10 | html_filters.push 'openjdk/entries', 'openjdk/clean_html' |
| @@ -20,6 +20,11 @@ module Docs · 19 unmodified lines | |||
| 20 | Licensed under the 3-clause BSD License. | 20 | Licensed under the 3-clause BSD License. |
| 21 | HTML | 21 | HTML |
| 22 | 22 | ||
| 23 | version '0.23' do | ||
| 24 | self.release = '0.23.4' | ||
| 25 | self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/" | ||
| 26 | end | ||
| 27 | |||
| 23 | version '0.22' do | 28 | version '0.22' do |
| 24 | self.release = '0.22.0' | 29 | self.release = '0.22.0' |
| 25 | self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/" | 30 | self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/" |
| @@ -2,7 +2,6 @@ module Docs · 1 unmodified line | |||
| 2 | class Perl < FileScraper | 2 | class Perl < FileScraper |
| 3 | self.name = 'Perl' | 3 | self.name = 'Perl' |
| 4 | self.type = 'perl' | 4 | self.type = 'perl' |
| 5 | self.dir = '/Users/Thibaut/DevDocs/Docs/Perl' | ||
| 6 | self.root_path = 'index.html' | 5 | self.root_path = 'index.html' |
| 7 | self.links = { | 6 | self.links = { |
| 8 | home: 'https://www.perl.org/' | 7 | home: 'https://www.perl.org/' |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Phoenix < UrlScraper | 2 | class Phoenix < UrlScraper |
| 3 | self.type = 'elixir' | 3 | self.type = 'elixir' |
| 4 | self.release = '1.3.2' | 4 | self.release = '1.3.4' |
| 5 | self.base_url = 'https://hexdocs.pm/' | 5 | self.base_url = 'https://hexdocs.pm/' |
| 6 | self.root_path = 'phoenix/Phoenix.html' | 6 | self.root_path = 'phoenix/Phoenix.html' |
| 7 | self.initial_paths = %w( | 7 | self.initial_paths = %w( |
| @@ -1,5 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Php < FileScraper | 2 | class Php < FileScraper |
| 3 | # Downloaded from php.net/download-docs.php | ||
| 4 | |||
| 3 | include FixInternalUrlsBehavior | 5 | include FixInternalUrlsBehavior |
| 4 | 6 | ||
| 5 | self.name = 'PHP' | 7 | self.name = 'PHP' |
| @@ -23,9 +25,6 @@ module Docs · 17 unmodified lines | |||
| 23 | code: 'https://git.php.net/?p=php-src.git;a=summary' | 25 | code: 'https://git.php.net/?p=php-src.git;a=summary' |
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | # Downloaded from php.net/download-docs.php | ||
| 27 | self.dir = '/Users/Thibaut/DevDocs/Docs/PHP' | ||
| 28 | |||
| 29 | html_filters.push 'php/internal_urls', 'php/entries', 'php/clean_html', 'title' | 28 | html_filters.push 'php/internal_urls', 'php/entries', 'php/clean_html', 'title' |
| 30 | text_filters.push 'php/fix_urls' | 29 | text_filters.push 'php/fix_urls' |
| 31 | 30 | ||
| @@ -0,0 +1,18 @@ | |||
| 1 | module Docs | ||
| 2 | class Puppeteer < Github | ||
| 3 | self.release = '1.10.0' | ||
| 4 | self.base_url = 'https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md' | ||
| 5 | self.links = { | ||
| 6 | code: 'https://github.com/GoogleChrome/puppeteer' | ||
| 7 | } | ||
| 8 | |||
| 9 | html_filters.push 'puppeteer/entries', 'puppeteer/clean_html' | ||
| 10 | |||
| 11 | options[:container] = '.markdown-body' | ||
| 12 | |||
| 13 | options[:attribution] = <<-HTML | ||
| 14 | © 2017 Google Inc<br> | ||
| 15 | Licensed under the Apache License 2.0. | ||
| 16 | HTML | ||
| 17 | end | ||
| 18 | end | ||
| @@ -23,33 +23,29 @@ module Docs · 22 unmodified lines | |||
| 23 | Licensed under the PSF License. | 23 | Licensed under the PSF License. |
| 24 | HTML | 24 | HTML |
| 25 | 25 | ||
| 26 | version '3.7' do | 26 | version '3.7' do # docs.python.org/3.7/download.html |
| 27 | self.release = '3.7.0' | 27 | self.release = '3.7.0' |
| 28 | self.dir = '/Users/Thibaut/DevDocs/Docs/Python37' # docs.python.org/3.7/download.html | ||
| 29 | self.base_url = 'https://docs.python.org/3.7/' | 28 | self.base_url = 'https://docs.python.org/3.7/' |
| 30 | 29 | ||
| 31 | html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html' | 30 | html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html' |
| 32 | end | 31 | end |
| 33 | 32 | ||
| 34 | version '3.6' do | 33 | version '3.6' do # docs.python.org/3.6/download.html |
| 35 | self.release = '3.6.6' | 34 | self.release = '3.6.6' |
| 36 | self.dir = '/Users/Thibaut/DevDocs/Docs/Python36' # docs.python.org/3.6/download.html | ||
| 37 | self.base_url = 'https://docs.python.org/3.6/' | 35 | self.base_url = 'https://docs.python.org/3.6/' |
| 38 | 36 | ||
| 39 | html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html' | 37 | html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html' |
| 40 | end | 38 | end |
| 41 | 39 | ||
| 42 | version '3.5' do | 40 | version '3.5' do # docs.python.org/3.5/download.html |
| 43 | self.release = '3.5.3' | 41 | self.release = '3.5.3' |
| 44 | self.dir = '/Users/Thibaut/DevDocs/Docs/Python35' # docs.python.org/3.5/download.html | ||
| 45 | self.base_url = 'https://docs.python.org/3.5/' | 42 | self.base_url = 'https://docs.python.org/3.5/' |
| 46 | 43 | ||
| 47 | html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html' | 44 | html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html' |
| 48 | end | 45 | end |
| 49 | 46 | ||
| 50 | version '2.7' do | 47 | version '2.7' do # docs.python.org/2.7/download.html |
| 51 | self.release = '2.7.13' | 48 | self.release = '2.7.13' |
| 52 | self.dir = '/Users/Thibaut/DevDocs/Docs/Python27' # docs.python.org/2.7/download.html | ||
| 53 | self.base_url = 'https://docs.python.org/2.7/' | 49 | self.base_url = 'https://docs.python.org/2.7/' |
| 54 | 50 | ||
| 55 | html_filters.push 'python/entries_v2', 'sphinx/clean_html', 'python/clean_html' | 51 | html_filters.push 'python/entries_v2', 'sphinx/clean_html', 'python/clean_html' |
| @@ -1,9 +1,14 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Minitest < Rdoc | 2 | class Minitest < Rdoc |
| 3 | # Instructions: | ||
| 4 | # 1. Run "gem update rdoc hoe" | ||
| 5 | # 2. Download the source code at https://github.com/seattlerb/minitest | ||
| 6 | # 3. Run "rake docs" (in the Minitest directory) | ||
| 7 | # 4. Copy the "docs" directory to "docs/minitest" | ||
| 8 | |||
| 3 | self.name = 'Ruby / Minitest' | 9 | self.name = 'Ruby / Minitest' |
| 4 | self.slug = 'minitest' | 10 | self.slug = 'minitest' |
| 5 | self.release = '5.10.3' | 11 | self.release = '5.11.3' |
| 6 | self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Minitest' # rake docs | ||
| 7 | self.links = { | 12 | self.links = { |
| 8 | code: 'https://github.com/seattlerb/minitest' | 13 | code: 'https://github.com/seattlerb/minitest' |
| 9 | } | 14 | } |
| @@ -1,10 +1,17 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Rails < Rdoc | 2 | class Rails < Rdoc |
| 3 | # Instructions: | ||
| 4 | # 1. Download a release at https://github.com/rails/rails/releases | ||
| 5 | # 2. Open "railties/lib/rails/api/task.rb" and comment out any code related to sdoc ("configure_sdoc") | ||
| 6 | # 3. Run "bundle install --without db && bundle exec rake rdoc" (in the Rails directory) | ||
| 7 | # 4. Run "cd guides && bundle exec rake guides:generate:html" | ||
| 8 | # 5. Copy the "guides/output" directory to "html/guides" | ||
| 9 | # 6. Copy the "html" directory to "docs/rails~[version]" | ||
| 10 | |||
| 3 | include FixInternalUrlsBehavior | 11 | include FixInternalUrlsBehavior |
| 4 | 12 | ||
| 5 | self.name = 'Ruby on Rails' | 13 | self.name = 'Ruby on Rails' |
| 6 | self.slug = 'rails' | 14 | self.slug = 'rails' |
| 7 | self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Rails' | ||
| 8 | self.initial_paths = %w(guides/index.html) | 15 | self.initial_paths = %w(guides/index.html) |
| 9 | self.links = { | 16 | self.links = { |
| 10 | home: 'http://rubyonrails.org/', | 17 | home: 'http://rubyonrails.org/', |
| @@ -68,7 +75,7 @@ module Docs · 57 unmodified lines | |||
| 68 | end | 75 | end |
| 69 | 76 | ||
| 70 | version '5.2' do | 77 | version '5.2' do |
| 71 | self.release = '5.2.0' | 78 | self.release = '5.2.2' |
| 72 | end | 79 | end |
| 73 | 80 | ||
| 74 | version '5.1' do | 81 | version '5.1' do |
| @@ -80,7 +87,7 @@ module Docs · 5 unmodified lines | |||
| 80 | end | 87 | end |
| 81 | 88 | ||
| 82 | version '4.2' do | 89 | version '4.2' do |
| 83 | self.release = '4.2.10' | 90 | self.release = '4.2.11' |
| 84 | end | 91 | end |
| 85 | 92 | ||
| 86 | version '4.1' do | 93 | version '4.1' do |
| @@ -1,16 +1,9 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Ruby < Rdoc | 2 | class Ruby < Rdoc |
| 3 | # Generated with: | 3 | # Instructions: |
| 4 | # ./configure && make html | 4 | # 1. Download Ruby's source code |
| 5 | # or: | 5 | # 2. Run "./configure && make html" (in the Ruby directory) |
| 6 | # rdoc \ | 6 | # 3. Copy the ".ext/html" directory to "docs/ruby~[version]" |
| 7 | # --root . \ | ||
| 8 | # --page-dir doc \ | ||
| 9 | # --encoding=UTF-8 \ | ||
| 10 | # --visibility=public \ | ||
| 11 | # --format=darkfish \ | ||
| 12 | # --no-line-numbers \ | ||
| 13 | # --op html . | ||
| 14 | 7 | ||
| 15 | include FixInternalUrlsBehavior | 8 | include FixInternalUrlsBehavior |
| 16 | 9 | ||
| @@ -77,23 +70,19 @@ module Docs · 60 unmodified lines | |||
| 77 | HTML | 70 | HTML |
| 78 | 71 | ||
| 79 | version '2.5' do | 72 | version '2.5' do |
| 80 | self.release = '2.5.0' | 73 | self.release = '2.5.3' |
| 81 | self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby25' | ||
| 82 | end | 74 | end |
| 83 | 75 | ||
| 84 | version '2.4' do | 76 | version '2.4' do |
| 85 | self.release = '2.4.3' | 77 | self.release = '2.4.5' |
| 86 | self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby24' | ||
| 87 | end | 78 | end |
| 88 | 79 | ||
| 89 | version '2.3' do | 80 | version '2.3' do |
| 90 | self.release = '2.3.6' | 81 | self.release = '2.3.8' |
| 91 | self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby23' | ||
| 92 | end | 82 | end |
| 93 | 83 | ||
| 94 | version '2.2' do | 84 | version '2.2' do |
| 95 | self.release = '2.2.9' | 85 | self.release = '2.2.10' |
| 96 | self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby22' | ||
| 97 | end | 86 | end |
| 98 | end | 87 | end |
| 99 | end | 88 | end |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class React < UrlScraper | 2 | class React < UrlScraper |
| 3 | self.name = 'React' | 3 | self.name = 'React' |
| 4 | self.type = 'simple' | 4 | self.type = 'simple' |
| 5 | self.release = '16.4.0' | 5 | self.release = '16.6.0' |
| 6 | self.base_url = 'https://reactjs.org/docs/' | 6 | self.base_url = 'https://reactjs.org/docs/' |
| 7 | self.root_path = 'hello-world.html' | 7 | self.root_path = 'hello-world.html' |
| 8 | self.links = { | 8 | self.links = { |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Redis < UrlScraper | 2 | class Redis < UrlScraper |
| 3 | self.type = 'redis' | 3 | self.type = 'redis' |
| 4 | self.release = '4.0.11' | 4 | self.release = '5.0.0' |
| 5 | self.base_url = 'https://redis.io/commands' | 5 | self.base_url = 'https://redis.io/commands' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://redis.io/', | 7 | home: 'https://redis.io/', |
| @@ -1,6 +1,6 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Redux < UrlScraper | 2 | class Redux < UrlScraper |
| 3 | self.type = 'redux' | 3 | self.type = 'simple' |
| 4 | self.release = '3.7.2' | 4 | self.release = '3.7.2' |
| 5 | self.base_url = 'http://redux.js.org/docs/' | 5 | self.base_url = 'http://redux.js.org/docs/' |
| 6 | self.links = { | 6 | self.links = { |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Requirejs < UrlScraper | 2 | class Requirejs < UrlScraper |
| 3 | self.name = 'RequireJS' | 3 | self.name = 'RequireJS' |
| 4 | self.type = 'requirejs' | 4 | self.type = 'simple' |
| 5 | self.release = '2.3.5' | 5 | self.release = '2.3.5' |
| 6 | self.base_url = 'http://requirejs.org/docs/' | 6 | self.base_url = 'http://requirejs.org/docs/' |
| 7 | self.links = { | 7 | self.links = { |
| @@ -1,7 +1,9 @@ | |||
| 1 | # frozen_string_literal: true | ||
| 2 | |||
| 1 | module Docs | 3 | module Docs |
| 2 | class Rust < UrlScraper | 4 | class Rust < UrlScraper |
| 3 | self.type = 'rust' | 5 | self.type = 'rust' |
| 4 | self.release = '1.28.0' | 6 | self.release = '1.30.1' |
| 5 | self.base_url = 'https://doc.rust-lang.org/' | 7 | self.base_url = 'https://doc.rust-lang.org/' |
| 6 | self.root_path = 'book/second-edition/index.html' | 8 | self.root_path = 'book/second-edition/index.html' |
| 7 | self.initial_paths = %w( | 9 | self.initial_paths = %w( |
| @@ -28,6 +30,7 @@ module Docs · 20 unmodified lines | |||
| 28 | options[:fix_urls] = ->(url) do | 30 | options[:fix_urls] = ->(url) do |
| 29 | url.sub! %r{(#{Rust.base_url}.+/)\z}, '\1index.html' | 31 | url.sub! %r{(#{Rust.base_url}.+/)\z}, '\1index.html' |
| 30 | url.sub! '/unicode/u_str', '/unicode/str/' | 32 | url.sub! '/unicode/u_str', '/unicode/str/' |
| 33 | url.sub! '/std/std/', '/std/' | ||
| 31 | url | 34 | url |
| 32 | end | 35 | end |
| 33 | 36 | ||
| @@ -3,8 +3,8 @@ module Docs · 2 unmodified lines | |||
| 3 | self.name = 'scikit-image' | 3 | self.name = 'scikit-image' |
| 4 | self.slug = 'scikit_image' | 4 | self.slug = 'scikit_image' |
| 5 | self.type = 'sphinx' | 5 | self.type = 'sphinx' |
| 6 | self.release = '0.13.1' | 6 | self.release = '0.14.1' |
| 7 | self.base_url = 'http://scikit-image.org/docs/0.13.x/' | 7 | self.base_url = 'http://scikit-image.org/docs/0.14.x/' |
| 8 | self.links = { | 8 | self.links = { |
| 9 | home: 'http://scikit-image.org/', | 9 | home: 'http://scikit-image.org/', |
| 10 | code: 'https://github.com/scikit-image/scikit-image' | 10 | code: 'https://github.com/scikit-image/scikit-image' |
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | |||
| 3 | self.name = 'scikit-learn' | 3 | self.name = 'scikit-learn' |
| 4 | self.slug = 'scikit_learn' | 4 | self.slug = 'scikit_learn' |
| 5 | self.type = 'sphinx' | 5 | self.type = 'sphinx' |
| 6 | self.release = '0.19.1' | 6 | self.release = '0.20.0' |
| 7 | self.base_url = 'http://scikit-learn.org/stable/' | 7 | self.base_url = 'http://scikit-learn.org/stable/' |
| 8 | self.root_path = 'documentation.html' | 8 | self.root_path = 'documentation.html' |
| 9 | self.force_gzip = true | 9 | self.force_gzip = true |
| @@ -21,7 +21,7 @@ module Docs · 11 unmodified lines | |||
| 21 | options[:max_image_size] = 256_000 | 21 | options[:max_image_size] = 256_000 |
| 22 | 22 | ||
| 23 | options[:attribution] = <<-HTML | 23 | options[:attribution] = <<-HTML |
| 24 | © 2007–2017 The scikit-learn developers<br> | 24 | © 2007–2018 The scikit-learn developers<br> |
| 25 | Licensed under the 3-clause BSD License. | 25 | Licensed under the 3-clause BSD License. |
| 26 | HTML | 26 | HTML |
| 27 | 27 | ||
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | |||
| 4 | self.slug = 'sinon' | 4 | self.slug = 'sinon' |
| 5 | self.type = 'sinon' | 5 | self.type = 'sinon' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'http://sinonjs.org/', | 7 | home: 'https://sinonjs.org/', |
| 8 | code: 'https://github.com/sinonjs/sinon' | 8 | code: 'https://github.com/sinonjs/sinon' |
| 9 | } | 9 | } |
| 10 | 10 | ||
| @@ -18,34 +18,39 @@ module Docs · 7 unmodified lines | |||
| 18 | Licensed under the BSD License. | 18 | Licensed under the BSD License. |
| 19 | HTML | 19 | HTML |
| 20 | 20 | ||
| 21 | version '7' do | ||
| 22 | self.release = '7.1.1' | ||
| 23 | self.base_url = "https://sinonjs.org/releases/v#{release}/" | ||
| 24 | end | ||
| 25 | |||
| 21 | version '6' do | 26 | version '6' do |
| 22 | self.release = '6.1.3' | 27 | self.release = '6.3.5' |
| 23 | self.base_url = "http://sinonjs.org/releases/v#{release}/" | 28 | self.base_url = "https://sinonjs.org/releases/v#{release}/" |
| 24 | end | 29 | end |
| 25 | 30 | ||
| 26 | version '5' do | 31 | version '5' do |
| 27 | self.release = '5.1.0' | 32 | self.release = '5.1.0' |
| 28 | self.base_url = "http://sinonjs.org/releases/v#{release}/" | 33 | self.base_url = "https://sinonjs.org/releases/v#{release}/" |
| 29 | end | 34 | end |
| 30 | 35 | ||
| 31 | version '4' do | 36 | version '4' do |
| 32 | self.release = '4.5.0' | 37 | self.release = '4.5.0' |
| 33 | self.base_url = "http://sinonjs.org/releases/v#{release}/" | 38 | self.base_url = "https://sinonjs.org/releases/v#{release}/" |
| 34 | end | 39 | end |
| 35 | 40 | ||
| 36 | version '3' do | 41 | version '3' do |
| 37 | self.release = '3.3.0' | 42 | self.release = '3.3.0' |
| 38 | self.base_url = "http://sinonjs.org/releases/v#{release}/" | 43 | self.base_url = "https://sinonjs.org/releases/v#{release}/" |
| 39 | end | 44 | end |
| 40 | 45 | ||
| 41 | version '2' do | 46 | version '2' do |
| 42 | self.release = '2.4.1' | 47 | self.release = '2.4.1' |
| 43 | self.base_url = "http://sinonjs.org/releases/v#{release}/" | 48 | self.base_url = "https://sinonjs.org/releases/v#{release}/" |
| 44 | end | 49 | end |
| 45 | 50 | ||
| 46 | version '1' do | 51 | version '1' do |
| 47 | self.release = '1.17.7' | 52 | self.release = '1.17.7' |
| 48 | self.base_url = "http://sinonjs.org/releases/v#{release}/" | 53 | self.base_url = "https://sinonjs.org/releases/v#{release}/" |
| 49 | end | 54 | end |
| 50 | end | 55 | end |
| 51 | end | 56 | end |
| @@ -2,8 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Sqlite < FileScraper | 2 | class Sqlite < FileScraper |
| 3 | self.name = 'SQLite' | 3 | self.name = 'SQLite' |
| 4 | self.type = 'sqlite' | 4 | self.type = 'sqlite' |
| 5 | self.release = '3.23.1' | 5 | self.release = '3.25.2' |
| 6 | self.dir = '/Users/Thibaut/DevDocs/Docs/sqlite/' | ||
| 7 | self.base_url = 'https://sqlite.org/' | 6 | self.base_url = 'https://sqlite.org/' |
| 8 | self.root_path = 'docs.html' | 7 | self.root_path = 'docs.html' |
| 9 | self.initial_paths = %w(keyword_index.html) | 8 | self.initial_paths = %w(keyword_index.html) |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Statsmodels < UrlScraper | 2 | class Statsmodels < UrlScraper |
| 3 | self.type = 'sphinx' | 3 | self.type = 'sphinx' |
| 4 | self.release = '0.8.0' | 4 | self.release = '0.9.0' |
| 5 | self.base_url = 'http://www.statsmodels.org/stable/' | 5 | self.base_url = 'http://www.statsmodels.org/stable/' |
| 6 | self.root_path = 'index.html' | 6 | self.root_path = 'index.html' |
| 7 | self.links = { | 7 | self.links = { |
| @@ -26,44 +26,49 @@ module Docs · 25 unmodified lines | |||
| 26 | Licensed under the MIT License. | 26 | Licensed under the MIT License. |
| 27 | HTML | 27 | HTML |
| 28 | 28 | ||
| 29 | version '4.1' do | ||
| 30 | self.release = '4.1.7' | ||
| 31 | self.base_url = "https://api.symfony.com/#{version}/" | ||
| 32 | end | ||
| 33 | |||
| 29 | version '4.0' do | 34 | version '4.0' do |
| 30 | self.release = '4.0.3' | 35 | self.release = '4.0.3' |
| 31 | self.base_url = "http://api.symfony.com/#{version}/" | 36 | self.base_url = "https://api.symfony.com/#{version}/" |
| 32 | end | 37 | end |
| 33 | 38 | ||
| 34 | version '3.4' do | 39 | version '3.4' do |
| 35 | self.release = '3.4.3' | 40 | self.release = '3.4.3' |
| 36 | self.base_url = "http://api.symfony.com/#{version}/" | 41 | self.base_url = "https://api.symfony.com/#{version}/" |
| 37 | end | 42 | end |
| 38 | 43 | ||
| 39 | version '3.3' do | 44 | version '3.3' do |
| 40 | self.release = '3.3.15' | 45 | self.release = '3.3.15' |
| 41 | self.base_url = "http://api.symfony.com/#{version}/" | 46 | self.base_url = "https://api.symfony.com/#{version}/" |
| 42 | end | 47 | end |
| 43 | 48 | ||
| 44 | version '3.2' do | 49 | version '3.2' do |
| 45 | self.release = '3.2.13' | 50 | self.release = '3.2.13' |
| 46 | self.base_url = "http://api.symfony.com/#{version}/" | 51 | self.base_url = "https://api.symfony.com/#{version}/" |
| 47 | end | 52 | end |
| 48 | 53 | ||
| 49 | version '3.1' do | 54 | version '3.1' do |
| 50 | self.release = '3.1.8' | 55 | self.release = '3.1.8' |
| 51 | self.base_url = "http://api.symfony.com/#{version}/" | 56 | self.base_url = "https://api.symfony.com/#{version}/" |
| 52 | end | 57 | end |
| 53 | 58 | ||
| 54 | version '3.0' do | 59 | version '3.0' do |
| 55 | self.release = '3.0.1' | 60 | self.release = '3.0.1' |
| 56 | self.base_url = "http://api.symfony.com/#{version}/" | 61 | self.base_url = "https://api.symfony.com/#{version}/" |
| 57 | end | 62 | end |
| 58 | 63 | ||
| 59 | version '2.8' do | 64 | version '2.8' do |
| 60 | self.release = '2.8.28' | 65 | self.release = '2.8.28' |
| 61 | self.base_url = "http://api.symfony.com/#{version}/" | 66 | self.base_url = "https://api.symfony.com/#{version}/" |
| 62 | end | 67 | end |
| 63 | 68 | ||
| 64 | version '2.7' do | 69 | version '2.7' do |
| 65 | self.release = '2.7.35' | 70 | self.release = '2.7.35' |
| 66 | self.base_url = "http://api.symfony.com/#{version}/" | 71 | self.base_url = "https://api.symfony.com/#{version}/" |
| 67 | end | 72 | end |
| 68 | end | 73 | end |
| 69 | end | 74 | end |
| @@ -4,14 +4,14 @@ module Docs · 3 unmodified lines | |||
| 4 | self.root_path = 'index.html' | 4 | self.root_path = 'index.html' |
| 5 | self.initial_paths = %w(extensions/index.html) | 5 | self.initial_paths = %w(extensions/index.html) |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://twig.sensiolabs.org/', | 7 | home: 'https://twig.symfony.com/', |
| 8 | code: 'https://github.com/twigphp/Twig' | 8 | code: 'https://github.com/twigphp/Twig' |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | options[:attribution] = <<-HTML | 11 | options[:attribution] = <<-HTML |
| 12 | © 2009–2017 by the Twig Team<br> | 12 | © 2009–2018 by the Twig Team<br> |
| 13 | Licensed under the three clause BSD license.<br> | 13 | Licensed under the three clause BSD license.<br> |
| 14 | The Twig logo is © 2010–2017 SensioLabs | 14 | The Twig logo is © 2010–2018 Symfony |
| 15 | HTML | 15 | HTML |
| 16 | 16 | ||
| 17 | html_filters.push 'twig/clean_html', 'twig/entries' | 17 | html_filters.push 'twig/clean_html', 'twig/entries' |
| @@ -20,13 +20,13 @@ module Docs · 2 unmodified lines | |||
| 20 | options[:skip] = %w(deprecated.html advanced_legacy.html) | 20 | options[:skip] = %w(deprecated.html advanced_legacy.html) |
| 21 | 21 | ||
| 22 | version '2' do | 22 | version '2' do |
| 23 | self.release = '2.4.3' | 23 | self.release = '2.5.0' |
| 24 | self.base_url = 'https://twig.sensiolabs.org/doc/2.x/' | 24 | self.base_url = 'https://twig.symfony.com/doc/2.x/' |
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | version '1' do | 27 | version '1' do |
| 28 | self.release = '1.34.3' | 28 | self.release = '1.34.3' |
| 29 | self.base_url = 'https://twig.sensiolabs.org/doc/1.x/' | 29 | self.base_url = 'https://twig.symfony.com/doc/1.x/' |
| 30 | end | 30 | end |
| 31 | end | 31 | end |
| 32 | end | 32 | end |
| @@ -1,8 +1,8 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Typescript < UrlScraper | 2 | class Typescript < UrlScraper |
| 3 | self.name = 'TypeScript' | 3 | self.name = 'TypeScript' |
| 4 | self.type = 'typescript' | 4 | self.type = 'simple' |
| 5 | self.release = '3.0.1' | 5 | self.release = '3.1.6' |
| 6 | self.base_url = 'https://www.typescriptlang.org/docs/' | 6 | self.base_url = 'https://www.typescriptlang.org/docs/' |
| 7 | self.root_path = 'tutorial.html' | 7 | self.root_path = 'tutorial.html' |
| 8 | self.links = { | 8 | self.links = { |
| @@ -3,10 +3,10 @@ module Docs · 2 unmodified lines | |||
| 3 | self.name = 'Underscore.js' | 3 | self.name = 'Underscore.js' |
| 4 | self.slug = 'underscore' | 4 | self.slug = 'underscore' |
| 5 | self.type = 'underscore' | 5 | self.type = 'underscore' |
| 6 | self.release = '1.9.0' | 6 | self.release = '1.9.1' |
| 7 | self.base_url = 'http://underscorejs.org' | 7 | self.base_url = 'https://underscorejs.org' |
| 8 | self.links = { | 8 | self.links = { |
| 9 | home: 'http://underscorejs.org', | 9 | home: 'https://underscorejs.org', |
| 10 | code: 'https://github.com/jashkenas/underscore' | 10 | code: 'https://github.com/jashkenas/underscore' |
| 11 | } | 11 | } |
| 12 | 12 | ||
| @@ -17,7 +17,7 @@ module Docs · 4 unmodified lines | |||
| 17 | options[:skip_links] = true | 17 | options[:skip_links] = true |
| 18 | 18 | ||
| 19 | options[:attribution] = <<-HTML | 19 | options[:attribution] = <<-HTML |
| 20 | © 2009–2017 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors<br> | 20 | © 2009–2018 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors<br> |
| 21 | Licensed under the MIT License. | 21 | Licensed under the MIT License. |
| 22 | HTML | 22 | HTML |
| 23 | end | 23 | end |
| @@ -1,8 +1,8 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Vagrant < UrlScraper | 2 | class Vagrant < UrlScraper |
| 3 | self.name = 'Vagrant' | 3 | self.name = 'Vagrant' |
| 4 | self.type = 'vagrant' | 4 | self.type = 'simple' |
| 5 | self.release = '2.1.1' | 5 | self.release = '2.2.0' |
| 6 | self.base_url = 'https://www.vagrantup.com/docs/' | 6 | self.base_url = 'https://www.vagrantup.com/docs/' |
| 7 | self.root_path = 'index.html' | 7 | self.root_path = 'index.html' |
| 8 | self.links = { | 8 | self.links = { |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Vulkan < UrlScraper | 2 | class Vulkan < UrlScraper |
| 3 | self.name = 'Vulkan' | 3 | self.name = 'Vulkan' |
| 4 | self.type = 'vulkan' | 4 | self.type = 'simple' |
| 5 | self.release = '1.0.59' | 5 | self.release = '1.0.59' |
| 6 | self.base_url = 'https://www.khronos.org/registry/vulkan/specs/1.0/' | 6 | self.base_url = 'https://www.khronos.org/registry/vulkan/specs/1.0/' |
| 7 | self.root_path = 'apispec.html' | 7 | self.root_path = 'apispec.html' |
| @@ -1,7 +1,7 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Yarn < UrlScraper | 2 | class Yarn < UrlScraper |
| 3 | self.type = 'yarn' | 3 | self.type = 'simple' |
| 4 | self.release = '1.9.4' | 4 | self.release = '1.12.1' |
| 5 | self.base_url = 'https://yarnpkg.com/en/docs/' | 5 | self.base_url = 'https://yarnpkg.com/en/docs/' |
| 6 | self.links = { | 6 | self.links = { |
| 7 | home: 'https://yarnpkg.com/', | 7 | home: 'https://yarnpkg.com/', |
| @@ -0,0 +1,13 @@ | |||
| 1 | # frozen_string_literal: true | ||
| 2 | |||
| 3 | module Docs | ||
| 4 | class RequesterSubscriber < Subscriber | ||
| 5 | self.namespace = 'requester' | ||
| 6 | |||
| 7 | def handle_response(event) | ||
| 8 | if event.duration > 10_000 | ||
| 9 | log "WARN: #{format_url event.payload[:url]} was slow to process (#{(event.duration / 1000).round}s)" | ||
| 10 | end | ||
| 11 | end | ||
| 12 | end | ||
| 13 | end | ||
| @@ -12,15 +12,29 @@ class DocsCLI < Thor · 11 unmodified lines | |||
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | desc 'list', 'List available documentations' | 14 | desc 'list', 'List available documentations' |
| 15 | option :packaged, type: :boolean | ||
| 15 | def list | 16 | def list |
| 16 | output = Docs.all.flat_map do |doc| | 17 | if options[:packaged] |
| 17 | name = doc.to_s.demodulize.underscore | 18 | slugs = Dir[File.join(Docs.store_path, '*.tar.gz')].map { |f| File.basename(f, '.tar.gz') } |
| 18 | if doc.versioned? | 19 | names = find_docs_by_slugs(slugs).map do |doc| |
| 19 | doc.versions.map { |_doc| "#{name}@#{_doc.version}" } | 20 | name = if doc.version? |
| 20 | else | 21 | "#{doc.superclass.to_s.demodulize.underscore}@#{doc.version}" |
| 21 | name | 22 | else |
| 23 | doc.to_s.demodulize.underscore | ||
| 24 | end | ||
| 25 | end | ||
| 26 | else | ||
| 27 | names = Docs.all.flat_map do |doc| | ||
| 28 | name = doc.to_s.demodulize.underscore | ||
| 29 | if doc.versioned? | ||
| 30 | doc.versions.map { |_doc| "#{name}@#{_doc.version}" } | ||
| 31 | else | ||
| 32 | name | ||
| 33 | end | ||
| 22 | end | 34 | end |
| 23 | end.join("\n") | 35 | end |
| 36 | |||
| 37 | output = names.join("\n") | ||
| 24 | 38 | ||
| 25 | require 'tty-pager' | 39 | require 'tty-pager' |
| 26 | TTY::Pager.new.page(output) | 40 | TTY::Pager.new.page(output) |
| @@ -39,7 +53,7 @@ class DocsCLI < Thor · 12 unmodified lines | |||
| 39 | Docs.install_report :store if options[:verbose] | 53 | Docs.install_report :store if options[:verbose] |
| 40 | if options[:debug] | 54 | if options[:debug] |
| 41 | GC.disable | 55 | GC.disable |
| 42 | Docs.install_report :filter, :request | 56 | Docs.install_report :filter, :request, :doc |
| 43 | end | 57 | end |
| 44 | 58 | ||
| 45 | if Docs.generate_page(name, options[:version], path) | 59 | if Docs.generate_page(name, options[:version], path) |
| @@ -62,7 +76,7 @@ class DocsCLI < Thor · 16 unmodified lines | |||
| 62 | Docs.rescue_errors = true | 76 | Docs.rescue_errors = true |
| 63 | Docs.install_report :store if options[:verbose] | 77 | Docs.install_report :store if options[:verbose] |
| 64 | Docs.install_report :scraper if options[:debug] | 78 | Docs.install_report :scraper if options[:debug] |
| 65 | Docs.install_report :progress_bar, :doc, :image if $stdout.tty? | 79 | Docs.install_report :progress_bar, :doc, :image, :requester if $stdout.tty? |
| 66 | 80 | ||
| 67 | require 'unix_utils' if options[:package] | 81 | require 'unix_utils' if options[:package] |
| 68 | 82 | ||
| @@ -149,15 +163,55 @@ class DocsCLI < Thor · 80 unmodified lines | |||
| 149 | option :dryrun, type: :boolean | 163 | option :dryrun, type: :boolean |
| 150 | option :packaged, type: :boolean | 164 | option :packaged, type: :boolean |
| 151 | def upload(*names) | 165 | def upload(*names) |
| 152 | names = Dir[File.join(Docs.store_path, '*.tar.gz')].map { |f| File.basename(f, '.tar.gz') } if options[:packaged] | 166 | require 'net/sftp' |
| 153 | docs = find_docs(names) | 167 | |
| 168 | if options[:packaged] | ||
| 169 | slugs = Dir[File.join(Docs.store_path, '*.tar.gz')].map { |f| File.basename(f, '.tar.gz') } | ||
| 170 | docs = find_docs_by_slugs(slugs) | ||
| 171 | else | ||
| 172 | docs = find_docs(names) | ||
| 173 | end | ||
| 174 | |||
| 154 | assert_docs(docs) | 175 | assert_docs(docs) |
| 176 | |||
| 177 | # Verify files are present | ||
| 155 | docs.each do |doc| | 178 | docs.each do |doc| |
| 156 | puts "Syncing #{doc.path}..." | 179 | unless Dir.exists?(File.join(Docs.store_path, doc.path)) |
| 157 | cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://docs.devdocs.io/#{doc.path} --delete" | 180 | puts "ERROR: directory #{File.join(Docs.store_path, doc.path)} not found." |
| 181 | return | ||
| 182 | end | ||
| 183 | |||
| 184 | unless File.exists?(File.join(Docs.store_path, "#{doc.path}.tar.gz")) | ||
| 185 | puts "ERROR: package for '#{doc.slug}' documentation not found. Run 'thor docs:package #{doc.slug}' to create it." | ||
| 186 | return | ||
| 187 | end | ||
| 188 | end | ||
| 189 | |||
| 190 | # Sync files with S3 (used by the web app) | ||
| 191 | puts '[S3] Begin syncing.' | ||
| 192 | docs.each do |doc| | ||
| 193 | puts "[S3] Syncing #{doc.path}..." | ||
| 194 | cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://devdocs-assets/#{doc.path} --delete --profile devdocs" | ||
| 158 | cmd << ' --dryrun' if options[:dryrun] | 195 | cmd << ' --dryrun' if options[:dryrun] |
| 159 | system(cmd) | 196 | system(cmd) |
| 160 | end | 197 | end |
| 198 | puts '[S3] Done syncing.' | ||
| 199 | |||
| 200 | # Upload packages to dl.devdocs.io (used by the "thor docs:download" command) | ||
| 201 | puts '[MaxCDN] Begin uploading.' | ||
| 202 | Net::SFTP.start('ftp.devdocs-dl.devdocs.netdna-cdn.com', ENV['DEVDOCS_DL_USERNAME'], password: ENV['DEVDOCS_DL_PASSWORD']) do |sftp| | ||
| 203 | docs.each do |doc| | ||
| 204 | filename = "#{doc.path}.tar.gz" | ||
| 205 | print "[MaxCDN] Uploading #{filename}..." | ||
| 206 | if options[:dryrun] | ||
| 207 | print "\n" | ||
| 208 | else | ||
| 209 | sftp.upload! File.join(Docs.store_path, filename), File.join('', 'public_html', filename) | ||
| 210 | print " OK\n" | ||
| 211 | end | ||
| 212 | end | ||
| 213 | end | ||
| 214 | puts '[MaxCDN] Done uploading.' | ||
| 161 | end | 215 | end |
| 162 | 216 | ||
| 163 | desc 'commit', '[private]' | 217 | desc 'commit', '[private]' |
| @@ -172,12 +226,60 @@ class DocsCLI < Thor · 8 unmodified lines | |||
| 172 | handle_doc_not_found_error(error) | 226 | handle_doc_not_found_error(error) |
| 173 | end | 227 | end |
| 174 | 228 | ||
| 229 | desc 'prepare_deploy', 'Internal task executed before deployment' | ||
| 230 | def prepare_deploy | ||
| 231 | puts 'Docs -- BEGIN' | ||
| 232 | |||
| 233 | require 'open-uri' | ||
| 234 | require 'thread' | ||
| 235 | |||
| 236 | docs = Docs.all_versions | ||
| 237 | time = Time.now.to_i | ||
| 238 | mutex = Mutex.new | ||
| 239 | |||
| 240 | (1..6).map do | ||
| 241 | Thread.new do | ||
| 242 | while doc = docs.shift | ||
| 243 | dir = File.join(Docs.store_path, doc.path) | ||
| 244 | FileUtils.mkpath(dir) | ||
| 245 | |||
| 246 | ['index.json', 'meta.json'].each do |filename| | ||
| 247 | open("https://docs.devdocs.io/#{doc.path}/#{filename}?#{time}") do |file| | ||
| 248 | mutex.synchronize do | ||
| 249 | path = File.join(dir, filename) | ||
| 250 | File.write(path, file.read) | ||
| 251 | end | ||
| 252 | end | ||
| 253 | end | ||
| 254 | |||
| 255 | puts "Docs -- Downloaded #{doc.slug}" | ||
| 256 | end | ||
| 257 | end | ||
| 258 | end.map(&:join) | ||
| 259 | |||
| 260 | puts 'Docs -- Generating manifest...' | ||
| 261 | generate_manifest | ||
| 262 | |||
| 263 | puts 'Docs -- DONE' | ||
| 264 | end | ||
| 265 | |||
| 175 | private | 266 | private |
| 176 | 267 | ||
| 177 | def find_docs(names) | 268 | def find_docs(names) |
| 178 | names.map do |name| | 269 | names.flat_map do |name| |
| 179 | name, version = name.split(/@|~/) | 270 | name, version = name.split(/@|~/) |
| 180 | Docs.find(name, version) | 271 | if version == 'all' |
| 272 | Docs.find(name, false).versions | ||
| 273 | else | ||
| 274 | Docs.find(name, version) | ||
| 275 | end | ||
| 276 | end | ||
| 277 | end | ||
| 278 | |||
| 279 | def find_docs_by_slugs(slugs) | ||
| 280 | slugs.flat_map do |slug| | ||
| 281 | slug, version = slug.split(/~/) | ||
| 282 | Docs.find_by_slug(slug, version) | ||
| 181 | end | 283 | end |
| 182 | end | 284 | end |
| 183 | 285 | ||
| @@ -1 +0,0 @@ | |||
| 1 | [] | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file added.
| @@ -0,0 +1 @@ | |||
| 1 | 10 | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file added.
| @@ -0,0 +1 @@ | |||
| 1 | 10 | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file added.
| @@ -0,0 +1 @@ | |||
| 1 | 10 | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | |||
| 1 | https://github.com/yahoo/formatjs-site/tree/master/public/img | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file added.
| @@ -0,0 +1 @@ | |||
| 1 | 10 | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file added.
| @@ -0,0 +1,14 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | <plist version="1.0"> | ||
| 4 | <dict> | ||
| 5 | <key>app</key> | ||
| 6 | <string>com.bohemiancoding.sketch</string> | ||
| 7 | <key>build</key> | ||
| 8 | <integer>5302</integer> | ||
| 9 | <key>commit</key> | ||
| 10 | <string>9460a4bc62af5e9ba50dd4143578fd9401710ce5</string> | ||
| 11 | <key>version</key> | ||
| 12 | <integer>18</integer> | ||
| 13 | </dict> | ||
| 14 | </plist> | ||
| @@ -0,0 +1 @@ | |||
| 1 | 18 | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | |||
| 1 | https://github.com/GoogleChromeLabs/pptr.dev/tree/master/src/favicons | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1,18 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | <plist version="1.0"> | ||
| 4 | <dict> | ||
| 5 | <key>app</key> | ||
| 6 | <string>com.bohemiancoding.sketch</string> | ||
| 7 | <key>build</key> | ||
| 8 | <integer>5355</integer> | ||
| 9 | <key>commit</key> | ||
| 10 | <string>b7d299b0a34651d1a0e066786b75aa36168d5809</string> | ||
| 11 | <key>fonts</key> | ||
| 12 | <array/> | ||
| 13 | <key>length</key> | ||
| 14 | <integer>22373</integer> | ||
| 15 | <key>version</key> | ||
| 16 | <integer>18</integer> | ||
| 17 | </dict> | ||
| 18 | </plist> | ||
| @@ -0,0 +1 @@ | |||
| 1 | 18 | ||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | "description": "API Documentation Browser", | 4 | "description": "API Documentation Browser", |
| 5 | "start_url": "/", | 5 | "start_url": "/", |
| 6 | "display": "standalone", | 6 | "display": "standalone", |
| 7 | "background_color": "#EEEEEE", | ||
| 7 | "icons": [ | 8 | "icons": [ |
| 8 | { | 9 | { |
| 9 | "src": "/images/webapp-icon-32.png", | 10 | "src": "/images/webapp-icon-32.png", |
| @@ -25,10 +26,20 @@ · 15 unmodified lines | |||
| 25 | "sizes": "128x128", | 26 | "sizes": "128x128", |
| 26 | "type": "image/png" | 27 | "type": "image/png" |
| 27 | }, | 28 | }, |
| 29 | { | ||
| 30 | "src": "/images/webapp-icon-192.png", | ||
| 31 | "sizes": "192x192", | ||
| 32 | "type": "image/png" | ||
| 33 | }, | ||
| 28 | { | 34 | { |
| 29 | "src": "/images/webapp-icon-256.png", | 35 | "src": "/images/webapp-icon-256.png", |
| 30 | "sizes": "256x256", | 36 | "sizes": "256x256", |
| 31 | "type": "image/png" | 37 | "type": "image/png" |
| 38 | }, | ||
| 39 | { | ||
| 40 | "src": "/images/webapp-icon-512.png", | ||
| 41 | "sizes": "512x512", | ||
| 42 | "type": "image/png" | ||
| 32 | } | 43 | } |
| 33 | ] | 44 | ] |
| 34 | } | 45 | } |
| @@ -11,6 +11,21 @@ class AppTest < MiniTest::Spec · 10 unmodified lines | |||
| 11 | App | 11 | App |
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | before do | ||
| 15 | current_session.env('HTTPS', 'on') | ||
| 16 | end | ||
| 17 | |||
| 18 | it 'redirects to HTTPS' do | ||
| 19 | get 'http://example.com/test?q=1', {}, 'HTTPS' => 'off' | ||
| 20 | assert last_response.redirect? | ||
| 21 | assert_equal 'https://example.com/test?q=1', last_response['Location'] | ||
| 22 | end | ||
| 23 | |||
| 24 | it 'returns HSTS header' do | ||
| 25 | get 'https://example.com/test' | ||
| 26 | assert_equal 'max-age=31536000; includeSubDomains', last_response['Strict-Transport-Security'] | ||
| 27 | end | ||
| 28 | |||
| 14 | describe "/" do | 29 | describe "/" do |
| 15 | it "works" do | 30 | it "works" do |
| 16 | get '/' | 31 | get '/' |
| @@ -20,30 +35,13 @@ class AppTest < MiniTest::Spec · 3 unmodified lines | |||
| 20 | it "redirects to /#q= when there is a 'q' query param" do | 35 | it "redirects to /#q= when there is a 'q' query param" do |
| 21 | get '/search', q: 'foo' | 36 | get '/search', q: 'foo' |
| 22 | assert last_response.redirect? | 37 | assert last_response.redirect? |
| 23 | assert_equal 'http://example.org/#q=foo', last_response['Location'] | 38 | assert_equal 'https://example.org/#q=foo', last_response['Location'] |
| 24 | end | 39 | end |
| 25 | 40 | ||
| 26 | it "redirects without the query string" do | 41 | it "redirects without the query string" do |
| 27 | get '/', foo: 'bar' | 42 | get '/', foo: 'bar' |
| 28 | assert last_response.redirect? | 43 | assert last_response.redirect? |
| 29 | assert_equal 'http://example.org/', last_response['Location'] | 44 | assert_equal 'https://example.org/', last_response['Location'] |
| 30 | end | ||
| 31 | |||
| 32 | it "sets default size" do | ||
| 33 | get '/' | ||
| 34 | assert_includes last_response.body, 'data-size="20rem"' | ||
| 35 | end | ||
| 36 | |||
| 37 | it "sets size from cookie" do | ||
| 38 | set_cookie('size=42') | ||
| 39 | get '/' | ||
| 40 | assert_includes last_response.body, 'data-size="42px"' | ||
| 41 | end | ||
| 42 | |||
| 43 | it "sets layout from cookie" do | ||
| 44 | set_cookie('layout=foo') | ||
| 45 | get '/' | ||
| 46 | assert_includes last_response.body, '<body class="foo">' | ||
| 47 | end | 45 | end |
| 48 | end | 46 | end |
| 49 | 47 | ||
| @@ -52,7 +50,7 @@ class AppTest < MiniTest::Spec · 2 unmodified lines | |||
| 52 | %w(offline about news help).each do |page| | 50 | %w(offline about news help).each do |page| |
| 53 | get "/#{page}", {}, 'HTTP_USER_AGENT' => MODERN_BROWSER | 51 | get "/#{page}", {}, 'HTTP_USER_AGENT' => MODERN_BROWSER |
| 54 | assert last_response.redirect? | 52 | assert last_response.redirect? |
| 55 | assert_equal "http://example.org/#/#{page}", last_response['Location'] | 53 | assert_equal "https://example.org/#/#{page}", last_response['Location'] |
| 56 | end | 54 | end |
| 57 | end | 55 | end |
| 58 | 56 | ||
| @@ -61,7 +59,7 @@ class AppTest < MiniTest::Spec · 2 unmodified lines | |||
| 61 | set_cookie('foo=bar') | 59 | set_cookie('foo=bar') |
| 62 | get "/#{page}", {}, 'HTTP_USER_AGENT' => MODERN_BROWSER | 60 | get "/#{page}", {}, 'HTTP_USER_AGENT' => MODERN_BROWSER |
| 63 | assert last_response.redirect? | 61 | assert last_response.redirect? |
| 64 | assert_equal 'http://example.org/', last_response['Location'] | 62 | assert_equal 'https://example.org/', last_response['Location'] |
| 65 | assert last_response['Set-Cookie'].start_with?("initial_path=%2F#{page}; path=/; expires=") | 63 | assert last_response['Set-Cookie'].start_with?("initial_path=%2F#{page}; path=/; expires=") |
| 66 | end | 64 | end |
| 67 | end | 65 | end |
| @@ -71,63 +69,11 @@ class AppTest < MiniTest::Spec · 3 unmodified lines | |||
| 71 | it "redirects to /#q=" do | 69 | it "redirects to /#q=" do |
| 72 | get '/search' | 70 | get '/search' |
| 73 | assert last_response.redirect? | 71 | assert last_response.redirect? |
| 74 | assert_equal 'http://example.org/#q=', last_response['Location'] | 72 | assert_equal 'https://example.org/#q=', last_response['Location'] |
| 75 | 73 | ||
| 76 | get '/search', q: 'foo' | 74 | get '/search', q: 'foo' |
| 77 | assert last_response.redirect? | 75 | assert last_response.redirect? |
| 78 | assert_equal 'http://example.org/#q=foo', last_response['Location'] | 76 | assert_equal 'https://example.org/#q=foo', last_response['Location'] |
| 79 | end | ||
| 80 | end | ||
| 81 | |||
| 82 | describe "/manifest.appcache" do | ||
| 83 | it "works" do | ||
| 84 | get '/manifest.appcache' | ||
| 85 | assert last_response.ok? | ||
| 86 | end | ||
| 87 | |||
| 88 | it "works with cookie" do | ||
| 89 | set_cookie('docs=css/html~5') | ||
| 90 | get '/manifest.appcache' | ||
| 91 | assert last_response.ok? | ||
| 92 | assert_includes last_response.body, '/css/index.json?1420139788' | ||
| 93 | assert_includes last_response.body, '/html~5/index.json?1420139791' | ||
| 94 | end | ||
| 95 | |||
| 96 | it "ignores invalid docs in the cookie" do | ||
| 97 | set_cookie('docs=foo') | ||
| 98 | get '/manifest.appcache' | ||
| 99 | assert last_response.ok? | ||
| 100 | refute_includes last_response.body, 'foo' | ||
| 101 | end | ||
| 102 | |||
| 103 | it "has the word 'default' when no 'dark' cookie is set" do | ||
| 104 | get '/manifest.appcache' | ||
| 105 | assert_includes last_response.body, '# default' | ||
| 106 | refute_includes last_response.body, '# dark' | ||
| 107 | end | ||
| 108 | |||
| 109 | it "has the word 'dark' when the cookie is set" do | ||
| 110 | set_cookie('dark=1') | ||
| 111 | get '/manifest.appcache' | ||
| 112 | assert_includes last_response.body, '# dark' | ||
| 113 | refute_includes last_response.body, '# default' | ||
| 114 | end | ||
| 115 | |||
| 116 | it "sets default size" do | ||
| 117 | get '/manifest.appcache' | ||
| 118 | assert_includes last_response.body, '20rem' | ||
| 119 | end | ||
| 120 | |||
| 121 | it "sets size from cookie" do | ||
| 122 | set_cookie('size=42') | ||
| 123 | get '/manifest.appcache' | ||
| 124 | assert_includes last_response.body, '42px' | ||
| 125 | end | ||
| 126 | |||
| 127 | it "sets layout from cookie" do | ||
| 128 | set_cookie('layout=foo_layout') | ||
| 129 | get '/manifest.appcache' | ||
| 130 | assert_includes last_response.body, 'foo_layout' | ||
| 131 | end | 77 | end |
| 132 | end | 78 | end |
| 133 | 79 | ||
| @@ -148,7 +94,7 @@ class AppTest < MiniTest::Spec · 14 unmodified lines | |||
| 148 | set_cookie('docs=html~5') | 94 | set_cookie('docs=html~5') |
| 149 | get '/html~5/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER | 95 | get '/html~5/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER |
| 150 | assert last_response.redirect? | 96 | assert last_response.redirect? |
| 151 | assert_equal 'http://example.org/', last_response['Location'] | 97 | assert_equal 'https://example.org/', last_response['Location'] |
| 152 | assert last_response['Set-Cookie'].start_with?("initial_path=%2Fhtml%7E5%2F; path=/; expires=") | 98 | assert last_response['Set-Cookie'].start_with?("initial_path=%2Fhtml%7E5%2F; path=/; expires=") |
| 153 | end | 99 | end |
| 154 | 100 | ||
| @@ -161,13 +107,13 @@ class AppTest < MiniTest::Spec · 6 unmodified lines | |||
| 161 | set_cookie('docs=html~5') | 107 | set_cookie('docs=html~5') |
| 162 | get '/html/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER | 108 | get '/html/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER |
| 163 | assert last_response.redirect? | 109 | assert last_response.redirect? |
| 164 | assert_equal 'http://example.org/', last_response['Location'] | 110 | assert_equal 'https://example.org/', last_response['Location'] |
| 165 | assert last_response['Set-Cookie'].start_with?("initial_path=%2Fhtml%2F; path=/; expires=") | 111 | assert last_response['Set-Cookie'].start_with?("initial_path=%2Fhtml%2F; path=/; expires=") |
| 166 | end | 112 | end |
| 167 | 113 | ||
| 168 | it "renders when the doc exists and is enabled, and the request is from Googlebot" do | 114 | it "renders when the doc exists and is enabled, and the request is from Googlebot" do |
| 169 | set_cookie('docs=html') | 115 | set_cookie('docs=html') |
| 170 | get '/html/', {}, 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' | 116 | get '/html/', {}, 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Googlebot/2.1; +https://www.google.com/bot.html)' |
| 171 | assert last_response.ok? | 117 | assert last_response.ok? |
| 172 | end | 118 | end |
| 173 | 119 | ||
| @@ -187,17 +133,17 @@ class AppTest < MiniTest::Spec · 13 unmodified lines | |||
| 187 | it "redirects with trailing slash" do | 133 | it "redirects with trailing slash" do |
| 188 | get '/html' | 134 | get '/html' |
| 189 | assert last_response.redirect? | 135 | assert last_response.redirect? |
| 190 | assert_equal 'http://example.org/html/', last_response['Location'] | 136 | assert_equal 'https://example.org/html/', last_response['Location'] |
| 191 | 137 | ||
| 192 | get '/html', bar: 'baz' | 138 | get '/html', bar: 'baz' |
| 193 | assert last_response.redirect? | 139 | assert last_response.redirect? |
| 194 | assert_equal 'http://example.org/html/?bar=baz', last_response['Location'] | 140 | assert_equal 'https://example.org/html/?bar=baz', last_response['Location'] |
| 195 | end | 141 | end |
| 196 | 142 | ||
| 197 | it "redirects old docs" do | 143 | it "redirects old docs" do |
| 198 | get '/iojs/' | 144 | get '/iojs/' |
| 199 | assert last_response.redirect? | 145 | assert last_response.redirect? |
| 200 | assert_equal 'http://example.org/node/', last_response['Location'] | 146 | assert_equal 'https://example.org/node/', last_response['Location'] |
| 201 | end | 147 | end |
| 202 | end | 148 | end |
| 203 | 149 | ||
| @@ -232,17 +178,17 @@ class AppTest < MiniTest::Spec · 28 unmodified lines | |||
| 232 | it "redirects with trailing slash" do | 178 | it "redirects with trailing slash" do |
| 233 | get '/css-foo' | 179 | get '/css-foo' |
| 234 | assert last_response.redirect? | 180 | assert last_response.redirect? |
| 235 | assert_equal 'http://example.org/css-foo/', last_response['Location'] | 181 | assert_equal 'https://example.org/css-foo/', last_response['Location'] |
| 236 | 182 | ||
| 237 | get '/css-foo', bar: 'baz' | 183 | get '/css-foo', bar: 'baz' |
| 238 | assert last_response.redirect? | 184 | assert last_response.redirect? |
| 239 | assert_equal 'http://example.org/css-foo/?bar=baz', last_response['Location'] | 185 | assert_equal 'https://example.org/css-foo/?bar=baz', last_response['Location'] |
| 240 | end | 186 | end |
| 241 | 187 | ||
| 242 | it "redirects old docs" do | 188 | it "redirects old docs" do |
| 243 | get '/yii1-foo/' | 189 | get '/yii1-foo/' |
| 244 | assert last_response.redirect? | 190 | assert last_response.redirect? |
| 245 | assert_equal 'http://example.org/yii~1.1-foo/', last_response['Location'] | 191 | assert_equal 'https://example.org/yii~1.1-foo/', last_response['Location'] |
| 246 | end | 192 | end |
| 247 | end | 193 | end |
| 248 | 194 | ||
| @@ -263,17 +209,17 @@ class AppTest < MiniTest::Spec · 14 unmodified lines | |||
| 263 | it "redirects without trailing slash" do | 209 | it "redirects without trailing slash" do |
| 264 | get '/css/foo/' | 210 | get '/css/foo/' |
| 265 | assert last_response.redirect? | 211 | assert last_response.redirect? |
| 266 | assert_equal 'http://example.org/css/foo', last_response['Location'] | 212 | assert_equal 'https://example.org/css/foo', last_response['Location'] |
| 267 | 213 | ||
| 268 | get '/css/foo/', bar: 'baz' | 214 | get '/css/foo/', bar: 'baz' |
| 269 | assert last_response.redirect? | 215 | assert last_response.redirect? |
| 270 | assert_equal 'http://example.org/css/foo?bar=baz', last_response['Location'] | 216 | assert_equal 'https://example.org/css/foo?bar=baz', last_response['Location'] |
| 271 | end | 217 | end |
| 272 | 218 | ||
| 273 | it "redirects old docs" do | 219 | it "redirects old docs" do |
| 274 | get '/python2/foo' | 220 | get '/python2/foo' |
| 275 | assert last_response.redirect? | 221 | assert last_response.redirect? |
| 276 | assert_equal 'http://example.org/python~2.7/foo', last_response['Location'] | 222 | assert_equal 'https://example.org/python~2.7/foo', last_response['Location'] |
| 277 | end | 223 | end |
| 278 | end | 224 | end |
| 279 | 225 | ||
| @@ -281,7 +227,7 @@ class AppTest < MiniTest::Spec · 1 unmodified line | |||
| 281 | it "returns to the asset path" do | 227 | it "returns to the asset path" do |
| 282 | get '/docs.json' | 228 | get '/docs.json' |
| 283 | assert last_response.redirect? | 229 | assert last_response.redirect? |
| 284 | assert_equal 'http://example.org/assets/docs.json', last_response['Location'] | 230 | assert_equal 'https://example.org/assets/docs.json', last_response['Location'] |
| 285 | end | 231 | end |
| 286 | end | 232 | end |
| 287 | 233 | ||
| @@ -289,7 +235,7 @@ class AppTest < MiniTest::Spec · 1 unmodified line | |||
| 289 | it "returns to the asset path" do | 235 | it "returns to the asset path" do |
| 290 | get '/application.js' | 236 | get '/application.js' |
| 291 | assert last_response.redirect? | 237 | assert last_response.redirect? |
| 292 | assert_equal 'http://example.org/assets/application.js', last_response['Location'] | 238 | assert_equal 'https://example.org/assets/application.js', last_response['Location'] |
| 293 | end | 239 | end |
| 294 | end | 240 | end |
| 295 | 241 | ||
| @@ -297,7 +243,7 @@ class AppTest < MiniTest::Spec · 1 unmodified line | |||
| 297 | it "returns to the asset path" do | 243 | it "returns to the asset path" do |
| 298 | get '/application.css' | 244 | get '/application.css' |
| 299 | assert last_response.redirect? | 245 | assert last_response.redirect? |
| 300 | assert_equal 'http://example.org/assets/application.css', last_response['Location'] | 246 | assert_equal 'https://example.org/assets/application.css', last_response['Location'] |
| 301 | end | 247 | end |
| 302 | end | 248 | end |
| 303 | 249 | ||
| @@ -2,16 +2,23 @@ require 'test_helper' · 1 unmodified line | |||
| 2 | require 'docs' | 2 | require 'docs' |
| 3 | 3 | ||
| 4 | class FileScraperTest < MiniTest::Spec | 4 | class FileScraperTest < MiniTest::Spec |
| 5 | ROOT_PATH = File.expand_path('../../../../../../', __FILE__) | ||
| 6 | |||
| 5 | class Scraper < Docs::FileScraper | 7 | class Scraper < Docs::FileScraper |
| 6 | self.dir = '/' | ||
| 7 | self.html_filters = Docs::FilterStack.new | 8 | self.html_filters = Docs::FilterStack.new |
| 8 | self.text_filters = Docs::FilterStack.new | 9 | self.text_filters = Docs::FilterStack.new |
| 10 | |||
| 11 | version 'version' do; end | ||
| 9 | end | 12 | end |
| 10 | 13 | ||
| 11 | let :scraper do | 14 | let :scraper do |
| 12 | Scraper.new | 15 | Scraper.new |
| 13 | end | 16 | end |
| 14 | 17 | ||
| 18 | let :versioned_scraper do | ||
| 19 | Scraper.versions.first.new | ||
| 20 | end | ||
| 21 | |||
| 15 | let :response do | 22 | let :response do |
| 16 | OpenStruct.new body: 'body', url: Docs::URL.parse(Scraper.base_url) | 23 | OpenStruct.new body: 'body', url: Docs::URL.parse(Scraper.base_url) |
| 17 | end | 24 | end |
| @@ -22,9 +29,16 @@ class FileScraperTest < MiniTest::Spec · 4 unmodified lines | |||
| 22 | end | 29 | end |
| 23 | end | 30 | end |
| 24 | 31 | ||
| 32 | describe "#source_directory" do | ||
| 33 | it "returns the directory at docs/[slug]" do | ||
| 34 | assert_equal File.join(ROOT_PATH, 'docs', 'scraper'), scraper.source_directory | ||
| 35 | assert_equal File.join(ROOT_PATH, 'docs', 'scraper~version'), versioned_scraper.source_directory | ||
| 36 | end | ||
| 37 | end | ||
| 38 | |||
| 25 | describe "#request_one" do | 39 | describe "#request_one" do |
| 26 | let :path do | 40 | let :path do |
| 27 | File.join(Scraper.dir, 'path') | 41 | 'path' |
| 28 | end | 42 | end |
| 29 | 43 | ||
| 30 | let :result do | 44 | let :result do |
| @@ -35,20 +49,34 @@ class FileScraperTest < MiniTest::Spec · 4 unmodified lines | |||
| 35 | stub(scraper).read_file | 49 | stub(scraper).read_file |
| 36 | end | 50 | end |
| 37 | 51 | ||
| 38 | it "reads a file" do | 52 | context "when the source directory doesn't exist" do |
| 39 | mock(scraper).read_file(path) | 53 | it "raises an error" do |
| 40 | result | 54 | assert_raises Docs::SetupError do |
| 55 | result | ||
| 56 | end | ||
| 57 | end | ||
| 41 | end | 58 | end |
| 42 | 59 | ||
| 43 | describe "the returned response object" do | 60 | context "when the source directory exists" do |
| 44 | it "has a #body" do | 61 | before do |
| 45 | stub(scraper).read_file { 'body' } | 62 | stub(scraper).assert_source_directory_exists |
| 46 | assert_equal 'body', result.body | 63 | end |
| 64 | |||
| 65 | it "reads a file" do | ||
| 66 | mock(scraper).read_file(File.join(ROOT_PATH, 'docs/scraper', path)) | ||
| 67 | result | ||
| 47 | end | 68 | end |
| 48 | 69 | ||
| 49 | it "has a #url" do | 70 | describe "the returned response object" do |
| 50 | assert_equal path, result.url.to_s | 71 | it "has a #body" do |
| 51 | assert_instance_of Docs::URL, result.url | 72 | stub(scraper).read_file { 'body' } |
| 73 | assert_equal 'body', result.body | ||
| 74 | end | ||
| 75 | |||
| 76 | it "has a #url" do | ||
| 77 | assert_equal path, result.url.to_s | ||
| 78 | assert_instance_of Docs::URL, result.url | ||
| 79 | end | ||
| 52 | end | 80 | end |
| 53 | end | 81 | end |
| 54 | end | 82 | end |
| @@ -58,49 +86,63 @@ class FileScraperTest < MiniTest::Spec · 3 unmodified lines | |||
| 58 | %w(one two) | 86 | %w(one two) |
| 59 | end | 87 | end |
| 60 | 88 | ||
| 61 | it "requests the given url" do | 89 | context "when the source directory doesn't exist" do |
| 62 | mock(scraper).request_one('url') | 90 | it "raises an error" do |
| 63 | scraper.send(:request_all, 'url') {} | 91 | assert_raises Docs::SetupError do |
| 64 | end | 92 | scraper.send(:request_all, urls) {} |
| 65 | 93 | end | |
| 66 | it "requests the given urls" do | 94 | end |
| 67 | requests = [] | ||
| 68 | stub(scraper).request_one { |url| requests << url; nil } | ||
| 69 | scraper.send(:request_all, urls) {} | ||
| 70 | assert_equal urls, requests | ||
| 71 | end | ||
| 72 | |||
| 73 | it "yields the responses" do | ||
| 74 | responses = [] | ||
| 75 | stub(scraper).request_one { |url| urls.index(url) } | ||
| 76 | scraper.send(:request_all, urls) { |response| responses << response; nil } | ||
| 77 | assert_equal (0...urls.length).to_a, responses | ||
| 78 | end | 95 | end |
| 79 | 96 | ||
| 80 | context "when the block returns an array" do | 97 | context "when the source directory exists" do |
| 81 | let :next_urls do | 98 | before do |
| 82 | %w(three four) | 99 | stub(scraper).assert_source_directory_exists |
| 83 | end | 100 | end |
| 84 | 101 | ||
| 85 | let :all_urls do | 102 | it "requests the given url" do |
| 86 | urls + %w(three four) | 103 | mock(scraper).request_one('url') |
| 104 | scraper.send(:request_all, 'url') {} | ||
| 87 | end | 105 | end |
| 88 | 106 | ||
| 89 | it "requests the returned urls" do | 107 | it "requests the given urls" do |
| 90 | requests = [] | 108 | requests = [] |
| 91 | stub(scraper).request_one { |url| requests << url; url } | 109 | stub(scraper).request_one { |url| requests << url; nil } |
| 92 | scraper.send(:request_all, urls) { [next_urls.shift].compact } | 110 | scraper.send(:request_all, urls) {} |
| 93 | assert_equal all_urls, requests | 111 | assert_equal urls, requests |
| 94 | end | 112 | end |
| 95 | 113 | ||
| 96 | it "yields their responses" do | 114 | it "yields the responses" do |
| 97 | responses = [] | 115 | responses = [] |
| 98 | stub(scraper).request_one { |url| all_urls.index(url) } | 116 | stub(scraper).request_one { |url| urls.index(url) } |
| 99 | scraper.send :request_all, urls do |response| | 117 | scraper.send(:request_all, urls) { |response| responses << response; nil } |
| 100 | responses << response | 118 | assert_equal (0...urls.length).to_a, responses |
| 101 | [next_urls.shift].compact | 119 | end |
| 120 | |||
| 121 | context "when the block returns an array" do | ||
| 122 | let :next_urls do | ||
| 123 | %w(three four) | ||
| 124 | end | ||
| 125 | |||
| 126 | let :all_urls do | ||
| 127 | urls + %w(three four) | ||
| 128 | end | ||
| 129 | |||
| 130 | it "requests the returned urls" do | ||
| 131 | requests = [] | ||
| 132 | stub(scraper).request_one { |url| requests << url; url } | ||
| 133 | scraper.send(:request_all, urls) { [next_urls.shift].compact } | ||
| 134 | assert_equal all_urls, requests | ||
| 135 | end | ||
| 136 | |||
| 137 | it "yields their responses" do | ||
| 138 | responses = [] | ||
| 139 | stub(scraper).request_one { |url| all_urls.index(url) } | ||
| 140 | scraper.send :request_all, urls do |response| | ||
| 141 | responses << response | ||
| 142 | [next_urls.shift].compact | ||
| 143 | end | ||
| 144 | assert_equal (0...all_urls.length).to_a, responses | ||
| 102 | end | 145 | end |
| 103 | assert_equal (0...all_urls.length).to_a, responses | ||
| 104 | end | 146 | end |
| 105 | end | 147 | end |
| 106 | end | 148 | end |
| @@ -123,16 +165,16 @@ class FileScraperTest < MiniTest::Spec · 16 unmodified lines | |||
| 123 | 165 | ||
| 124 | describe "#read_file" do | 166 | describe "#read_file" do |
| 125 | let :result do | 167 | let :result do |
| 126 | scraper.send :read_file, 'file' | 168 | scraper.send :read_file, File.join(ROOT_PATH, 'docs', 'scraper', 'file') |
| 127 | end | 169 | end |
| 128 | 170 | ||
| 129 | it "returns the file's content when the file exists" do | 171 | it "returns the file's content when the file exists in the source directory" do |
| 130 | stub(File).read('file') { 'content' } | 172 | stub(File).read(File.join(ROOT_PATH, 'docs', 'scraper', 'file')) { 'content' } |
| 131 | assert_equal 'content', result | 173 | assert_equal 'content', result |
| 132 | end | 174 | end |
| 133 | 175 | ||
| 134 | it "returns nil when the file doesn't exist" do | 176 | it "returns nil when the file doesn't exist" do |
| 135 | stub(File).read('file') { raise } | 177 | stub(File).read(File.join(ROOT_PATH, 'docs', 'scraper', 'file')) { raise } |
| 136 | assert_nil result | 178 | assert_nil result |
| 137 | end | 179 | end |
| 138 | end | 180 | end |
| @@ -28,13 +28,7 @@ · 27 unmodified lines | |||
| 28 | </nav> | 28 | </nav> |
| 29 | </header> | 29 | </header> |
| 30 | <section class="_sidebar" tabindex="-1"> | 30 | <section class="_sidebar" tabindex="-1"> |
| 31 | <div class="_list" role="navigation"> | 31 | <div class="_list" role="navigation"></div> |
| 32 | <% unless @doc %> | ||
| 33 | <% App.docs.each do |slug, doc| %> | ||
| 34 | <a href="/<%= slug %>/" class="_list-item"><%= doc['full_name'] %></a> | ||
| 35 | <% end %> | ||
| 36 | <% end %> | ||
| 37 | </div> | ||
| 38 | </section> | 32 | </section> |
| 39 | <div class="_container" role="document"> | 33 | <div class="_container" role="document"> |
| 40 | <main class="_content _content-loading" role="main"></main> | 34 | <main class="_content _content-loading" role="main"></main> |
| @@ -63,9 +57,3 @@ · 22 unmodified lines | |||
| 63 | <symbol id="icon-external-link" viewBox="0 0 24 24"><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"/></symbol> | 57 | <symbol id="icon-external-link" viewBox="0 0 24 24"><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"/></symbol> |
| 64 | </defs> | 58 | </defs> |
| 65 | </svg> | 59 | </svg> |
| 66 | <style data-size="<%= app_size %>" data-resizer> | ||
| 67 | ._container { margin-left: <%= app_size %>; } | ||
| 68 | ._header, ._list { width: <%= app_size %>; } | ||
| 69 | ._list-hover.clone { min-width: <%= app_size %>; } | ||
| 70 | ._notice, ._path, ._resizer { left: <%= app_size %>; } | ||
| 71 | </style> | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
| 2 | <html<%= ' manifest="/manifest.appcache"' if App.production? %> prefix="og: http://ogp.me/ns#" lang="en" class="_booting"> | 2 | <html prefix="og: http://ogp.me/ns#" lang="en" class="_booting"> |
| 3 | <head> | 3 | <head> |
| 4 | <meta charset="utf-8"> | 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no"> | 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no"> |
| @@ -14,6 +14,7 @@ · 8 unmodified lines | |||
| 14 | <meta name="apple-mobile-web-app-capable" content="yes"> | 14 | <meta name="apple-mobile-web-app-capable" content="yes"> |
| 15 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> | 15 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
| 16 | <meta name="format-detection" content="telephone=no"> | 16 | <meta name="format-detection" content="telephone=no"> |
| 17 | <meta name="theme-color" content="#eee"> | ||
| 17 | <meta name="robots" content="noodp"> | 18 | <meta name="robots" content="noodp"> |
| 18 | <title>DevDocs API Documentation</title> | 19 | <title>DevDocs API Documentation</title> |
| 19 | <link rel="canonical" href="<%= canonical_origin %>"> | 20 | <link rel="canonical" href="<%= canonical_origin %>"> |
| @@ -30,9 +31,9 @@ · 10 unmodified lines | |||
| 30 | <link rel="apple-touch-icon" sizes="152x152" href="<%= App.cdn_origin %>/images/apple-icon-152.png"> | 31 | <link rel="apple-touch-icon" sizes="152x152" href="<%= App.cdn_origin %>/images/apple-icon-152.png"> |
| 31 | <link rel="apple-touch-icon" sizes="160x160" href="<%= App.cdn_origin %>/images/apple-icon-160.png"> | 32 | <link rel="apple-touch-icon" sizes="160x160" href="<%= App.cdn_origin %>/images/apple-icon-160.png"> |
| 32 | <link rel="mask-icon" href="<%= App.cdn_origin %>/images/webkit-mask-icon.svg" color="#398df0"> | 33 | <link rel="mask-icon" href="<%= App.cdn_origin %>/images/webkit-mask-icon.svg" color="#398df0"> |
| 33 | <link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>"> | 34 | <%= stylesheet_tag 'application' %> |
| 34 | </head> | 35 | </head> |
| 35 | <body<%= %( class="#{app_layout}") if app_layout %>> | 36 | <body> |
| 36 | <noscript class="_fail">DevDocs requires JavaScript to run.</noscript> | 37 | <noscript class="_fail">DevDocs requires JavaScript to run.</noscript> |
| 37 | <%= erb :app -%> | 38 | <%= erb :app -%> |
| 38 | <%= javascript_tag 'application', asset_host: false %> | 39 | <%= javascript_tag 'application', asset_host: false %> |
| @@ -1,14 +0,0 @@ | |||
| 1 | CACHE MANIFEST | ||
| 2 | # <%= app_theme %> <%= app_size %> <%= app_layout %> | ||
| 3 | |||
| 4 | CACHE: | ||
| 5 | / | ||
| 6 | <%= manifest_asset_urls.join "\n" %> | ||
| 7 | <%= doc_index_urls.join "\n" %> | ||
| 8 | |||
| 9 | NETWORK: | ||
| 10 | /s/ | ||
| 11 | * | ||
| 12 | |||
| 13 | FALLBACK: | ||
| 14 | / / | ||
| @@ -5,15 +5,16 @@ · 4 unmodified lines | |||
| 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> | 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> |
| 6 | <% if doc_index_page? %><meta name="description" content="<%= @doc['name'] %> <%= @doc['release'] %> API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more."><% else %><meta name="robots" content="noindex"><% end %> | 6 | <% if doc_index_page? %><meta name="description" content="<%= @doc['name'] %> <%= @doc['release'] %> API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more."><% else %><meta name="robots" content="noindex"><% end %> |
| 7 | <meta name="format-detection" content="telephone=no"> | 7 | <meta name="format-detection" content="telephone=no"> |
| 8 | <meta name="theme-color" content="#eee"> | ||
| 8 | <meta property="og:image" content="<%= App.cdn_origin %>/images/icon-320.png"> | 9 | <meta property="og:image" content="<%= App.cdn_origin %>/images/icon-320.png"> |
| 9 | <title>DevDocs<%= " — #{@doc['full_name']} documentation" if doc_index_page? %></title> | 10 | <title>DevDocs<%= " — #{@doc['full_name']} documentation" if doc_index_page? %></title> |
| 10 | <link rel="canonical" href="<%= canonical_origin %><%= request.path %>"> | 11 | <link rel="canonical" href="<%= canonical_origin %><%= request.path %>"> |
| 11 | <link rel="manifest" href="/manifest.json"> | 12 | <link rel="manifest" href="/manifest.json"> |
| 12 | <link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico"> | 13 | <link rel="icon" type="image/x-icon" href="<%= App.cdn_origin %>/favicon.ico"> |
| 13 | <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search DevDocs"> | 14 | <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search DevDocs"> |
| 14 | <link rel="stylesheet" href="<%= main_stylesheet_path %>" data-alt="<%= alternate_stylesheet_path %>"> | 15 | <%= stylesheet_tag 'application' %> |
| 15 | </head> | 16 | </head> |
| 16 | <body<%= %( class="#{app_layout}") if app_layout %> data-doc="<%= CGI::escape_html @doc.to_json %>"> | 17 | <body data-doc="<%= CGI::escape_html @doc.to_json %>"> |
| 17 | <noscript class="_fail">DevDocs requires JavaScript to run.</noscript> | 18 | <noscript class="_fail">DevDocs requires JavaScript to run.</noscript> |
| 18 | <%= erb :app -%> | 19 | <%= erb :app -%> |
| 19 | <%= javascript_tag 'application', asset_host: false %><% unless App.production? %> | 20 | <%= javascript_tag 'application', asset_host: false %><% unless App.production? %> |
| @@ -0,0 +1,49 @@ | |||
| 1 | <%# The name of the cache to store responses in %> | ||
| 2 | <%# If the cache name changes DevDocs is assumed to be updated %> | ||
| 3 | const cacheName = '<%= service_worker_cache_name %>'; | ||
| 4 | |||
| 5 | <%# Url's to cache when the service worker is installed %> | ||
| 6 | const urlsToCache = [ | ||
| 7 | '/', | ||
| 8 | '/favicon.ico', | ||
| 9 | '/manifest.json', | ||
| 10 | '<%= service_worker_asset_urls.join "',\n '" %>', | ||
| 11 | '<%= doc_index_urls.join "',\n '" %>', | ||
| 12 | ]; | ||
| 13 | |||
| 14 | <%# Set-up the cache %> | ||
| 15 | self.addEventListener('install', event => { | ||
| 16 | self.skipWaiting(); | ||
| 17 | |||
| 18 | event.waitUntil( | ||
| 19 | caches.open(cacheName).then(cache => cache.addAll(urlsToCache)), | ||
| 20 | ); | ||
| 21 | }); | ||
| 22 | |||
| 23 | <%# Remove old caches %> | ||
| 24 | self.addEventListener('activate', event => { | ||
| 25 | event.waitUntil((async () => { | ||
| 26 | const keys = await caches.keys(); | ||
| 27 | const jobs = keys.map(key => key !== cacheName ? caches.delete(key) : Promise.resolve()); | ||
| 28 | return Promise.all(jobs); | ||
| 29 | })()); | ||
| 30 | }); | ||
| 31 | |||
| 32 | <%# Handle HTTP requests %> | ||
| 33 | self.addEventListener('fetch', event => { | ||
| 34 | event.respondWith((async () => { | ||
| 35 | const cachedResponse = await caches.match(event.request); | ||
| 36 | if (cachedResponse) return cachedResponse; | ||
| 37 | |||
| 38 | const url = new URL(event.request.url); | ||
| 39 | |||
| 40 | <%# Attempt to return the index page from the cache if the user is visiting a url like devdocs.io/offline or devdocs.io/javascript/global_objects/array/find %> | ||
| 41 | <%# The index page will handle the routing %> | ||
| 42 | if (url.origin === location.origin && !url.pathname.includes('.')) { | ||
| 43 | const cachedIndex = await caches.match('/'); | ||
| 44 | if (cachedIndex) return cachedIndex; | ||
| 45 | } | ||
| 46 | |||
| 47 | return fetch(event.request); | ||
| 48 | })()); | ||
| 49 | }); | ||
| @@ -10,20 +10,17 @@ · 9 unmodified lines | |||
| 10 | <h1 class="_fail-title">Your browser is unsupported, sorry.</h1> | 10 | <h1 class="_fail-title">Your browser is unsupported, sorry.</h1> |
| 11 | <p class="_fail-text">DevDocs is an API documentation browser which supports the following browsers:</p> | 11 | <p class="_fail-text">DevDocs is an API documentation browser which supports the following browsers:</p> |
| 12 | <ul class="_fail-list"> | 12 | <ul class="_fail-list"> |
| 13 | <li>Recent versions of Chrome and Firefox</li> | 13 | <li>Recent versions of Firefox, Chrome, or Opera</li> |
| 14 | <li>Safari 5.1+</li> | 14 | <li>Safari 11.1+</li> |
| 15 | <li>Opera 12.1+</li> | 15 | <li>Edge 17+</li> |
| 16 | <li>Internet Explorer 10+</li> | 16 | <li>iOS 11.3+</li> |
| 17 | <li>iOS 6+</li> | ||
| 18 | <li>Android 4.1+</li> | ||
| 19 | <li>Windows Phone 8+</li> | ||
| 20 | </ul> | 17 | </ul> |
| 21 | <p class="_fail-text"> | 18 | <p class="_fail-text"> |
| 22 | If you're unable to upgrade, I apologize. | 19 | If you're unable to upgrade, we apologize. |
| 23 | I decided to prioritize speed and new features over support for older browsers. | 20 | We decided to prioritize speed and new features over support for older browsers. |
| 24 | </p> | 21 | </p> |
| 25 | <p class="_fail-text"> | 22 | <p class="_fail-text"> |
| 26 | — Thibaut <a href="https://twitter.com/DevDocs" class="_fail-link">@DevDocs</a> | 23 | — <a href="https://twitter.com/DevDocs">@DevDocs</a> |
| 27 | </p> | 24 | </p> |
| 28 | </div> | 25 | </div> |
| 29 | </body> | 26 | </body> |