Warcraft 3 documentation

vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

[Snippet] .htmlFile

nel · 295

0 Members and 1 Guest are viewing this topic.

[Snippet] .htmlFile
on: March 19, 2019, 03:07:53 AM

.htmlFile v1.0.0.0

Code: jass
  1. //! zinc
  2. library htmlFile { /* v1.0.0.0
  3. *************************************************************************************
  4. *
  5. *   .htmlFile
  6. *      by nel (NELMVN)
  7. *
  8. *   A lightweight library that allows you to create, write, and design your own
  9. *   HTML file. It is more faster than .bat to .txt conversion and compatible in
  10. *   Internet Explorer, Google Chrome, Avast Secure Browser, Mozilla Firefox,
  11. *   etc.
  12. *
  13. ************************************************************************************
  14. *
  15. *    struct HTML extends array
  16. *
  17. *        static method new takes string directory, real fontSize returns nothing
  18. *            -   Create a new .html file.
  19. *
  20. *        static method print takes string str returns nothing
  21. *        static method println takes string str returns nothing
  22. *
  23. *        static method end takes nothing returns nothing
  24. *            -   Close the generated .html file.
  25. *
  26. ************************************************************************************
  27. *
  28. *    Issues:
  29. *
  30. *        - print() may handle up to 252 characters.
  31. *        - println() may handle up to 248 characters.
  32. *        - Use '<br>' instead of '\r\n' in print() and println().
  33. *
  34. ***********************************************************************************/
  35.  
  36.     public struct HTML[] {
  37.         private static string Directory;
  38.  
  39.         public {
  40.             static method new( string directory, real fontSize ) {
  41.                 PreloadGenClear();
  42.                 PreloadGenStart();
  43.              
  44.                 debug if( directory == null ) {
  45.                     debug BJDebugMsg("[HTML Error new()] directory is a null.");
  46.                 }
  47.  
  48.                 Preload(
  49.                     "<html><body class=\"x\">" +
  50.                     "<style>.x { font-size: 0; }" +
  51.                     ".y { font-size: " + R2S(fontSize) + "; }</style>" +
  52.                     "<div class=\"y\"><!--"
  53.                 );
  54.  
  55.                 thistype.Directory = directory;
  56.             }
  57.          
  58.             static method print( string str ) {
  59.                 Preload("-->" + str +"<!--");
  60.              
  61.                 debug if( StringLength(str) > 252 ) {
  62.                     debug BJDebugMsg("[HTML Error print()] str reached the limit.");
  63.                 }
  64.             }
  65.  
  66.             static method println( string str ) {
  67.                 Preload("-->" + str +"<br><!--");
  68.  
  69.                 debug if( StringLength(str) > 248 ) {
  70.                     debug BJDebugMsg("[HTML Error println()] str reached the limit.");
  71.                 }
  72.          
  73.             }
  74.             static method end() {
  75.                 Preload("--></div></body></html><!--" +
  76.                     "\r\n\r\n\r\nMade by github.com/NELMVN\r\n\r\n\r\n"
  77.                 );
  78.                 PreloadGenEnd(Directory + ".html");
  79.                 thistype.Directory = null;
  80.             }
  81.         }
  82.     }
  83. }
  84. //! endzinc



Usage
Code: jass
  1. scope Test initializer Initialization
  2.  
  3.     private function Initialization takes nothing returns nothing
  4.         call HTML.new("HTML\\Design\\Sample1", 13)
  5.         call HTML.print("<center><h1>Save Code</h1>")
  6.         call HTML.print("<br><br><br>")
  7.         call HTML.println("Character")
  8.         call HTML.println("-load ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ")
  9.         call HTML.println("<br>Achievements")
  10.         call HTML.println("-load XXXX-XXXX-TTTT-TTTT-QQQQ-WWWS-WW")
  11.         call HTML.print("</center>")
  12.         call HTML.end()
  13.     endfunction
  14.  
  15. endscope



Re: [Snippet] .htmlFile
Reply #1 on: March 20, 2019, 11:30:07 AM

removed by request.


 

Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)