Hi. This is my proposal for new aiki markup syntax
------------------------------------------------------------- :: VARIABLES ------------------------------------------------------------- All variables should look the same: ($(name)$) ($(author->uri)$) Variable can also be simplify by replacing ((name_from_sql)) with by ($(_name_from_select_)$) and default variables should be replaceable by these from SQL so if I have SELECT title from some_table ($(title)$) - this sould be from a query but for this SELECT username from aiki_users ($(title)$) - this is default one ------------------------------------------------------------- :: FOR LOOPS ------------------------------------------------------------- <ul> (for( ($(array)$) as item ( <li>((item))</li>) )for) </ul> ------------------------------------------------------------- :: IF STAGMENTS ------------------------------------------------------------- (if( _condition_ ( html) )if) example: (if( (!(1)!) == 'info' ( <p>this is information page</p> ) )if) (if( _condition_ ( _html_) (elif( _anther_condition_) ( _html_) (else( _html_) )if) ------------------------------------------------------------- :: SQL ------------------------------------------------------------- (sql( SQL_QUERY( html) )sql) ------------------------------------------------------------- :: PHP ------------------------------------------------------------- remove <php and change it to this (php( php code )php) if inside php are defining variables they should be accessable from html, inside php all variables from Select Query should be replaced with php variables, there should be One to One relationship: ((name)) === (php( $name )php) so if I have SQL "Select username from aiki_users" I can do this: (php( if (strlen($username) != 0) { )php) <p>User: ((username))</p> (php( } ) php) equivalent php code: <?php if (strlen($username) != 0) { ?> <p>User: <?= $username ?></p> <?php } ?> of course this example can be replaced with aiki (if( )if) So I will have pure php inside (php( ... )php) There can be comments (comment( ... )comment) or (~( ... )~) But they can be handled by php (php( /* this is comment */ )php) ------------------------------------------------------------- :: WIDGETS ------------------------------------------------------------- (widget( widget specific stuff ( html use return data from widget )widget) instead of using id for a widget it should use name (widget( show-users( additional html )widget) ------------------------------------------------------------- :: WIDGETS PARAMETERS ------------------------------------------------------------- there also should be parameters for a widget they could be accesable from Select Query proposal syntax (*(_number_)*) like part of URI syntax and AIKI markup inside "Select Query" SELECT * from aiki_users where username = "(php( tolowercase((!(1)!)); )php)" if I call this widget with /foo/BAR it will run query SELECT * from aiki_users where username = "bar" usage of parameters SLECT * from files where id = (select id from user where name = "(*(1)*)" (*(0)*) - this should be a name of the widget another proposition like in C programs 0 arguments point to the file name of the program so this (!(0)!) should point to full URI instead of first part of it. calling widget with parameters (widget( get_all_users("foobar") )widget) this will decrease usage of inherit with SQL, it can be remove but it should stay for backward compatibility. instead of (widget( it could be hash and inherit may stay (#(inherit:97("foobar")#) ------------------------------------------------------------- :: FORMS ------------------------------------------------------------- (form( add:_form_number_ )form) (form( add:_form_number_:ajax )form) (form( :edit:_form_number_:_record_number_ )form) forms should be accessable through name: (form( add:myform:ajax )form) ------------------------------------------------------------- :: OTHER TAGS ------------------------------------------------------------- (inline( [root]/weather.php?city=(!(1)!) )inline) (permissions(Permissions group( html output) )permissions) (hits( ocal_files|id=((id))|file_num_download )hits) ------------------------------------------------------------- :: PROCEDURES / FUNCTIONS ------------------------------------------------------------- Proposition for another element for aiki procedures should look like widgets but returning a value they could be created in the same way as widgets and be accesable with syntax (call( stored_procure(arg1, arg2,...) )call) form for creating a procedure could have: name and content which will be php code with return statement. so if I have procedure that return an array, I can call it from for loop <ul> (for( (call( get_all_users )call) as user)( <!-- example of array variables --> <li>($(user[0])$)</li>) )for) </ul> procedures should be able to return objects or array of objects (for( (call( get_all_users(4) )call) as user)( <li>($(user->name)$) - ($(user->uploads)$) uploads</li>) )for) </ul> in this case get_all_users(4) return array of objects for usergroup == 4 another example: <p>List of all baned users: <ul> (for( (call( get_all_users(101) )call) as user)( <li>($(user->name)$)</li>) )for) </ul> If We'll have procures then hits can be replaced by procedure the same as permissions (but I don't know what it do). (call( hits("ocal_files", ((id)), file_num_download) )call) This minimize elements in the syntax. ------------------------------------------------------------- :: META PROCEDURE ------------------------------------------------------------- alternative to call for procedures is to use procedures that extend the markup itself, So the only think that is needed to implement this is when parser read (sql( .... )sql) it get "sql" procedure from database and call it, all syntax can be implemented using these procedures. the name of the procedures must be limited to don't allow to override variables, URI parts, and parameters. almost all syntax could be implemented with this kind of procedures and the other thing is that Aiki can be extended in Aiki itself, this should really simplify the code itself, by moving lots of code to higher level. there can be one or two kind of procedure (normal and markup syntax) or one meta. EXCEPTIONS: Special names will be hash, dolar, tylda and asterisk which shouldn't be overdriveable by syntax procedures, because it may break the system. For example, if someone create a procedure `$', then this will break all widgets and applications that use variables, and the only thing to fix this will be to remove it from database directly. ------------------------------------------------------------- :: CONCLUSION ------------------------------------------------------------- every aiki markup element should have syntax (name( )name) with no exceptions. The old syntax may stay for backward compatibility but it could be removed eventually in the next major version (the same as it was with Python 3). -- Jakub Jankiewicz _______________________________________________ Mailing list: https://launchpad.net/~aikiframework-devel Post to : aikiframework-devel@lists.launchpad.net Unsubscribe : https://launchpad.net/~aikiframework-devel More help : https://help.launchpad.net/ListHelp