@@ -17,24 +17,14 @@ use proc_macro::TokenStream;
1717use proc_macro2:: { Ident , TokenStream as TokenStream2 } ;
1818use proc_macro2_diagnostics:: Diagnostic ;
1919use quote:: quote;
20- #[ cfg( feature = "basic-css" ) ]
21- use quote:: quote_spanned;
2220use rstml:: { node:: Node , Parser , ParserConfig } ;
23- #[ cfg( feature = "basic-css" ) ]
24- use syn:: spanned:: Spanned ;
2521use syn:: Type ;
2622
2723#[ proc_macro]
2824pub fn html ( tokens : TokenStream ) -> TokenStream {
2925 html_inner ( tokens. into ( ) , None )
3026}
3127
32- #[ cfg( feature = "basic-css" ) ]
33- #[ proc_macro]
34- pub fn style ( tokens : TokenStream ) -> TokenStream {
35- style_inner ( tokens. into ( ) )
36- }
37-
3828#[ cfg( feature = "typed" ) ]
3929#[ proc_macro]
4030pub fn typed_html ( tokens : TokenStream ) -> TokenStream {
@@ -179,37 +169,3 @@ fn tokenize_nodes(
179169
180170 ( token_streams, diagnostics)
181171}
182-
183- /// Naive conversion of a rust token stream into css content.
184- ///
185- /// Strips all whitespace from the given tokens, concatenates them into a
186- /// single string and returns a token stream of the given css content
187- /// wrapped in an HTML style tag.
188- #[ cfg( feature = "basic-css" ) ]
189- fn style_inner ( tokens : TokenStream2 ) -> TokenStream {
190- let span = tokens. span ( ) ;
191- let raw_css = tokens
192- . into_iter ( )
193- . map ( |token_tree| {
194- token_tree
195- . to_string ( )
196- . split_whitespace ( )
197- . collect :: < String > ( )
198- } )
199- . collect :: < String > ( ) ;
200-
201- quote_spanned ! { span=>
202- :: html_node:: Node :: Element (
203- :: html_node:: Element {
204- name: :: std:: convert:: Into :: <:: std:: string:: String >:: into( "style" ) ,
205- attributes: :: std:: vec:: Vec :: new( ) ,
206- children: :: std:: option:: Option :: Some (
207- :: std:: vec![
208- :: html_node:: Node :: UnsafeText ( #raw_css. into( ) )
209- ]
210- )
211- }
212- )
213- }
214- . into ( )
215- }
0 commit comments