Skip to content

Latest commit

 

History

History
161 lines (113 loc) · 2.42 KB

Press.md

File metadata and controls

161 lines (113 loc) · 2.42 KB

press cmd export html, css, js.

method

pressConfig (name: name, dist: dist )

press cmd setting.

name : string, export file name.
dist : string, export path.

press

export cmd.

pressTo(name: name, dist: dist)

pressTo cmd call pressConfig cmd and press cmd.

name : string, export file name.
dist : string, export path.

 def self.bodier
   body = BODY.new
   a = A.new.contentIs("test").attr(:href,"www://")
   body.addChild a
   body
 end
 
 html = HTML.new
 html.addChild bodier

 html.pressConfig(name: 'indexPressed.html', dist: myPATH)
 html.press

or 

 html.pressTo(name: 'indexPressed.html', dist: myPATH)

[result]

<html>
   <body>
     <a href="www://">test</a>
   </body>
</html>

pressInsert (*data)

if you use variable method,
pressInsert cmd exchange variable to string.
variable method see 'Variable' page.

data : string method, varIs use.
ex) "a".varIs "test"

 def self.bodier
   body = BODY.new    

   p1 = P.new.contentIs "a".variable
   p2 = P.new.contentIs "b".variable
   
   body.addChildren p1,p2
   
   body
 end
 
 html = HTML.new
 html.addChild bodier

 html.pressConfig(name: 'indexPressed.html', dist: myPATH)
 html.pressInsert "a".varIs("test done"), "b".varIs( "test done again")

[result]

<html>
   <body>
  	<p>test done</p>
     <p>test done again</p>
   </body>
</html>

simple example

=> press

press command(cmd) export html ( css, js ) generated by ruby.

  • pressConfig (name: name, dist: path)

    • name: file name
    • dist: path of file
  • press

    • press command need pressConfig

pressTo cmd is more simple.

  • pressTo (name: name, dist: dist)
    • name: file name
    • dist: path of file
   doc.pressTo(name: n, dist: ~/path)


Then, Hello world

Tag make by new cmd (e.g. HTML tag).

 HTML.new

Say 'Hello world'
html= HTML.new
head = HEAD.new

title = TITLE.new
title.content = "This is my first page"
head.addChild title

body = BODY.new
c = P.new.contentIs "Hello world!"
body.addChild c

html.addChild head
html.addChild body

doc = DOCTYPE.new
doc.addMember html

doc.pressTo(name: 'indexPressed.html', dist: myPATH)

[result]

 <!DOCTYPE html>
 <html>
 	<head>
 		<title>This is my first page</title>
 	</head>
 	<body>
 		<p>Hello world!</p>
 	</body>
 </html>