Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Wanted: clip for Definition lists

Expand Messages
  • Don - htmlfixit.com
    Corrected version with DT and DD in the correct order ... ;*** Effort by Don Passenger ;*** don@htmlfixit.com ;*** discuss things live in chat at
    Message 1 of 11 , Dec 23, 2005
    • 0 Attachment
      Corrected version with DT and DD in the correct order ...

      ;*** Effort by Don Passenger
      ;*** don@...
      ;*** discuss things live in chat at http://htmlfixit.com
      ;*** donations welcome at http://htmlfixit.com
      ;*** Create a Definition List (DL) in HTML file
      ;*** based on the ordered/unordered clip shipped w/ Notetab
      ;*** posted here: http://htmlfixit.com/news/index.php?p=837

      ;START
      ; Clear variables
      ^!ClearVariables
      ^!If ^$GetSelSize$ > 0 FormatSelection

      ;line 14
      :CreateBlank
      ^!Set %CountDT%=^?{How many Definition Terms (DT):?=_1|2|3|4|5|6|7|8|9}
      ^!Set %CountDD%=^?{How many Definition Descriptions (DD) per
      (DT)?=1|2|_3|4|5|6|7|8|9}
      ^!Set %Count%="0"
      :CreateEmptyDL
      ^!InsertHtml <dl>^P
      :CreateEmptyDT
      ^!InsertHtml ^$StrFill(" <dt></dt>^P";1)$
      ^!Inc %Count%
      :CreateEmptyDD
      ^!InsertHtml ^$StrFill(" <dd></dd>^P";^%CountDD%)$
      ^!If ^%Count% < ^%CountDT% CreateEmptyDT
      ^!InsertHtml </dl>^P
      ^!Goto End


      ;line 31
      :FormatSelection
      ;Divide selection at paragraph marks to make list
      ^!SetListDelimiter ^p
      ^!SetArray %delimited_data%=^$GetSelection$

      ;figure out if it is just every other one?
      ^!Set %pattern%=^$StrUpper("^?{Is There a Set Pattern?=_Every Other|Set
      Ratio|NO]")}
      ^!If "^%pattern%" = "NO" BuildCustom
      ^!If "^%pattern%" = "SET RATIO" SetRatio
      ;set to one for every other
      ^!Set %dd%="1"
      ^!Goto BuildRatio

      :SetRatio
      ^!Set %dd%=^?{How many (DD) Per (DT):?=_1|2|3|4|5|6|7|8|9}
      ^!Goto BuildRatio


      ;line 50
      :BuildRatio
      ;should I test if the ratio works?
      ;maybe modulus on number if items

      ^!Set %Count%="1"
      :CreateRatioDL
      ^!InsertHtml <dl>^P
      :CreateRatioDT
      ^!InsertHtml <dt>^%delimited_data^%Count%%</dt>^P
      ^!Inc %Count%
      ^!Set %CountDD%=^%dd%

      :CreateRatioDD
      ^!InsertHtml <dd>^%delimited_data^%Count%%</dd>^P
      ^!Dec %CountDD%
      ^!Inc %Count%
      ^!If ^%CountDD% = 0 TestDT ELSE CreateRatioDD

      :TestDT
      ^!If ^%Count% < ^%delimited_data0% CreateRatioDT

      ^!InsertHtml </dl>^P
      ;end of Build Ratio
      ^!Goto End



      ;line 78
      :BuildCustom
      ^!Set %Count%="1"
      :CreateCustomDL
      ^!InsertHtml <dl>^P
      :CreateCustomSwitch
      ^!Set %ThisItem%=^?{Is ^%delimited_data^%Count%% a(DT) or (DD):?=T|_D}
      ^!If "^%ThisItem%" = "D" CreateCustomDD ELSE CreateCustomDT


      :CreateCustomDT
      ^!InsertHtml <dt>^%delimited_data^%Count%%</dt>^P
      ^!Goto TestCustomDT

      :CreateCustomDD
      ^!InsertHtml <dd>^%delimited_data^%Count%%</dd>^P
      ^!Goto TestCustomDT

      :TestCustomDT
      ^!Inc %Count%
      ^!If ^%Count% > ^%delimited_data0% CreateCustomDone
      ^!Goto CreateCustomSwitch


      ;line 102
      :CreateCustomDone
      ^!InsertHtml </dl>^P
      ^!Goto Done


      :Done
      ;if done say so
      ^!Info Done
      ;========= End =========
      ;line 112



      And the hrs version:

      begin 600
      M.RHJ*B!%9F9O<G0@8GD@1&]N(%!A<W-E;F=E<@T*.RHJ*B!D;VY`:'1M;&9I
      M>&ET+F-O;0T*.RHJ*B!D:7-C=7-S('1H:6YG<R!L:79E(&EN(&-H870@870@
      M:'1T<#HO+VAT;6QF:7AI="YC;VT-"CLJ*BH@9&]N871I;VYS('=E;&-O;64@
      M870@:'1T<#HO+VAT;6QF:7AI="YC;VT-"CLJ*BH@0W)E871E(&$@1&5F:6YI
      M=&EO;B!,:7-T("A$3"D@:6X@2%1-3"!F:6QE#0H[*BHJ(&)A<V5D(&]N('1H
      M92!O<F1E<F5D+W5N;W)D97)E9"!C;&EP('-H:7!P960@=R\@3F]T971A8@T*
      M.RHJ*B!P;W-T960@:&5R93H@:'1T<#HO+VAT;6QF:7AI="YC;VTO;F5W<R]I
      M;F1E>"YP:'`_<#TX,S<-"@T*.U-405)4#0H[($-L96%R('9A<FEA8FQE<PT*
      M7J0A0VQE87)687)I86)L97,-"EZD(4EF(%ZD)$=E=%-E;%-I>F4D(#X@,"!&
      M;W)M871396QE8W1I;VX-"@T*.VQI;F4@,30-"CI#<F5A=&5";&%N:PT*7J0A
      M4V5T("5#;W5N=$14)3U>I#][2&]W(&UA;GD@1&5F:6YI=&EO;B!497)M<R`H
      M1%0I.C\]7S%\,GPS?#1\-7PV?#=\.'PY?0T*7J0A4V5T("5#;W5N=$1$)3U>
      MI#][2&]W(&UA;GD@1&5F:6YI=&EO;B!$97-C<FEP=&EO;G,@*$1$*2!P97(@
      M*$14*3\],7PR?%\S?#1\-7PV?#=\.'PY?0T*7J0A4V5T("5#;W5N="4](C`B
      M#0HZ0W)E871E16UP='E$3`T*7J0A26YS97)T2'1M;"`\9&P^7J10#0HZ0W)E
      M871E16UP='E$5`T*7J0A26YS97)T2'1M;"!>I"13=')&:6QL*"(@(#QD=#X\
      M+V1T/EZD4"([,2DD#0I>I"%);F,@)4-O=6YT)0T*.D-R96%T945M<'1Y1$0-
      M"EZD(4EN<V5R=$AT;6P@7J0D4W1R1FEL;"@B("`@(#QD9#X\+V1D/EZD4"([
      M7J0E0V]U;G1$1"4I)`T*7J0A268@7J0E0V]U;G0E(#P@7J0E0V]U;G1$5"4@
      M0W)E871E16UP='E$5`T*7J0A26YS97)T2'1M;"`\+V1L/EZD4`T*7J0A1V]T
      M;R!%;F0-"@T*#0H[;&EN92`S,0T*.D9O<FUA=%-E;&5C=&EO;@T*.T1I=FED
      M92!S96QE8W1I;VX@870@<&%R86=R87!H(&UA<FMS('1O(&UA:V4@;&ES=`T*
      M7J0A4V5T3&ES=$1E;&EM:71E<B!>I'`-"EZD(5-E=$%R<F%Y("5D96QI;6ET
      M961?9&%T824]7J0D1V5T4V5L96-T:6]N)`T*#0H[9FEG=7)E(&]U="!I9B!I
      M="!I<R!J=7-T(&5V97)Y(&]T:&5R(&]N93\-"EZD(5-E="`E<&%T=&5R;B4]
      M7J0D4W1R57!P97(H(EZD/WM)<R!4:&5R92!A(%-E="!0871T97)N/SU?179E
      M<GD@3W1H97)\4V5T(%)A=&EO?$Y/72(I?0T*7J0A268@(EZD)7!A='1E<FXE
      M(B`](").3R(@0G5I;&1#=7-T;VT-"EZD(4EF(")>I"5P871T97)N)2(@/2`B
      M4T54(%)!5$E/(B!39712871I;PT*.W-E="!T;R!O;F4@9F]R(&5V97)Y(&]T
      M:&5R#0I>I"%3970@)61D)3TB,2(-"EZD(4=O=&\@0G5I;&12871I;PT*#0HZ
      M4V5T4F%T:6\-"EZD(5-E="`E9&0E/5ZD/WM(;W<@;6%N>2`H1$0I(%!E<B`H
      M1%0I.C\]7S%\,GPS?#1\-7PV?#=\.'PY?0T*7J0A1V]T;R!"=6EL9%)A=&EO
      M#0H-"@T*.VQI;F4@-3`-"CI"=6EL9%)A=&EO#0H[<VAO=6QD($D@=&5S="!I
      M9B!T:&4@<F%T:6\@=V]R:W,_#0H[;6%Y8F4@;6]D=6QU<R!O;B!N=6UB97(@
      M:68@:71E;7,-"@T*7J0A4V5T("5#;W5N="4](C$B#0HZ0W)E871E4F%T:6]$
      M3`T*7J0A26YS97)T2'1M;"`\9&P^7J10#0HZ0W)E871E4F%T:6]$5`T*7J0A
      M26YS97)T2'1M;"`@("`\9'0^7J0E9&5L:6UI=&5D7V1A=&%>I"5#;W5N="4E
      M/"]D=#Y>I%`-"EZD(4EN8R`E0V]U;G0E#0I>I"%3970@)4-O=6YT1$0E/5ZD
      M)61D)0T*#0HZ0W)E871E4F%T:6]$1`T*7J0A26YS97)T2'1M;"`@("`@/&1D
      M/EZD)61E;&EM:71E9%]D871A7J0E0V]U;G0E)3PO9&0^7J10#0I>I"%$96,@
      M)4-O=6YT1$0E#0I>I"%);F,@)4-O=6YT)0T*7J0A268@7J0E0V]U;G1$1"4@
      M/2`P(%1E<W1$5"!%3%-%($-R96%T95)A=&EO1$0-"@T*.E1E<W1$5`T*7J0A
      M268@7J0E0V]U;G0E(#P@7J0E9&5L:6UI=&5D7V1A=&$P)2!#<F5A=&52871I
      M;T14#0H-"EZD(4EN<V5R=$AT;6P@/"]D;#Y>I%`-"CME;F0@;V8@0G5I;&0@
      M4F%T:6\-"EZD(4=O=&\@16YD#0H-"@T*#0H[;&EN92`W.`T*.D)U:6QD0W5S
      M=&]M#0I>I"%3970@)4-O=6YT)3TB,2(-"CI#<F5A=&5#=7-T;VU$3`T*7J0A
      M26YS97)T2'1M;"`\9&P^7J10#0HZ0W)E871E0W5S=&]M4W=I=&-H#0I>I"%3
      M970@)51H:7-)=&5M)3U>I#][27,@7J0E9&5L:6UI=&5D7V1A=&%>I"5#;W5N
      M="4E(&$H1%0I(&]R("A$1"DZ/SU4?%]$?0T*7J0A268@(EZD)51H:7-)=&5M
      M)2(@/2`B1"(@0W)E871E0W5S=&]M1$0@14Q312!#<F5A=&5#=7-T;VU$5`T*
      M#0H-"CI#<F5A=&5#=7-T;VU$5`T*7J0A26YS97)T2'1M;"`@("`\9'0^7J0E
      M9&5L:6UI=&5D7V1A=&%>I"5#;W5N="4E/"]D=#Y>I%`-"EZD(4=O=&\@5&5S
      M=$-U<W1O;414#0H-"CI#<F5A=&5#=7-T;VU$1`T*7J0A26YS97)T2'1M;"`@
      M("`@/&1D/EZD)61E;&EM:71E9%]D871A7J0E0V]U;G0E)3PO9&0^7J10#0I>
      MI"%';W1O(%1E<W1#=7-T;VU$5`T*#0HZ5&5S=$-U<W1O;414#0I>I"%);F,@
      M)4-O=6YT)0T*7J0A268@7J0E0V]U;G0E(#X@7J0E9&5L:6UI=&5D7V1A=&$P
      M)2!#<F5A=&5#=7-T;VU$;VYE#0I>I"%';W1O($-R96%T94-U<W1O;5-W:71C
      M:`T*#0H-"CML:6YE(#$P,@T*.D-R96%T94-U<W1O;41O;F4-"EZD(4EN<V5R
      M=$AT;6P@/"]D;#Y>I%`-"EZD(4=O=&\@1&]N90T*#0H-"CI$;VYE#0H[:68@
      M9&]N92!S87D@<V\-"EZD(4EN9F\@1&]N90T*.ST]/3T]/3T]/2!%;F0@/3T]
      1/3T]/3T]#0H[;&EN92`Q,3(
      `
      end
    Your message has been successfully submitted and would be delivered to recipients shortly.