File tree 3 files changed +22
-1
lines changed
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,19 @@ quiki -bind=1.2.3.4 -port=8090 # override host and port in config
25
25
26
26
#### Generate Pages to STDOUT
27
27
28
+ HTML Output
28
29
```
29
30
quiki /path/to/my_page.page # generate a standalone page, any .page or .md file
30
31
quiki -wiki=/path/to/wiki my_page # generate a page within a wiki
31
32
quiki -i # interactive mode - read from STDIN
32
33
```
33
34
35
+ JSON Output
36
+ ```
37
+ quiki -json /path/to/my_page.page # generate a standalone page, output JSON
38
+ quiki -json -wiki=/path/to/wiki my_page # generate a page within a wiki, output JSON
39
+ ```
40
+
34
41
#### Wiki Operations
35
42
36
43
```
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ func runPageAndExit(page *wikifier.Page) {
122
122
json .NewEncoder (os .Stdout ).Encode (page )
123
123
os .Exit (0 )
124
124
}
125
- fmt .Println (page .HTML ())
125
+ fmt .Println (page .HTMLAndCSS ())
126
126
os .Exit (0 )
127
127
}
128
128
@@ -135,6 +135,11 @@ func runWikiPageAndExit(w *wiki.Wiki, pagePath string) {
135
135
}
136
136
switch r := res .(type ) {
137
137
case wiki.DisplayPage :
138
+ if r .CSS != "" {
139
+ fmt .Println (`<style type="text/css">` )
140
+ fmt .Println (r .CSS )
141
+ fmt .Println (`</style>` )
142
+ }
138
143
fmt .Println (r .Content )
139
144
case wiki.DisplayError :
140
145
log .Fatal (r .Error )
Original file line number Diff line number Diff line change @@ -201,6 +201,15 @@ func (p *Page) HTML() HTML {
201
201
return p ._html
202
202
}
203
203
204
+ // HTMLAndCSS generates and returns the HTML code for the page, including CSS.
205
+ func (p * Page ) HTMLAndCSS () HTML {
206
+ css := p .CSS ()
207
+ if css != "" {
208
+ return HTML ("<style>\n " + css + "\n </style>\n " + string (p .HTML ()))
209
+ }
210
+ return p .HTML ()
211
+ }
212
+
204
213
// Text generates and returns the rendered plain text for the page.
205
214
// The page must be parsed with Parse before attempting this method.
206
215
func (p * Page ) Text () string {
You can’t perform that action at this time.
0 commit comments