Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
02213402
Commit
02213402
authored
Nov 09, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unexport internal types; improved markdown summaries
parent
e1f23a1e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
caddy/caddy.go
caddy/caddy.go
+1
-1
caddy/config.go
caddy/config.go
+7
-7
middleware/markdown/page.go
middleware/markdown/page.go
+4
-2
No files found.
caddy/caddy.go
View file @
02213402
...
@@ -175,7 +175,7 @@ func Start(cdyfile Input) error {
...
@@ -175,7 +175,7 @@ func Start(cdyfile Input) error {
// taking into account whether or not this process is
// taking into account whether or not this process is
// a child from a graceful restart or not. It blocks
// a child from a graceful restart or not. It blocks
// until the servers are listening.
// until the servers are listening.
func
startServers
(
groupings
Group
)
error
{
func
startServers
(
groupings
binding
Group
)
error
{
var
startupWg
sync
.
WaitGroup
var
startupWg
sync
.
WaitGroup
errChan
:=
make
(
chan
error
)
errChan
:=
make
(
chan
error
)
...
...
caddy/config.go
View file @
02213402
...
@@ -213,8 +213,8 @@ func makeStorages() map[string]interface{} {
...
@@ -213,8 +213,8 @@ func makeStorages() map[string]interface{} {
// bind address to list of configs that would become VirtualHosts on that
// bind address to list of configs that would become VirtualHosts on that
// server. Use the keys of the returned map to create listeners, and use
// server. Use the keys of the returned map to create listeners, and use
// the associated values to set up the virtualhosts.
// the associated values to set up the virtualhosts.
func
arrangeBindings
(
allConfigs
[]
server
.
Config
)
(
Group
,
error
)
{
func
arrangeBindings
(
allConfigs
[]
server
.
Config
)
(
binding
Group
,
error
)
{
var
groupings
Group
var
groupings
binding
Group
// Group configs by bind address
// Group configs by bind address
for
_
,
conf
:=
range
allConfigs
{
for
_
,
conf
:=
range
allConfigs
{
...
@@ -242,7 +242,7 @@ func arrangeBindings(allConfigs []server.Config) (Group, error) {
...
@@ -242,7 +242,7 @@ func arrangeBindings(allConfigs []server.Config) (Group, error) {
}
}
}
}
if
!
existing
{
if
!
existing
{
groupings
=
append
(
groupings
,
B
indingMapping
{
groupings
=
append
(
groupings
,
b
indingMapping
{
BindAddr
:
bindAddr
,
BindAddr
:
bindAddr
,
Configs
:
[]
server
.
Config
{
conf
},
Configs
:
[]
server
.
Config
{
conf
},
})
})
...
@@ -362,15 +362,15 @@ var (
...
@@ -362,15 +362,15 @@ var (
Port
=
DefaultPort
Port
=
DefaultPort
)
)
//
B
indingMapping maps a network address to configurations
//
b
indingMapping maps a network address to configurations
// that will bind to it. The order of the configs is important.
// that will bind to it. The order of the configs is important.
type
B
indingMapping
struct
{
type
b
indingMapping
struct
{
BindAddr
*
net
.
TCPAddr
BindAddr
*
net
.
TCPAddr
Configs
[]
server
.
Config
Configs
[]
server
.
Config
}
}
// Group maps network addresses to their configurations.
//
binding
Group maps network addresses to their configurations.
// Preserving the order of the groupings is important
// Preserving the order of the groupings is important
// (related to graceful shutdown and restart)
// (related to graceful shutdown and restart)
// so this is a slice, not a literal map.
// so this is a slice, not a literal map.
type
Group
[]
B
indingMapping
type
bindingGroup
[]
b
indingMapping
middleware/markdown/page.go
View file @
02213402
...
@@ -118,15 +118,17 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) bool {
...
@@ -118,15 +118,17 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) bool {
}
}
reqPath
=
"/"
+
filepath
.
ToSlash
(
reqPath
)
reqPath
=
"/"
+
filepath
.
ToSlash
(
reqPath
)
// Make the summary
parser
:=
findParser
(
body
)
parser
:=
findParser
(
body
)
if
parser
==
nil
{
if
parser
==
nil
{
// no metadata, ignore.
// no metadata, ignore.
continue
continue
}
}
summary
,
err
:=
parser
.
Parse
(
body
)
summary
Raw
,
err
:=
parser
.
Parse
(
body
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
summary
:=
blackfriday
.
Markdown
(
summaryRaw
,
SummaryRenderer
{},
0
)
// truncate summary to maximum length
// truncate summary to maximum length
if
len
(
summary
)
>
summaryLen
{
if
len
(
summary
)
>
summaryLen
{
...
@@ -145,7 +147,7 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) bool {
...
@@ -145,7 +147,7 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) bool {
Title
:
metadata
.
Title
,
Title
:
metadata
.
Title
,
URL
:
reqPath
,
URL
:
reqPath
,
Date
:
metadata
.
Date
,
Date
:
metadata
.
Date
,
Summary
:
string
(
blackfriday
.
Markdown
(
summary
,
SummaryRenderer
{},
0
)
),
Summary
:
string
(
summary
),
})
})
break
// don't try other file extensions
break
// don't try other file extensions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment