Commit Graph

265 Commits

Author SHA1 Message Date
N. Taylor Mullen bd2a98e5ec Rename `Microsoft.AspNet.Razor.TagHelpers`.
- Name changed to `Microsoft.AspNet.Razor.Compilation.TagHelpers`.
- Changed folder locations to reflect namespace change.

#578
2015-10-22 10:25:19 -07:00
N. Taylor Mullen deaf2dc828 Enable `TagHelper`s to properly flatten to enable partial parsing.
- `TagHelper`s used to not flatten correctly resulting in inconsistent start locations for `SyntaxTreeNode`s following/within `TagHelper`s.
- This change indirectly corrected bad indentation that existed in generated C#.
- Added a test to validate `TreesAreDifferent` returns expected behavior when modifying content inside of `TagHelper`.
- Added `TagHelperBlock` `Flatten` test.

#553
2015-10-16 15:57:37 -07:00
N. Taylor Mullen 2d4092ca32 Add line pragmas to dynamic attributes.
- This enables debugging and proper error reporting for dynamic attributes. Without the pragmas errors would showcase generated Razor C# instead of their corresponding .cshtml files.
- Did not have to do any `TagHelper` specific changes since they utilize the same core attribute rendering logic.
- Updated generated C# files for tests.

#569
2015-10-16 09:41:12 -07:00
N. Taylor Mullen ed617d17e9 Remove linemappings file. 2015-10-15 15:20:57 -07:00
Pranav K 11af72a9c6 Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:39 -07:00
Pranav K 3e8b7b607d Refactor WriteAttribute \ AddHtmlAttribute
Fixes #177
2015-09-30 16:12:10 -07:00
Ajay Bhargav Baaskaran bc103fcaa4 Fix: Index out of bounds for incomplete attribute value
- #555
- Added a unit and a code generation test
2015-09-30 14:51:43 -07:00
Ryan Nowak 9a41bafea7 Fix #526 - use extension methods for AppendFormat
These changes make TagHelperContent with the IHtmlBuilder pattern, but
retain the signatures returning TagHelperContent.

Removed a bunch of tests that are no redundant with tests for the
extension methods in HttpAbstractions. Kept a few explemars in place to
ensure that the basic plumbing functions as desired.
2015-09-27 22:47:23 -07:00
Pranav K e87f10e8f8 Change ITypeInfo.IsTagHelper to ITypeInfo.ImplementsInterface(ITypeInfo)
Fixes #511
2015-09-25 21:38:36 -07:00
N. Taylor Mullen d2a7a355cc Change `[RestrictChildren]` to allow non-`TagHelper` tags.
- Updated the `TagHelperParseTreeRewriter` loosen child restrictions to non-`TagHelper` HTML elements.
- Updated tests to showcase that non-`TagHelper` elements are allowed to be restricted.
- Added an additional test case to showcase sub-sub nesting of non-`TagHelper` restricted children.

#543
2015-09-25 16:27:48 -07:00
N. Taylor Mullen 816b1f4190 Update `Lookahead` method in `Tokenizer` to maintain its existing buffer.
- Added tests to verify correctness.

#527
2015-09-25 16:23:42 -07:00
N. Taylor Mullen 67739ea565 Add `ParentTag` to `[HtmlTargetElement]`.
- `ParentTag` allows `TagHelper`s to restrict where they apply based on their immediate parent tag.
- Changed the `TagHelperParseTreeRewriter` to understand non-`TagHelper` HTML elements to properly determine a parent tag when applying `TagHelperDescriptor.RequiredParent`. This change will also enable `[RestrictChildren]` to apply to more than just `TagHelper`s.
- Added tests to validate that partial and well formed tags properly discover `TagHelper`s. Also added tests that validate that descriptors are properly created based on `TagHelper` types.

#474
2015-09-24 10:30:36 -07:00
Ryan Nowak c9341ee3d7 React to removal of ToString on TagHelperContent
The code generator generates calls to ToString() on a TagHelperContent
when used with dynamic content inside an attribute that needs to be passed
to a TagHelper as a string.

