Page 4 of 5

Re: Pascal Emmet

Posted: 08 Jan 2020 10:23
by Alextp
Users need to get Lorem text even w/o any HTML, for ex in Markdown files, how to do it? @lorem don't work- it gives 2 tags.

Re: Pascal Emmet

Posted: 18 Jan 2020 02:44
by inspector71
Just noticed this thread.

Wow, you published / open sourced some of your code Rickard! That's sensational. Cannot be over-rated. I know there's a lot of open source code out there but you have made a step from closed to open and that is no doubt a great benefit for others and I find that a very promising and much appreciated effort ... even though I do not at presently code in Delphi / Pascal :) !! Never the less it's so great that other Pascal devs can benefit from your classy work!

Great stuff :)

Re: Pascal Emmet

Posted: 29 Jan 2020 10:22
by Alextp
Please move
cMultiplicationMax = 1000;
into options record, as field, so user can change it to e.g. 1500 when need to generate very long result.

Re: Pascal Emmet

Posted: 29 Jan 2020 10:24
by Alextp

Code: Select all

    i := Pos('id=',s);
    
    i := Pos('class=',s);
I don't think it will work with uppercased tags, no?

Re: Pascal Emmet

Posted: 08 Feb 2020 18:20
by Rickard Johansson
Updated the Pascal Emmet files to version 1.13.

Added Markdown support (including lorem generated text @l or @l200).
Added a TEmmet property to set the multiplication limit. Default is still cMultiplicationMax = 1000.

Re: Pascal Emmet

Posted: 08 Feb 2020 18:22
by Rickard Johansson
i := Pos('id=',s);
i := Pos('class=',s);
Shouldn't be a problem. All tags in the snippets file are in lowercase. Abbreviations including .class should also be entered in lowercase.

Re: Pascal Emmet

Posted: 10 Feb 2020 23:23
by Alextp

Re: Pascal Emmet

Posted: 23 Mar 2020 18:06
by Alextp
I have problem with UNSUPPORTED tags. for ex, "bs4bp". my editor allows expanding of this snippet via its own plugin, and editor calls Emmet too. if "my plugin" is not installed, editor calls Emmet, Emmet gives something for "bs4bp" - 2 tags. not good. users don't need result when "my plugin for bs4bp" is absent.
can we NOT expand unknown tags in Emmet, plz? by option or always?

Re: Pascal Emmet

Posted: 27 Apr 2020 13:55
by Rickard Johansson
Updated Emmet code to version 1.14.

The following was fixed:
* Fixed ${1:tabstop} index issue
* Fixed a class issue with span tag

Re: Pascal Emmet

Posted: 30 Apr 2020 15:16
by Alextp
thanks. can we have option
cMultiplicationMax = 1000;
in the options "record", not as "const", please?

Edit. you already did it.

Re: Pascal Emmet

Posted: 30 Apr 2020 15:20
by Alextp
RJ, can you please see report at viewtopic.php?p=17013#p17013 ?

Re: Pascal Emmet

Posted: 30 Apr 2020 18:26
by Rickard Johansson
It's not that simple. Not all HTML tags are added as abbreviations in the snippets file and XML tags are impossible to add, since they can be anything.

HTML
You may want this to work: p.myclass => <p class="myclass"></p> . But p is not added as an abbreviation, so with an option to only expand known tags - this wont work.

XML
In XML you can type something like this: developer#rickard{@lorem} => <developer id="rickard"> ... </developer>. This, of course, wont work either.

Maybe you could use a dedicated shortcut to expand Emmet abbreviations. And something else for other tasks?

Re: Pascal Emmet

Posted: 01 May 2020 11:48
by Rickard Johansson
Updated to version 1.15.

Version 1.15
* Added option to replace cursor positions | with indexed tab positions ${x}

Re: Pascal Emmet

Posted: 06 May 2020 16:59
by Alextp
FPC 3.0.4 compile error
emmet.pas

function TEmmet.ExpandAbbreviation(AString: string; const ASyntax, ASelText:
string; out ASection: string; out bMultiCursorTabs: Boolean): string;
..
opt.AlwaysReturnIndexedTabs := False;

while record has another member

Code: Select all

  TExpandOptions = record
    AddSlashToEmptyTags: Boolean; // Add a slash to empty tags e.g. <img src="" />
    AlwaysAddNewLine: Boolean;    // Always add linefeed after each tag (usually used in XML)
    AlwaysReturnIndexedTabStops: Boolean; // Convert all cursor positions | to indexed tab positions ${x} (HMTL,XML)

Re: Pascal Emmet

Posted: 07 May 2020 07:54
by Rickard Johansson
I've updated the archive file and should now contain the correct version.