praxis 0.16.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +0 -1
- data/.ruby-version +1 -1
- data/.travis.yml +2 -1
- data/CHANGELOG.md +41 -0
- data/CONTRIBUTING.md +3 -0
- data/lib/api_browser/Gruntfile.js +20 -4
- data/lib/api_browser/app/bower_components/angular-mocks/.bower.json +6 -6
- data/lib/api_browser/app/bower_components/angular-mocks/README.md +11 -5
- data/lib/api_browser/app/bower_components/angular-mocks/angular-mocks.js +475 -216
- data/lib/api_browser/app/bower_components/angular-mocks/bower.json +2 -2
- data/lib/api_browser/app/bower_components/angular-mocks/ngAnimateMock.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/ngMock.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/ngMockE2E.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/package.json +1 -1
- data/lib/api_browser/app/bower_components/angular-sanitize/.bower.json +8 -8
- data/lib/api_browser/app/bower_components/angular-sanitize/README.md +19 -5
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.js +186 -127
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.min.js +12 -10
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.min.js.map +3 -3
- data/lib/api_browser/app/bower_components/angular-sanitize/bower.json +3 -2
- data/lib/api_browser/app/bower_components/angular-sanitize/index.js +2 -0
- data/lib/api_browser/app/bower_components/angular-sanitize/package.json +26 -0
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/.bower.json +15 -8
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/bower.json +11 -3
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-csp.css +6 -0
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.js +1177 -453
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.min.js +4 -4
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap.js +1066 -404
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap.min.js +3 -3
- data/lib/api_browser/app/bower_components/angular-ui-router/.bower.json +5 -6
- data/lib/api_browser/app/bower_components/angular-ui-router/CHANGELOG.md +208 -3
- data/lib/api_browser/app/bower_components/angular-ui-router/CONTRIBUTING.md +65 -0
- data/lib/api_browser/app/bower_components/angular-ui-router/LICENSE +1 -1
- data/lib/api_browser/app/bower_components/angular-ui-router/README.md +36 -71
- data/lib/api_browser/app/bower_components/angular-ui-router/api/angular-ui-router.d.ts +126 -0
- data/lib/api_browser/app/bower_components/angular-ui-router/bower.json +1 -1
- data/lib/api_browser/app/bower_components/angular-ui-router/release/angular-ui-router.js +1902 -755
- data/lib/api_browser/app/bower_components/angular-ui-router/release/angular-ui-router.min.js +2 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/common.js +69 -23
- data/lib/api_browser/app/bower_components/angular-ui-router/src/resolve.js +15 -5
- data/lib/api_browser/app/bower_components/angular-ui-router/src/state.js +556 -295
- data/lib/api_browser/app/bower_components/angular-ui-router/src/stateDirectives.js +101 -42
- data/lib/api_browser/app/bower_components/angular-ui-router/src/stateFilters.js +6 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/templateFactory.js +2 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/urlMatcherFactory.js +822 -97
- data/lib/api_browser/app/bower_components/angular-ui-router/src/urlRouter.js +274 -120
- data/lib/api_browser/app/bower_components/angular-ui-router/src/viewDirective.js +33 -20
- data/lib/api_browser/app/bower_components/angular-ui-router/src/viewScroll.js +1 -1
- data/lib/api_browser/app/bower_components/angular/.bower.json +5 -5
- data/lib/api_browser/app/bower_components/angular/README.md +2 -5
- data/lib/api_browser/app/bower_components/angular/angular-csp.css +5 -8
- data/lib/api_browser/app/bower_components/angular/angular.js +12975 -6996
- data/lib/api_browser/app/bower_components/angular/angular.min.js +285 -213
- data/lib/api_browser/app/bower_components/angular/angular.min.js.gzip +0 -0
- data/lib/api_browser/app/bower_components/angular/angular.min.js.map +3 -3
- data/lib/api_browser/app/bower_components/angular/bower.json +1 -1
- data/lib/api_browser/app/bower_components/angular/index.js +2 -0
- data/lib/api_browser/app/bower_components/angular/package.json +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/.bower.json +31 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/CHANGELOG.md +108 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/CONTRIBUTING.md +55 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/README.md +147 -206
- data/lib/api_browser/app/bower_components/bootstrap-sass/bower.json +19 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.eot +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.svg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.ttf +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.woff +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/vendor/assets/javascripts/bootstrap.js +12 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/affix.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/alert.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/button.js +11 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/carousel.js +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/collapse.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/dropdown.js +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/modal.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/popover.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/scrollspy.js +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/tab.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/tooltip.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/transition.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/vendor/assets/stylesheets/bootstrap.scss +1 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_alerts.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_badges.scss +6 -6
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_breadcrumbs.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_button-groups.scss +7 -33
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_buttons.scss +2 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_carousel.scss +1 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_close.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_code.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_component-animations.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_dropdowns.scss +3 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_forms.scss +11 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_glyphicons.scss +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_grid.scss +12 -26
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_input-groups.scss +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_jumbotron.scss +8 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_labels.scss +6 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_list-group.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_media.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_mixins.scss +38 -51
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_modals.scss +2 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_navbar.scss +41 -53
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_navs.scss +0 -20
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_normalize.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_pager.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_pagination.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_panels.scss +11 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_popovers.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_print.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_progress-bars.scss +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_responsive-utilities.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_scaffolding.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_tables.scss +5 -18
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_theme.scss +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_thumbnails.scss +9 -3
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_tooltip.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_type.scss +54 -52
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_utilities.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_variables.scss +20 -11
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_wells.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/bootstrap.scss +0 -0
- data/lib/api_browser/app/bower_components/lodash/.bower.json +9 -13
- data/lib/api_browser/app/bower_components/lodash/LICENSE.txt +3 -3
- data/lib/api_browser/app/bower_components/lodash/bower.json +4 -7
- data/lib/api_browser/app/bower_components/lodash/lodash.js +12235 -0
- data/lib/api_browser/app/bower_components/lodash/lodash.min.js +98 -0
- data/lib/api_browser/app/index.html +0 -1
- data/lib/api_browser/app/js/app.js +2 -5
- data/lib/api_browser/app/js/controllers/action.js +21 -37
- data/lib/api_browser/app/js/controllers/controller.js +23 -1
- data/lib/api_browser/app/js/controllers/menu.js +46 -14
- data/lib/api_browser/app/js/controllers/type.js +2 -9
- data/lib/api_browser/app/js/directives/attribute_description.js +15 -5
- data/lib/api_browser/app/js/directives/attribute_table.js +6 -6
- data/lib/api_browser/app/js/directives/fixed_if_fits.js +20 -0
- data/lib/api_browser/app/js/directives/no_container.js +6 -6
- data/lib/api_browser/app/js/directives/type_placeholder.js +21 -0
- data/lib/api_browser/app/js/factories/Configuration.js +13 -0
- data/lib/api_browser/app/js/factories/Documentation.js +0 -3
- data/lib/api_browser/app/js/factories/normalize_attributes.js +19 -0
- data/lib/api_browser/app/js/factories/template_for.js +113 -0
- data/lib/api_browser/app/sass/modules/_body.scss +26 -4
- data/lib/api_browser/app/sass/modules/_sidebar.scss +68 -1
- data/lib/api_browser/app/sass/praxis.scss +1 -5
- data/lib/api_browser/app/sass/variables/_bootstrap-variables.scss +13 -4
- data/lib/api_browser/app/views/action.html +13 -17
- data/lib/api_browser/app/views/controller.html +32 -4
- data/lib/api_browser/app/views/directives/attribute_description.html +1 -1
- data/lib/api_browser/app/views/directives/attribute_description/{_default.html → default.html} +0 -0
- data/lib/api_browser/app/views/directives/attribute_description/example.html +13 -0
- data/lib/api_browser/app/views/directives/attribute_description/headers.html +8 -0
- data/lib/api_browser/app/views/directives/attribute_description/member_options.html +4 -0
- data/lib/api_browser/app/views/directives/attribute_description/values.html +14 -0
- data/lib/api_browser/app/views/directives/attribute_table.html +2 -2
- data/lib/api_browser/app/views/home.html +1 -3
- data/lib/api_browser/app/views/layout.html +3 -36
- data/lib/api_browser/app/views/menu.html +45 -0
- data/lib/api_browser/app/views/navbar.html +1 -1
- data/lib/api_browser/app/views/type.html +2 -2
- data/lib/api_browser/app/views/type/{_details.html → details.html} +6 -6
- data/lib/api_browser/app/views/types/embedded/default.html +10 -0
- data/lib/api_browser/app/views/types/embedded/links.html +11 -0
- data/lib/api_browser/app/views/types/embedded/struct.html +2 -0
- data/lib/api_browser/app/views/types/label/link.html +1 -0
- data/lib/api_browser/app/views/types/label/primitive.html +1 -0
- data/lib/api_browser/app/views/types/label/primitive_collection.html +1 -0
- data/lib/api_browser/app/views/types/label/type.html +1 -0
- data/lib/api_browser/app/views/types/label/type_collection.html +1 -0
- data/lib/api_browser/app/views/{directives/request_body/_default.html → types/standalone/default.html} +1 -1
- data/lib/api_browser/app/views/types/standalone/struct.html +1 -0
- data/lib/api_browser/bower.json +9 -9
- data/lib/api_browser/package.json +1 -1
- data/lib/praxis.rb +10 -4
- data/lib/praxis/action_definition.rb +16 -4
- data/lib/praxis/action_definition/headers_dsl_compiler.rb +5 -2
- data/lib/praxis/api_definition.rb +3 -1
- data/lib/praxis/api_general_info.rb +49 -5
- data/lib/praxis/application.rb +12 -4
- data/lib/praxis/bootloader.rb +1 -0
- data/lib/praxis/bootloader_stages/environment.rb +2 -0
- data/lib/praxis/bootloader_stages/routing.rb +1 -1
- data/lib/praxis/bootloader_stages/subgroup_loader.rb +1 -0
- data/lib/praxis/exceptions/validation.rb +7 -0
- data/lib/praxis/handlers/plain.rb +16 -0
- data/lib/praxis/handlers/xml.rb +4 -4
- data/lib/praxis/links.rb +13 -3
- data/lib/praxis/media_type_identifier.rb +3 -0
- data/lib/praxis/multipart/parser.rb +41 -48
- data/lib/praxis/multipart/part.rb +196 -3
- data/lib/praxis/request.rb +14 -11
- data/lib/praxis/request_stages/request_stage.rb +4 -0
- data/lib/praxis/request_stages/response.rb +10 -9
- data/lib/praxis/request_stages/validate.rb +1 -7
- data/lib/praxis/request_stages/validate_params_and_headers.rb +30 -5
- data/lib/praxis/request_stages/validate_payload.rb +14 -5
- data/lib/praxis/resource_definition.rb +117 -15
- data/lib/praxis/response.rb +6 -5
- data/lib/praxis/response_definition.rb +51 -5
- data/lib/praxis/responses/http.rb +5 -0
- data/lib/praxis/responses/multipart_ok.rb +51 -0
- data/lib/praxis/responses/validation_error.rb +7 -7
- data/lib/praxis/restful_doc_generator.rb +9 -4
- data/lib/praxis/route.rb +3 -2
- data/lib/praxis/router.rb +26 -16
- data/lib/praxis/router/rack.rb +51 -0
- data/lib/praxis/router/simple.rb +146 -0
- data/lib/praxis/routing_config.rb +2 -2
- data/lib/praxis/trait.rb +1 -1
- data/lib/praxis/types/fuzzy_hash.rb +49 -0
- data/lib/praxis/types/media_type_common.rb +1 -1
- data/lib/praxis/types/multipart.rb +47 -12
- data/lib/praxis/types/multipart_array.rb +320 -0
- data/lib/praxis/types/multipart_array/part_definition.rb +52 -0
- data/lib/praxis/validation_handler.rb +10 -0
- data/lib/praxis/version.rb +2 -2
- data/praxis.gemspec +3 -3
- data/spec/api_browser/directives/type_placeholder_spec.js +134 -0
- data/spec/api_browser/factories/normalize_attributes_spec.js +97 -0
- data/spec/api_browser/factories/template_for_spec.js +67 -0
- data/spec/functional_spec.rb +111 -45
- data/spec/praxis/action_definition_spec.rb +31 -7
- data/spec/praxis/api_definition_spec.rb +2 -2
- data/spec/praxis/api_general_info_spec.rb +25 -0
- data/spec/praxis/application_spec.rb +24 -11
- data/spec/praxis/handlers/xml_spec.rb +55 -33
- data/spec/praxis/links_spec.rb +18 -1
- data/spec/praxis/media_type_collection_spec.rb +1 -1
- data/spec/praxis/media_type_spec.rb +2 -2
- data/spec/praxis/multipart/parser_spec.rb +21 -13
- data/spec/praxis/plugins/praxis_mapper_plugin_spec.rb +1 -1
- data/spec/praxis/request_spec.rb +52 -24
- data/spec/praxis/{request_stages_action_spec.rb → request_stages/action_spec.rb} +1 -1
- data/spec/praxis/{request_stage_spec.rb → request_stages/request_stage_spec.rb} +0 -0
- data/spec/praxis/{request_stages_validate_spec.rb → request_stages/validate_spec.rb} +1 -1
- data/spec/praxis/resource_definition_spec.rb +30 -4
- data/spec/praxis/response_definition_spec.rb +60 -19
- data/spec/praxis/response_spec.rb +2 -2
- data/spec/praxis/responses/validation_error_spec.rb +33 -16
- data/spec/praxis/route_spec.rb +4 -2
- data/spec/praxis/router_spec.rb +28 -12
- data/spec/praxis/routing_config_spec.rb +11 -5
- data/spec/praxis/types/collection_spec.rb +1 -1
- data/spec/praxis/types/fuzzy_hash_spec.rb +20 -0
- data/spec/praxis/types/multipart_array/part_definition_spec.rb +5 -0
- data/spec/praxis/types/multipart_array_spec.rb +334 -0
- data/spec/praxis/types/multipart_spec.rb +14 -5
- data/spec/spec_app/app/controllers/instances.rb +20 -10
- data/spec/spec_app/app/controllers/volumes.rb +8 -4
- data/spec/spec_app/app/responses/bulk_response.rb +0 -6
- data/spec/spec_app/config/environment.rb +13 -0
- data/spec/spec_app/design/api.rb +7 -10
- data/spec/spec_app/design/media_types/instance.rb +3 -1
- data/spec/spec_app/design/resources/instances.rb +50 -41
- data/spec/spec_app/design/resources/volume_snapshots.rb +39 -0
- data/spec/spec_app/design/resources/volumes.rb +11 -6
- data/spec/spec_helper.rb +3 -1
- metadata +125 -218
- data/lib/api_browser/app/bower_components/angular-ui-router/src/compat.js +0 -146
- data/lib/api_browser/app/bower_components/bootstrap-sass/CNAME +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/DOCS-LICENSE +0 -319
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gemfile +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gemfile.lock +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gruntfile.js +0 -244
- data/lib/api_browser/app/bower_components/bootstrap-sass/LICENSE +0 -176
- data/lib/api_browser/app/bower_components/bootstrap-sass/LICENSE-MIT +0 -21
- data/lib/api_browser/app/bower_components/bootstrap-sass/Rakefile +0 -44
- data/lib/api_browser/app/bower_components/bootstrap-sass/_config.yml +0 -25
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/ads.html +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/footer.html +0 -34
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/header.html +0 -42
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-about.html +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-components.html +0 -137
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-css.html +0 -99
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-customize.html +0 -40
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-getting-started.html +0 -44
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-javascript.html +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-main.html +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/old-bs-docs.html +0 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/social-buttons.html +0 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/_layouts/default.html +0 -79
- data/lib/api_browser/app/bower_components/bootstrap-sass/_layouts/home.html +0 -47
- data/lib/api_browser/app/bower_components/bootstrap-sass/about.html +0 -93
- data/lib/api_browser/app/bower_components/bootstrap-sass/browserstack.json +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/components.html +0 -3689
- data/lib/api_browser/app/bower_components/bootstrap-sass/composer.json +0 -28
- data/lib/api_browser/app/bower_components/bootstrap-sass/css.html +0 -2674
- data/lib/api_browser/app/bower_components/bootstrap-sass/customize.html +0 -1715
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap-theme.css +0 -427
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap-theme.min.css +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap.css +0 -6350
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap.min.css +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/js/bootstrap.js +0 -2002
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/js/bootstrap.min.js +0 -9
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/css/docs.css +0 -1195
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/css/pygments-manni.css +0 -66
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/ico/favicon.png +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/application.js +0 -103
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/customizer.js +0 -332
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/filesaver.js +0 -169
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/holder.js +0 -404
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/ie8-responsive-file-warning.js +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/jszip.js +0 -1467
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/less.js +0 -9
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/raw-files.js +0 -3
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/uglify.js +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/carousel/carousel.css +0 -148
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/carousel/index.html +0 -206
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/grid/grid.css +0 -28
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/grid/index.html +0 -148
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron-narrow/index.html +0 -82
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron-narrow/jumbotron-narrow.css +0 -79
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron/index.html +0 -99
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron/jumbotron.css +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/justified-nav/index.html +0 -83
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/justified-nav/justified-nav.css +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-fixed-top/index.html +0 -91
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-fixed-top/navbar-fixed-top.css +0 -4
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-static-top/index.html +0 -92
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-static-top/navbar-static-top.css +0 -7
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar/index.html +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar/navbar.css +0 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/non-responsive/index.html +0 -101
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/non-responsive/non-responsive.css +0 -116
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/index.html +0 -130
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/offcanvas.css +0 -50
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/offcanvas.js +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/carousel.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/grid.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/jumbotron-narrow.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/jumbotron.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/justified-nav.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar-fixed.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar-static.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/non-responsive.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/offcanvas.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sign-in.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/starter-template.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sticky-footer-navbar.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sticky-footer.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/theme.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/signin/index.html +0 -50
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/signin/signin.css +0 -40
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/starter-template/index.html +0 -68
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/starter-template/starter-template.css +0 -7
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer-navbar/index.html +0 -91
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer-navbar/sticky-footer-navbar.css +0 -45
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer/index.html +0 -55
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer/sticky-footer.css +0 -38
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/theme/index.html +0 -384
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/theme/theme.css +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.svg +0 -229
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/getting-started.html +0 -1021
- data/lib/api_browser/app/bower_components/bootstrap-sass/index.html +0 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/javascript.html +0 -1983
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/index.html +0 -52
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/affix.js +0 -25
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/alert.js +0 -62
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/button.js +0 -116
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/carousel.js +0 -87
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/collapse.js +0 -164
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/dropdown.js +0 -219
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/modal.js +0 -196
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/phantom.js +0 -69
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/popover.js +0 -133
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/scrollspy.js +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/tab.js +0 -86
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/tooltip.js +0 -437
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/transition.js +0 -13
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/jquery.js +0 -6
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/qunit.css +0 -232
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/qunit.js +0 -1510
- data/lib/api_browser/app/bower_components/bootstrap-sass/package.json +0 -40
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.compat.js +0 -7157
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.compat.min.js +0 -61
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.js +0 -6785
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.min.js +0 -56
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.underscore.js +0 -4979
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.underscore.min.js +0 -39
- data/lib/api_browser/app/js/directives/attribute_table_row.js +0 -17
- data/lib/api_browser/app/js/directives/request_body.js +0 -25
- data/lib/api_browser/app/js/directives/request_headers.js +0 -17
- data/lib/api_browser/app/js/directives/request_parameters.js +0 -17
- data/lib/api_browser/app/js/directives/type_label.js +0 -52
- data/lib/api_browser/app/js/factories/PayloadTemplates.js +0 -10
- data/lib/api_browser/app/js/factories/TemplateProvider.js +0 -45
- data/lib/api_browser/app/js/factories/TypeTemplates.js +0 -11
- data/lib/api_browser/app/views/directives/attribute_description/_example.html +0 -13
- data/lib/api_browser/app/views/directives/attribute_description/_headers.html +0 -8
- data/lib/api_browser/app/views/directives/attribute_table_row/_default.html +0 -10
- data/lib/api_browser/app/views/directives/attribute_table_row/_links.html +0 -11
- data/lib/api_browser/app/views/directives/attribute_table_row/_struct.html +0 -2
- data/lib/api_browser/app/views/directives/request_body/_struct.html +0 -1
- data/lib/api_browser/app/views/resource/_actions.html +0 -27
@@ -1,19 +1,19 @@
|
|
1
1
|
{
|
2
2
|
"name": "angular-sanitize",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.4.0",
|
4
4
|
"main": "./angular-sanitize.js",
|
5
|
+
"ignore": [],
|
5
6
|
"dependencies": {
|
6
|
-
"angular": "1.
|
7
|
+
"angular": "1.4.0"
|
7
8
|
},
|
8
9
|
"homepage": "https://github.com/angular/bower-angular-sanitize",
|
9
|
-
"_release": "1.
|
10
|
+
"_release": "1.4.0",
|
10
11
|
"_resolution": {
|
11
12
|
"type": "version",
|
12
|
-
"tag": "v1.
|
13
|
-
"commit": "
|
13
|
+
"tag": "v1.4.0",
|
14
|
+
"commit": "a64d96eff0b9f15db70322e77bc20c2e64bd8e07"
|
14
15
|
},
|
15
16
|
"_source": "git://github.com/angular/bower-angular-sanitize.git",
|
16
|
-
"_target": "~1.
|
17
|
-
"_originalSource": "angular-sanitize"
|
18
|
-
"_direct": true
|
17
|
+
"_target": "~1.4",
|
18
|
+
"_originalSource": "angular-sanitize"
|
19
19
|
}
|
@@ -1,12 +1,26 @@
|
|
1
|
-
#
|
1
|
+
# packaged angular-sanitize
|
2
2
|
|
3
|
-
This repo is for distribution on `bower`. The source for this module is in the
|
3
|
+
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
4
4
|
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngSanitize).
|
5
5
|
Please file issues and pull requests against that repo.
|
6
6
|
|
7
7
|
## Install
|
8
8
|
|
9
|
-
|
9
|
+
You can install this package either with `npm` or with `bower`.
|
10
|
+
|
11
|
+
### npm
|
12
|
+
|
13
|
+
```shell
|
14
|
+
npm install angular-sanitize
|
15
|
+
```
|
16
|
+
|
17
|
+
Then add `ngSanitize` as a dependency for your app:
|
18
|
+
|
19
|
+
```javascript
|
20
|
+
angular.module('myApp', [require('angular-sanitize')]);
|
21
|
+
```
|
22
|
+
|
23
|
+
### bower
|
10
24
|
|
11
25
|
```shell
|
12
26
|
bower install angular-sanitize
|
@@ -18,7 +32,7 @@ Add a `<script>` to your `index.html`:
|
|
18
32
|
<script src="/bower_components/angular-sanitize/angular-sanitize.js"></script>
|
19
33
|
```
|
20
34
|
|
21
|
-
|
35
|
+
Then add `ngSanitize` as a dependency for your app:
|
22
36
|
|
23
37
|
```javascript
|
24
38
|
angular.module('myApp', ['ngSanitize']);
|
@@ -33,7 +47,7 @@ Documentation is available on the
|
|
33
47
|
|
34
48
|
The MIT License
|
35
49
|
|
36
|
-
Copyright (c) 2010-
|
50
|
+
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
|
37
51
|
|
38
52
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
39
53
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -1,10 +1,21 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
3
|
-
* (c) 2010-
|
2
|
+
* @license AngularJS v1.4.0
|
3
|
+
* (c) 2010-2015 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
6
|
(function(window, angular, undefined) {'use strict';
|
7
7
|
|
8
|
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
9
|
+
* Any commits to this file should be reviewed with security in mind. *
|
10
|
+
* Changes to this file can potentially create security vulnerabilities. *
|
11
|
+
* An approval from 2 Core members with history of modifying *
|
12
|
+
* this file is required. *
|
13
|
+
* *
|
14
|
+
* Does the change somehow allow for arbitrary javascript to be executed? *
|
15
|
+
* Or allows for someone to change the prototype of built-in objects? *
|
16
|
+
* Or gives undesired access to variables likes document or window? *
|
17
|
+
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
18
|
+
|
8
19
|
var $sanitizeMinErr = angular.$$minErr('$sanitize');
|
9
20
|
|
10
21
|
/**
|
@@ -42,35 +53,36 @@ var $sanitizeMinErr = angular.$$minErr('$sanitize');
|
|
42
53
|
/**
|
43
54
|
* @ngdoc service
|
44
55
|
* @name $sanitize
|
45
|
-
* @function
|
56
|
+
* @kind function
|
46
57
|
*
|
47
58
|
* @description
|
48
|
-
* The input is sanitized by parsing the
|
59
|
+
* The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
|
49
60
|
* then serialized back to properly escaped html string. This means that no unsafe input can make
|
50
61
|
* it into the returned string, however, since our parser is more strict than a typical browser
|
51
62
|
* parser, it's possible that some obscure input, which would be recognized as valid HTML by a
|
52
|
-
* browser, won't make it through the sanitizer.
|
63
|
+
* browser, won't make it through the sanitizer. The input may also contain SVG markup.
|
53
64
|
* The whitelist is configured using the functions `aHrefSanitizationWhitelist` and
|
54
65
|
* `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.
|
55
66
|
*
|
56
|
-
* @param {string} html
|
57
|
-
* @returns {string} Sanitized
|
67
|
+
* @param {string} html HTML input.
|
68
|
+
* @returns {string} Sanitized HTML.
|
58
69
|
*
|
59
70
|
* @example
|
60
|
-
<example module="
|
71
|
+
<example module="sanitizeExample" deps="angular-sanitize.js">
|
61
72
|
<file name="index.html">
|
62
73
|
<script>
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
74
|
+
angular.module('sanitizeExample', ['ngSanitize'])
|
75
|
+
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
|
76
|
+
$scope.snippet =
|
77
|
+
'<p style="color:blue">an html\n' +
|
78
|
+
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
|
79
|
+
'snippet</p>';
|
80
|
+
$scope.deliberatelyTrustDangerousSnippet = function() {
|
81
|
+
return $sce.trustAsHtml($scope.snippet);
|
82
|
+
};
|
83
|
+
}]);
|
72
84
|
</script>
|
73
|
-
<div ng-controller="
|
85
|
+
<div ng-controller="ExampleController">
|
74
86
|
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
75
87
|
<table>
|
76
88
|
<tr>
|
@@ -158,14 +170,15 @@ function sanitizeText(chars) {
|
|
158
170
|
|
159
171
|
// Regular Expressions for parsing tags and attributes
|
160
172
|
var START_TAG_REGEXP =
|
161
|
-
|
162
|
-
END_TAG_REGEXP =
|
173
|
+
/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,
|
174
|
+
END_TAG_REGEXP = /^<\/\s*([\w:-]+)[^>]*>/,
|
163
175
|
ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,
|
164
176
|
BEGIN_TAG_REGEXP = /^</,
|
165
|
-
BEGING_END_TAGE_REGEXP =
|
177
|
+
BEGING_END_TAGE_REGEXP = /^<\//,
|
166
178
|
COMMENT_REGEXP = /<!--(.*?)-->/g,
|
167
179
|
DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i,
|
168
180
|
CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g,
|
181
|
+
SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
169
182
|
// Match everything outside of normal chars and " (quote character)
|
170
183
|
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
|
171
184
|
|
@@ -196,6 +209,13 @@ var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap("a
|
|
196
209
|
"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
|
197
210
|
"samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
|
198
211
|
|
212
|
+
// SVG Elements
|
213
|
+
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
|
214
|
+
// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
|
215
|
+
// They can potentially allow for arbitrary javascript to be executed. See #11290
|
216
|
+
var svgElements = makeMap("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph," +
|
217
|
+
"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
|
218
|
+
"radialGradient,rect,stop,svg,switch,text,title,tspan,use");
|
199
219
|
|
200
220
|
// Special Elements (can contain anything)
|
201
221
|
var specialElements = makeMap("script,style");
|
@@ -204,20 +224,46 @@ var validElements = angular.extend({},
|
|
204
224
|
voidElements,
|
205
225
|
blockElements,
|
206
226
|
inlineElements,
|
207
|
-
optionalEndTagElements
|
227
|
+
optionalEndTagElements,
|
228
|
+
svgElements);
|
208
229
|
|
209
230
|
//Attributes that have href and hence need to be sanitized
|
210
|
-
var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap");
|
211
|
-
|
212
|
-
|
213
|
-
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+
|
214
|
-
'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+
|
215
|
-
'scope,scrolling,shape,size,span,start,summary,target,title,type,'+
|
216
|
-
'valign,value,vspace,width')
|
217
|
-
|
218
|
-
|
231
|
+
var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap,xlink:href");
|
232
|
+
|
233
|
+
var htmlAttrs = makeMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
|
234
|
+
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
|
235
|
+
'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
|
236
|
+
'scope,scrolling,shape,size,span,start,summary,target,title,type,' +
|
237
|
+
'valign,value,vspace,width');
|
238
|
+
|
239
|
+
// SVG attributes (without "id" and "name" attributes)
|
240
|
+
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
|
241
|
+
var svgAttrs = makeMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
|
242
|
+
'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
|
243
|
+
'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
|
244
|
+
'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
|
245
|
+
'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
|
246
|
+
'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
|
247
|
+
'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
|
248
|
+
'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
|
249
|
+
'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
|
250
|
+
'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
|
251
|
+
'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
|
252
|
+
'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
|
253
|
+
'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
|
254
|
+
'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
|
255
|
+
'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
|
256
|
+
|
257
|
+
var validAttrs = angular.extend({},
|
258
|
+
uriAttrs,
|
259
|
+
svgAttrs,
|
260
|
+
htmlAttrs);
|
261
|
+
|
262
|
+
function makeMap(str, lowercaseKeys) {
|
219
263
|
var obj = {}, items = str.split(','), i;
|
220
|
-
for (i = 0; i < items.length; i++)
|
264
|
+
for (i = 0; i < items.length; i++) {
|
265
|
+
obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true;
|
266
|
+
}
|
221
267
|
return obj;
|
222
268
|
}
|
223
269
|
|
@@ -234,78 +280,94 @@ function makeMap(str) {
|
|
234
280
|
* @param {string} html string
|
235
281
|
* @param {object} handler
|
236
282
|
*/
|
237
|
-
function htmlParser(
|
238
|
-
|
239
|
-
|
283
|
+
function htmlParser(html, handler) {
|
284
|
+
if (typeof html !== 'string') {
|
285
|
+
if (html === null || typeof html === 'undefined') {
|
286
|
+
html = '';
|
287
|
+
} else {
|
288
|
+
html = '' + html;
|
289
|
+
}
|
290
|
+
}
|
291
|
+
var index, chars, match, stack = [], last = html, text;
|
292
|
+
stack.last = function() { return stack[stack.length - 1]; };
|
240
293
|
|
241
|
-
while (
|
294
|
+
while (html) {
|
295
|
+
text = '';
|
242
296
|
chars = true;
|
243
297
|
|
244
298
|
// Make sure we're not in a script or style element
|
245
|
-
if (
|
299
|
+
if (!stack.last() || !specialElements[stack.last()]) {
|
246
300
|
|
247
301
|
// Comment
|
248
|
-
if (
|
302
|
+
if (html.indexOf("<!--") === 0) {
|
249
303
|
// comments containing -- are not allowed unless they terminate the comment
|
250
304
|
index = html.indexOf("--", 4);
|
251
305
|
|
252
|
-
if (
|
253
|
-
if (handler.comment) handler.comment(
|
254
|
-
html = html.substring(
|
306
|
+
if (index >= 0 && html.lastIndexOf("-->", index) === index) {
|
307
|
+
if (handler.comment) handler.comment(html.substring(4, index));
|
308
|
+
html = html.substring(index + 3);
|
255
309
|
chars = false;
|
256
310
|
}
|
257
311
|
// DOCTYPE
|
258
|
-
} else if (
|
259
|
-
match = html.match(
|
312
|
+
} else if (DOCTYPE_REGEXP.test(html)) {
|
313
|
+
match = html.match(DOCTYPE_REGEXP);
|
260
314
|
|
261
|
-
if (
|
262
|
-
html = html.replace(
|
315
|
+
if (match) {
|
316
|
+
html = html.replace(match[0], '');
|
263
317
|
chars = false;
|
264
318
|
}
|
265
319
|
// end tag
|
266
|
-
} else if (
|
267
|
-
match = html.match(
|
320
|
+
} else if (BEGING_END_TAGE_REGEXP.test(html)) {
|
321
|
+
match = html.match(END_TAG_REGEXP);
|
268
322
|
|
269
|
-
if (
|
270
|
-
html = html.substring(
|
271
|
-
match[0].replace(
|
323
|
+
if (match) {
|
324
|
+
html = html.substring(match[0].length);
|
325
|
+
match[0].replace(END_TAG_REGEXP, parseEndTag);
|
272
326
|
chars = false;
|
273
327
|
}
|
274
328
|
|
275
329
|
// start tag
|
276
|
-
} else if (
|
277
|
-
match = html.match(
|
278
|
-
|
279
|
-
if (
|
280
|
-
|
281
|
-
match[
|
330
|
+
} else if (BEGIN_TAG_REGEXP.test(html)) {
|
331
|
+
match = html.match(START_TAG_REGEXP);
|
332
|
+
|
333
|
+
if (match) {
|
334
|
+
// We only have a valid start-tag if there is a '>'.
|
335
|
+
if (match[4]) {
|
336
|
+
html = html.substring(match[0].length);
|
337
|
+
match[0].replace(START_TAG_REGEXP, parseStartTag);
|
338
|
+
}
|
282
339
|
chars = false;
|
340
|
+
} else {
|
341
|
+
// no ending tag found --- this piece should be encoded as an entity.
|
342
|
+
text += '<';
|
343
|
+
html = html.substring(1);
|
283
344
|
}
|
284
345
|
}
|
285
346
|
|
286
|
-
if (
|
347
|
+
if (chars) {
|
287
348
|
index = html.indexOf("<");
|
288
349
|
|
289
|
-
|
290
|
-
html = index < 0 ? "" : html.substring(
|
350
|
+
text += index < 0 ? html : html.substring(0, index);
|
351
|
+
html = index < 0 ? "" : html.substring(index);
|
291
352
|
|
292
|
-
if (handler.chars) handler.chars(
|
353
|
+
if (handler.chars) handler.chars(decodeEntities(text));
|
293
354
|
}
|
294
355
|
|
295
356
|
} else {
|
296
|
-
|
297
|
-
|
357
|
+
// IE versions 9 and 10 do not understand the regex '[^]', so using a workaround with [\W\w].
|
358
|
+
html = html.replace(new RegExp("([\\W\\w]*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
|
359
|
+
function(all, text) {
|
298
360
|
text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");
|
299
361
|
|
300
|
-
if (handler.chars) handler.chars(
|
362
|
+
if (handler.chars) handler.chars(decodeEntities(text));
|
301
363
|
|
302
364
|
return "";
|
303
365
|
});
|
304
366
|
|
305
|
-
parseEndTag(
|
367
|
+
parseEndTag("", stack.last());
|
306
368
|
}
|
307
369
|
|
308
|
-
if (
|
370
|
+
if (html == last) {
|
309
371
|
throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " +
|
310
372
|
"of html: {0}", html);
|
311
373
|
}
|
@@ -315,22 +377,23 @@ function htmlParser( html, handler ) {
|
|
315
377
|
// Clean up any remaining tags
|
316
378
|
parseEndTag();
|
317
379
|
|
318
|
-
function parseStartTag(
|
380
|
+
function parseStartTag(tag, tagName, rest, unary) {
|
319
381
|
tagName = angular.lowercase(tagName);
|
320
|
-
if (
|
321
|
-
while (
|
322
|
-
parseEndTag(
|
382
|
+
if (blockElements[tagName]) {
|
383
|
+
while (stack.last() && inlineElements[stack.last()]) {
|
384
|
+
parseEndTag("", stack.last());
|
323
385
|
}
|
324
386
|
}
|
325
387
|
|
326
|
-
if (
|
327
|
-
parseEndTag(
|
388
|
+
if (optionalEndTagElements[tagName] && stack.last() == tagName) {
|
389
|
+
parseEndTag("", tagName);
|
328
390
|
}
|
329
391
|
|
330
|
-
unary = voidElements[
|
392
|
+
unary = voidElements[tagName] || !!unary;
|
331
393
|
|
332
|
-
if (
|
333
|
-
stack.push(
|
394
|
+
if (!unary) {
|
395
|
+
stack.push(tagName);
|
396
|
+
}
|
334
397
|
|
335
398
|
var attrs = {};
|
336
399
|
|
@@ -343,22 +406,23 @@ function htmlParser( html, handler ) {
|
|
343
406
|
|
344
407
|
attrs[name] = decodeEntities(value);
|
345
408
|
});
|
346
|
-
if (handler.start) handler.start(
|
409
|
+
if (handler.start) handler.start(tagName, attrs, unary);
|
347
410
|
}
|
348
411
|
|
349
|
-
function parseEndTag(
|
412
|
+
function parseEndTag(tag, tagName) {
|
350
413
|
var pos = 0, i;
|
351
414
|
tagName = angular.lowercase(tagName);
|
352
|
-
if (
|
415
|
+
if (tagName) {
|
353
416
|
// Find the closest opened tag of the same type
|
354
|
-
for (
|
355
|
-
if (
|
356
|
-
|
417
|
+
for (pos = stack.length - 1; pos >= 0; pos--) {
|
418
|
+
if (stack[pos] == tagName) break;
|
419
|
+
}
|
420
|
+
}
|
357
421
|
|
358
|
-
if (
|
422
|
+
if (pos >= 0) {
|
359
423
|
// Close all the open elements, up the stack
|
360
|
-
for (
|
361
|
-
if (handler.end) handler.end(
|
424
|
+
for (i = stack.length - 1; i >= pos; i--)
|
425
|
+
if (handler.end) handler.end(stack[i]);
|
362
426
|
|
363
427
|
// Remove the open elements from the stack
|
364
428
|
stack.length = pos;
|
@@ -367,7 +431,6 @@ function htmlParser( html, handler ) {
|
|
367
431
|
}
|
368
432
|
|
369
433
|
var hiddenPre=document.createElement("pre");
|
370
|
-
var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/;
|
371
434
|
/**
|
372
435
|
* decodes all entities into regular string
|
373
436
|
* @param value
|
@@ -376,22 +439,10 @@ var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/;
|
|
376
439
|
function decodeEntities(value) {
|
377
440
|
if (!value) { return ''; }
|
378
441
|
|
379
|
-
|
380
|
-
//
|
381
|
-
|
382
|
-
|
383
|
-
var spaceAfter = parts[3];
|
384
|
-
var content = parts[2];
|
385
|
-
if (content) {
|
386
|
-
hiddenPre.innerHTML=content.replace(/</g,"<");
|
387
|
-
// innerText depends on styling as it doesn't display hidden elements.
|
388
|
-
// Therefore, it's better to use textContent not to cause unnecessary
|
389
|
-
// reflows. However, IE<9 don't support textContent so the innerText
|
390
|
-
// fallback is necessary.
|
391
|
-
content = 'textContent' in hiddenPre ?
|
392
|
-
hiddenPre.textContent : hiddenPre.innerText;
|
393
|
-
}
|
394
|
-
return spaceBefore + content + spaceAfter;
|
442
|
+
hiddenPre.innerHTML = value.replace(/</g,"<");
|
443
|
+
// innerText depends on styling as it doesn't display hidden elements.
|
444
|
+
// Therefore, it's better to use textContent not to cause unnecessary reflows.
|
445
|
+
return hiddenPre.textContent;
|
395
446
|
}
|
396
447
|
|
397
448
|
/**
|
@@ -404,7 +455,12 @@ function decodeEntities(value) {
|
|
404
455
|
function encodeEntities(value) {
|
405
456
|
return value.
|
406
457
|
replace(/&/g, '&').
|
407
|
-
replace(
|
458
|
+
replace(SURROGATE_PAIR_REGEXP, function(value) {
|
459
|
+
var hi = value.charCodeAt(0);
|
460
|
+
var low = value.charCodeAt(1);
|
461
|
+
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
462
|
+
}).
|
463
|
+
replace(NON_ALPHANUMERIC_REGEXP, function(value) {
|
408
464
|
return '&#' + value.charCodeAt(0) + ';';
|
409
465
|
}).
|
410
466
|
replace(/</g, '<').
|
@@ -421,11 +477,11 @@ function encodeEntities(value) {
|
|
421
477
|
* comment: function(text) {}
|
422
478
|
* }
|
423
479
|
*/
|
424
|
-
function htmlSanitizeWriter(buf, uriValidator){
|
480
|
+
function htmlSanitizeWriter(buf, uriValidator) {
|
425
481
|
var ignore = false;
|
426
482
|
var out = angular.bind(buf, buf.push);
|
427
483
|
return {
|
428
|
-
start: function(tag, attrs, unary){
|
484
|
+
start: function(tag, attrs, unary) {
|
429
485
|
tag = angular.lowercase(tag);
|
430
486
|
if (!ignore && specialElements[tag]) {
|
431
487
|
ignore = tag;
|
@@ -433,7 +489,7 @@ function htmlSanitizeWriter(buf, uriValidator){
|
|
433
489
|
if (!ignore && validElements[tag] === true) {
|
434
490
|
out('<');
|
435
491
|
out(tag);
|
436
|
-
angular.forEach(attrs, function(value, key){
|
492
|
+
angular.forEach(attrs, function(value, key) {
|
437
493
|
var lkey=angular.lowercase(key);
|
438
494
|
var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
|
439
495
|
if (validAttrs[lkey] === true &&
|
@@ -448,7 +504,7 @@ function htmlSanitizeWriter(buf, uriValidator){
|
|
448
504
|
out(unary ? '/>' : '>');
|
449
505
|
}
|
450
506
|
},
|
451
|
-
end: function(tag){
|
507
|
+
end: function(tag) {
|
452
508
|
tag = angular.lowercase(tag);
|
453
509
|
if (!ignore && validElements[tag] === true) {
|
454
510
|
out('</');
|
@@ -459,7 +515,7 @@ function htmlSanitizeWriter(buf, uriValidator){
|
|
459
515
|
ignore = false;
|
460
516
|
}
|
461
517
|
},
|
462
|
-
chars: function(chars){
|
518
|
+
chars: function(chars) {
|
463
519
|
if (!ignore) {
|
464
520
|
out(encodeEntities(chars));
|
465
521
|
}
|
@@ -476,7 +532,7 @@ angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
|
|
476
532
|
/**
|
477
533
|
* @ngdoc filter
|
478
534
|
* @name linky
|
479
|
-
* @function
|
535
|
+
* @kind function
|
480
536
|
*
|
481
537
|
* @description
|
482
538
|
* Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and
|
@@ -492,20 +548,21 @@ angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
|
|
492
548
|
<span ng-bind-html="linky_expression | linky"></span>
|
493
549
|
*
|
494
550
|
* @example
|
495
|
-
<example module="
|
551
|
+
<example module="linkyExample" deps="angular-sanitize.js">
|
496
552
|
<file name="index.html">
|
497
553
|
<script>
|
498
|
-
|
499
|
-
$scope
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
554
|
+
angular.module('linkyExample', ['ngSanitize'])
|
555
|
+
.controller('ExampleController', ['$scope', function($scope) {
|
556
|
+
$scope.snippet =
|
557
|
+
'Pretty text with some links:\n'+
|
558
|
+
'http://angularjs.org/,\n'+
|
559
|
+
'mailto:us@somewhere.org,\n'+
|
560
|
+
'another@somewhere.org,\n'+
|
561
|
+
'and one more: ftp://127.0.0.1/.';
|
562
|
+
$scope.snippetWithTarget = 'http://angularjs.org/';
|
563
|
+
}]);
|
507
564
|
</script>
|
508
|
-
<div ng-controller="
|
565
|
+
<div ng-controller="ExampleController">
|
509
566
|
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
510
567
|
<table>
|
511
568
|
<tr>
|
@@ -574,7 +631,7 @@ angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
|
|
574
631
|
*/
|
575
632
|
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
|
576
633
|
var LINKY_URL_REGEXP =
|
577
|
-
/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,
|
634
|
+
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/,
|
578
635
|
MAILTO_REGEXP = /^mailto:/;
|
579
636
|
|
580
637
|
return function(text, target) {
|
@@ -587,8 +644,10 @@ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
|
|
587
644
|
while ((match = raw.match(LINKY_URL_REGEXP))) {
|
588
645
|
// We can not end in these as they are sometimes found at the end of the sentence
|
589
646
|
url = match[0];
|
590
|
-
// if we did not match ftp/http/mailto then assume mailto
|
591
|
-
if (match[2]
|
647
|
+
// if we did not match ftp/http/www/mailto then assume mailto
|
648
|
+
if (!match[2] && !match[4]) {
|
649
|
+
url = (match[3] ? 'http://' : 'mailto:') + url;
|
650
|
+
}
|
592
651
|
i = match.index;
|
593
652
|
addText(raw.substr(0, i));
|
594
653
|
addLink(url, match[0].replace(MAILTO_REGEXP, ''));
|
@@ -607,13 +666,13 @@ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
|
|
607
666
|
function addLink(url, text) {
|
608
667
|
html.push('<a ');
|
609
668
|
if (angular.isDefined(target)) {
|
610
|
-
html.push('target="'
|
611
|
-
|
612
|
-
|
669
|
+
html.push('target="',
|
670
|
+
target,
|
671
|
+
'" ');
|
613
672
|
}
|
614
|
-
html.push('href="'
|
615
|
-
|
616
|
-
|
673
|
+
html.push('href="',
|
674
|
+
url.replace(/"/g, '"'),
|
675
|
+
'">');
|
617
676
|
addText(text);
|
618
677
|
html.push('</a>');
|
619
678
|
}
|