mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-06-03 06:07:20 +02:00
Fixed typo and optimized structure
This commit is contained in:
parent
eec6cec0db
commit
bf0df928c7
@ -14,6 +14,12 @@ import (
|
||||
"github.com/yosssi/gohtml"
|
||||
)
|
||||
|
||||
type FileInfo struct {
|
||||
Filename string `json:"filename"`
|
||||
Title string `json:"title"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
func build() {
|
||||
rootDir := "./docs"
|
||||
outputFile := "./index.json"
|
||||
|
@ -19,7 +19,7 @@ func optimizeCss(htmlContent []byte) ([]byte, error) {
|
||||
|
||||
doc.Find("img").Each(func(i int, s *goquery.Selection) {
|
||||
//For each of the image element, replace the parent from p to div
|
||||
orginalParent, err := s.Parent().Html()
|
||||
originalParent, err := s.Parent().Html()
|
||||
if err != nil {
|
||||
fmt.Println("Error getting parent HTML:", err)
|
||||
return
|
||||
@ -33,10 +33,10 @@ func optimizeCss(htmlContent []byte) ([]byte, error) {
|
||||
encodedSrc := (&url.URL{Path: src}).String()
|
||||
|
||||
//Patch the bug in the parser that converts " />" to "/>"
|
||||
orginalParent = strings.ReplaceAll(orginalParent, "/>", " />")
|
||||
originalParent = strings.ReplaceAll(originalParent, "/>", " />")
|
||||
fmt.Println("<div class=\"ts-image is-rounded\"><img src=\"./" + encodedSrc + "\"></div>")
|
||||
//Replace the img with ts-image
|
||||
originalHTMLContent = strings.Replace(originalHTMLContent, orginalParent, "<div class=\"ts-image is-rounded\" style=\"max-width: 800px\">"+orginalParent+"</div>", 1)
|
||||
originalHTMLContent = strings.Replace(originalHTMLContent, originalParent, "<div class=\"ts-image is-rounded\" style=\"max-width: 800px\">"+originalParent+"</div>", 1)
|
||||
})
|
||||
|
||||
// Add "ts-text" class to each p element
|
||||
|
@ -12,7 +12,7 @@ Let start with a really simple Hello World plugin. This only function of this pl
|
||||
|
||||
First things first, give your plugin a name. In this example, we are using the name "helloworld".
|
||||
|
||||
**Plugin name cannot contain space or special characters**, so you must use a file name that satisfy the requirement. No worry, the plugin file name is not the same as the plugin display name in the introspect.
|
||||
**Plugin name cannot contain space or special characters**, so you must use a file name that satisfies the requirement. Dont worry, the plugin file name is not the same as the plugin display name in the introspect.
|
||||
|
||||
---
|
||||
|
||||
@ -56,7 +56,7 @@ ls
|
||||
|
||||
Locate the Zoraxy plugin library from the Zoraxy source code. You can find the `zoraxy_plugin` Go module under `src/mod/plugins/zoraxy_plugin`
|
||||
|
||||
Copy the `zoraxy_plugin` folder from the Zoraxy source code mod folder into the your plugin’s mod folder. Let assume you use the same mod folder name as Zoraxy as `mod`, then your copied library path should be `plugins/helloword/mod/zoraxy_plugin`
|
||||
Copy the `zoraxy_plugin` folder from the Zoraxy source code mod folder into the your plugin’s mod folder. Let assume you use the same mod folder name as Zoraxy as `mod`, then your copied library path should be `plugins/helloworld/mod/zoraxy_plugin`
|
||||
|
||||
```bash
|
||||
mkdir ./mod
|
||||
@ -170,7 +170,7 @@ func main(){
|
||||
|
||||
|
||||
|
||||
**Notes: If some post processing is needed between Introspect and Configure, you can use two seperate function to handle the first start and the second starting of your plugin. The "seperated version" of `ServeAndRecvSpec` is defined as ` ServeIntroSpect(pluginSpect *IntroSpect) ` and `RecvConfigureSpec() (*ConfigureSpec, error)`. See `zoraxy_plugin.go` for more information.**
|
||||
**Notes: If some post processing is needed between Introspect and Configure, you can use two seperate function to handle the first start and the second starting of your plugin. The "separated version" of `ServeAndRecvSpec` is defined as ` ServeIntroSpect(pluginSpect *IntroSpect) ` and `RecvConfigureSpec() (*ConfigureSpec, error)`. See `zoraxy_plugin.go` for more information.**
|
||||
|
||||
---
|
||||
|
||||
|
@ -182,7 +182,7 @@
|
||||
<span class="ts-text is-heavy">
|
||||
Plugin name cannot contain space or special characters
|
||||
</span>
|
||||
, so you must use a file name that satisfy the requirement. No worry, the plugin file name is not the same as the plugin display name in the introspect.
|
||||
, so you must use a file name that satisfies the requirement. Dont worry, the plugin file name is not the same as the plugin display name in the introspect.
|
||||
</p>
|
||||
</p>
|
||||
<div class="ts-divider has-top-spaced-large"></div>
|
||||
@ -260,7 +260,7 @@ ls
|
||||
</span>
|
||||
, then your copied library path should be
|
||||
<span class="ts-text is-code">
|
||||
plugins/helloword/mod/zoraxy_plugin
|
||||
plugins/helloworld/mod/zoraxy_plugin
|
||||
</span>
|
||||
</p>
|
||||
</p>
|
||||
@ -407,7 +407,7 @@ func main(){
|
||||
</code></pre>
|
||||
<p>
|
||||
<span class="ts-text is-heavy">
|
||||
Notes: If some post processing is needed between Introspect and Configure, you can use two seperate function to handle the first start and the second starting of your plugin. The “seperated version” of
|
||||
Notes: If some post processing is needed between Introspect and Configure, you can use two seperate function to handle the first start and the second starting of your plugin. The “separated version” of
|
||||
<span class="ts-text is-code">
|
||||
ServeAndRecvSpec
|
||||
</span>
|
||||
|
@ -10,12 +10,6 @@ import (
|
||||
"github.com/fsnotify/fsnotify"
|
||||
)
|
||||
|
||||
type FileInfo struct {
|
||||
Filename string `json:"filename"`
|
||||
Title string `json:"title"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
/* Change this before deploying */
|
||||
var (
|
||||
mode = flag.String("m", "web", "Mode to run the application: 'web' or 'build'")
|
||||
|
Loading…
x
Reference in New Issue
Block a user