This change updates the codegen to use GetContent(IHtmlEncoder)
2015-09-23 11:07:44 -07:00
Ryan Nowak 323befaaf1 Avoid GetContent and ToString in TagHelperContent tests 2015-09-22 21:28:59 -07:00
Ajay Bhargav Baaskaran 3f34add497 Removed support for regex type names in @addTagHelper and @removeTagHelper
- #426
- Updated tests to not use regex patterns
2015-09-22 17:48:59 -07:00
N. Taylor Mullen 7239eb015c Add support for data bound symbols as attribute names.
- Took the HTML5 spec approach of disallowing specific characters and accepting all others.
- Added several parser and code generation tests to cover both `TagHelper` and non-`TagHelper` variations of symbol bound attribute names.

#137
2015-09-22 16:12:37 -07:00
Pranav K 9c456965a6 ITypeInfo.FullName should return the same value as TypeInfo.FullName
Fixes #523
2015-09-21 17:00:35 -07:00
Pranav K 388362245f Making HashCodeCombiner usage non-fluent
React to https://github.com/aspnet/Common/issues/40
2015-09-21 14:46:07 -07:00
Ajay Bhargav Baaskaran 153ed57d66 [Fixes #472] Added temporary parse error for helper directive 2015-09-21 12:09:31 -07:00
N. Taylor Mullen 0253c563be Update tests to run correctly on stable mono. 2015-09-18 17:04:03 -07:00
Kiran Challa 392b7a3710 Reacting to Dnx runtime sources changes 2015-09-18 16:28:26 -07:00
N. Taylor Mullen c494cb344d Enable `TagHelper`s with `[RestrictChildren]` to log errors for no tag name tags when targeted by catch all.
#534
2015-09-18 15:41:58 -07:00
N. Taylor Mullen 635514453b Enable `TagHelper`s with `[RestrictChildren]` to log errors for no tag name tags.
- Added test cases for situations when tags have no names.

#534
2015-09-18 14:47:48 -07:00
N. Taylor Mullen 36450c978b Add support for `@tagHelperPrefix` and `[RestrictChildren]`.
- Added a test to validate prefixed `TagHelper`s can have children with `TagHelper` prefixes.

#532
2015-09-18 12:31:07 -07:00
N. Taylor Mullen fb6a08d5de Allow `TagHelper`s inside of text/html typed script tags.
- To limit the impact of the change ensured that we only do extra work in the case that we detect a script tag with a `type` attribute.
- The parsing changes include normal HTML parsing behaviors when we detect that a script tag has a `type` attribute with value `text/html`.
- Added unit and code generation tests to validate `text/html` script tag behavior.

#502
2015-09-17 21:14:40 -07:00
Pranav K 33a0f7a0db Replace NotNullAttribute with thrown exceptions 2015-09-16 22:06:25 -07:00
Pranav K 381c055e2f Removing NotNullAttribute from Microsoft.AspNet.Razor 2015-09-14 11:58:28 -07:00
N. Taylor Mullen f71f9fb679 Rename `TargetElementAttribute` => `HtmlTargetElementAttribute`.
- Nearly every other `TagHelper` related element targeting attribute has `Html` a part of its name. With this rename, the attribute will be consistent.

#516
2015-09-13 19:14:08 -07:00
Ryan Nowak fcadbc9095 React to BufferedHtmlContent changes
This changes all TagHelperContent methods to assume that input has NOT
YET been encoded.
2015-09-13 13:49:05 -07:00
N. Taylor Mullen 4fd866f340 Update `RestrictChildrenAttribute`s properties and parameters to have consistent names.
- Other attributes such as `TargetElement` have names referring to tag names as "tags". This update makes both attributes more consistent.

#517
2015-09-13 11:57:48 -07:00
Ajay Bhargav Baaskaran e2881b0eca Extra newline no longer rendered at the end of a code block
- #485
- Using a flag to consume whitespace and newline at the end of a verbatim block
- Added tests to validate nested blocks
2015-09-10 10:39:37 -07:00
Doug Bunting 493e5521b8 Build break: Mock `TypeInfo` as well to get 4 tests working
- as of aspnet/aspnet.xunit@5a12e89 xUnit uses `TypeInfo` more often
2015-09-09 22:49:12 -07:00
Pranav K 9a7be69a0d Produce ITypeInfo \ IPropertyInfo using CodeAnalysis symbol tree 2015-09-09 16:34:12 -07:00
Pranav K 231e8a9cf4 Create an abstraction model for TypeInfo for tag helper discovery. 2015-09-08 17:37:08 -07:00
Ajay Bhargav Baaskaran 08c8f9f7ba Parse the whitespace surrounding equals in attribute correctly
- #123
 - Handled the corresponding cases in tag helper scenarios
 - Added unit and code generation tests
2015-09-08 11:43:37 -07:00
Doug Bunting 6568de38d1 Two quick fixes
- add missing closing quote in a resource
- cleanup `project.json` files
  - remove some package references that are found transitively
2015-09-08 08:39:03 -07:00
N. Taylor Mullen d458e8ecb2 Change HTML in nested C# blocks to properly handle dots.
- Prior to this change adding a `.` after an implicit expression would result in compile errors due to Razor thinking the `.` was part of the C# (normally not the case).
- Added a code generation and unit tests to validate behavior.

#491
2015-09-07 19:18:09 -07:00
N. Taylor Mullen f843aec538 Update tests to reflect new length provided `RazorError`s.
- Added new tests to validate `TagHelperDescriptorResolver` properly calculates assembly location.

#386
2015-09-02 12:05:53 -07:00
N. Taylor Mullen 09bcc67955 Update tests to use `Environment.NewLine` for source locations. 2015-09-01 01:32:21 -07:00
Ajay Bhargav Baaskaran 39dda01f47 [Fixes #484] Attributes parsed correctly when newlines precedes attributes 2015-08-28 14:59:24 -07:00
N. Taylor Mullen d0688a7e00 Add the ability for `TagHelper`s to exist inside templates.
- Previously doing `@<mytaghelper />` was invalid due to how we constructed templates lambdas.

#489
2015-08-21 16:51:47 -07:00
N. Taylor Mullen 55760b4fcb Add copy constructor to `TagHelperAttribute`.
- Added test to validate copy constructor does its job.

#492
2015-08-20 22:09:46 -07:00
Ajay Bhargav Baaskaran dad3e3ade3 [Fixes #441] Removed constructors from TagHelperAttributeDescriptor and
TagHelperDescriptor
2015-08-16 18:09:07 -07:00
N. Taylor Mullen 96f1090ff1 Fix Travis.
- Fixed test that had newlines but indexes not based on them.
2015-08-15 10:07:02 -07:00
N. Taylor Mullen cf1355245f Add `RestrictChildrenAttribute` specific `TagHelperDescriptorFactory` tests.
- We covered invalid tag names in the attribute but not the full end-to-end descriptor factory resolution piece.

#255
2015-08-14 23:52:50 -07:00
N. Taylor Mullen 465ff9713d Add ability for `TagHelper`s to specify restricted children.
- Specifying the `RestrictChildrenAttribute` enables `TagHelper`s to only allow other `TagHelper`s targeting specified names to be in the children.
- Used the `null` value to indicate that `AllowedChildren` was not specified and therefore everything is allowed. This is the default.
- Added name verification to name values to ensure that no bad values pass through the system.
- Added parsing tests to validate a mixture of content generates errors when expected.

#255
2015-08-14 23:13:57 -07:00
Pranav K 3361507c29 Remove ability to specify ignored '@' in the middle of non-string
TagHelper bound attributes.

Fixes #436
2015-08-14 18:12:31 -07:00
Ajay Bhargav Baaskaran 156f859edc Removed constructors from TagHelperAttributeDesignTimeDescriptor,
TagHelperDesignTimeDescriptor and TagHelperDirectiveDescriptor
2015-08-14 11:42:51 -07:00
N. Taylor Mullen e9292a0e30 Add ability to write start tag only `TagHelper` elements.
- To write a start tag only `TagHelper` you can now utilize the `TagStructure` property on the `TargetElement` attribute. If none is specified it'll be treated as unspecified and default to old behavior of being start/end tag or self-closing.
- Added `TagMode` to showcase what the user initially wrote in their Razor document. This way `TagHelper`s can flow end-to-end in thesame format as they were written with.
- Updated code generation to specify `TagMode` instead of the boolean self-closing.
- Updated existing tests to move from `SelfClosing` => `TagMode`.
- Added `TagStructure` related tests to the set of tests that we currently have for `TagHelperBlockRewriter` and `TagHelperParseTreeRewriter`.

#450
2015-08-13 16:18:06 -07:00
Ajay Bhargav Baaskaran 71c4c8dac6 [Fixes #428] Removed newlines at the end of razor comments 2015-08-13 15:06:09 -07:00