Skip to content

Commit

Permalink
Merge pull request #15 from j3lamp/external-url
Browse files Browse the repository at this point in the history
Add support for external fallback URL
  • Loading branch information
technosophos committed Dec 31, 2015
2 parents 7b71f0b + 32cf013 commit 1f30238
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The basic Dashing format looks like this:
"name": "Dashing",
"index":"index.html",
"icon32x32": "icon.png",
"externalURL": "https://github.com/technosophos/dashing",
"selectors": {
"dt a": "Command",
"title": "Package"
Expand All @@ -67,6 +68,7 @@ The basic Dashing format looks like this:
- name: Name of the package
- index: Default index file in the existing docs
- icon32x32: a 32x32 pixel PNG icon
- externalURL: the base URL of the docs
- selectors: a map of selectors. There is a simple format and
a more advanced format (see below for details).
- ignore: a list of matches to be ignored (see below)
Expand Down
15 changes: 10 additions & 5 deletions dashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const plist = `<?xml version="1.0" encoding="UTF-8"?>
<string>dashtoc</string>
<key>dashIndexFilePath</key>
<string>{{.Index}}</string>
<key>isJavaScriptEnabled</key><{{.AllowJS}}/>
<key>isJavaScriptEnabled</key><{{.AllowJS}}/>{{if .ExternalURL}}
<key>DashDocSetFallbackURL</key>
<string>{{.ExternalURL}}</string>{{end}}
</dict>
</plist>
`
Expand All @@ -63,6 +65,8 @@ type Dashing struct {
// A 32x32 pixel PNG image.
Icon32x32 string `json:"icon32x32"`
AllowJS bool `json:"allowJS"`
// External URL for "Open Online Page"
ExternalURL string `json: "externalURL"`
}

// Transform is a description of what should be done with a selector.
Expand Down Expand Up @@ -269,10 +273,11 @@ func addPlist(name string, config *Dashing) {
}

tvars := map[string]string{
"Name": name,
"FancyName": fancyName,
"Index": config.Index,
"AllowJS": aj,
"Name": name,
"FancyName": fancyName,
"Index": config.Index,
"AllowJS": aj,
"ExternalURL": config.ExternalURL,
}

err := t.Execute(&file, tvars)
Expand Down
1 change: 1 addition & 0 deletions examples/busybox/dashing.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"package":"busybox",
"index":"BusyBox.html",
"icon32x32":"busybox1.png",
"externalURL":"https://busybox.net/downloads/",
"selectors": {
"dt a": "Command",
"title": {
Expand Down

0 comments on commit 1f30238

Please sign in to comment.