Merge pull request #11501 from thockin/fix-preformatted-regex

Fix preformatted regex
This commit is contained in:
Brian Grant 2015-07-18 16:26:45 -07:00
commit 83bd13425c
6 changed files with 14 additions and 20 deletions

View File

@ -21,7 +21,7 @@ manifests on the master server. But still, users are discouraged to do it
on their own - they should rather wait for a new release of on their own - they should rather wait for a new release of
Kubernetes that will also contain new versions of add-ons. Kubernetes that will also contain new versions of add-ons.
Each add-on must specify the following label: ````kubernetes.io/cluster-service: true````. Each add-on must specify the following label: ```kubernetes.io/cluster-service: true```.
Yaml files that do not define this label will be ignored. Yaml files that do not define this label will be ignored.
The naming convention for Replication Controllers is The naming convention for Replication Controllers is

View File

@ -16,9 +16,7 @@ limitations under the License.
package main package main
import ( import "bytes"
"bytes"
)
// Blocks of ``` need to have blank lines on both sides or they don't look // Blocks of ``` need to have blank lines on both sides or they don't look
// right in HTML. // right in HTML.

View File

@ -23,13 +23,6 @@ import (
"strings" "strings"
) )
var (
// Finds all preformatted block start/stops.
preformatRE = regexp.MustCompile("^[\\s]*```.*")
notPreformatRE = regexp.MustCompile("^[\\s]*```.*```.*")
preformatEndRE = regexp.MustCompile(".*```.*")
)
// Splits a document up into a slice of lines. // Splits a document up into a slice of lines.
func splitLines(document []byte) []string { func splitLines(document []byte) []string {
lines := strings.Split(string(document), "\n") lines := strings.Split(string(document), "\n")
@ -141,6 +134,12 @@ type fileBlock struct {
type fileBlocks []fileBlock type fileBlocks []fileBlock
var (
// Finds all preformatted block start/stops.
preformatRE = regexp.MustCompile("^\\s*```")
notPreformatRE = regexp.MustCompile("^\\s*```.*```")
)
func splitByPreformatted(input []byte) fileBlocks { func splitByPreformatted(input []byte) fileBlocks {
f := fileBlocks{} f := fileBlocks{}
@ -161,7 +160,7 @@ func splitByPreformatted(input []byte) fileBlocks {
cur = append(cur, line...) cur = append(cur, line...)
} else { } else {
cur = append(cur, line...) cur = append(cur, line...)
if preformatEndRE.Match(line) { if preformatRE.Match(line) {
if len(cur) > 0 { if len(cur) > 0 {
f = append(f, fileBlock{true, cur}) f = append(f, fileBlock{true, cur})
} }

View File

@ -90,7 +90,7 @@ $ export KUBE_RKT_VERSION=0.5.6
Then you can launch the cluster by: Then you can launch the cluster by:
````shell ```shell
$ kube-up.sh $ kube-up.sh
``` ```
@ -120,7 +120,7 @@ $ export COREOS_CHANNEL=stable
Then you can launch the cluster by: Then you can launch the cluster by:
````shell ```shell
$ kube-up.sh $ kube-up.sh
``` ```

View File

@ -52,7 +52,7 @@ You should now be able to query your web server:
```shell ```shell
$ curl <Pod IP address> $ curl <Pod IP address>
$ Hello World $ Hello World
```` ```
<!-- BEGIN MUNGE: GENERATED_ANALYTICS --> <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->

View File

@ -236,14 +236,13 @@ Members [2] {
} }
2015-07-10 13:26:47.722 INFO 5 --- [ main] com.hazelcast.core.LifecycleService : [10.244.77.3]:5701 [someGroup] [3.5] Address[10.244.77.3]:5701 is STARTED 2015-07-10 13:26:47.722 INFO 5 --- [ main] com.hazelcast.core.LifecycleService : [10.244.77.3]:5701 [someGroup] [3.5] Address[10.244.77.3]:5701 is STARTED
2015-07-10 13:26:47.723 INFO 5 --- [ main] com.github.pires.hazelcast.Application : Started Application in 13.792 seconds (JVM running for 14.542)``` 2015-07-10 13:26:47.723 INFO 5 --- [ main] com.github.pires.hazelcast.Application : Started Application in 13.792 seconds (JVM running for 14.542)
```
Now let's scale our cluster to 4 nodes: Now let's scale our cluster to 4 nodes:
```sh ```sh
$ kubectl scale rc hazelcast --replicas=4 $ kubectl scale rc hazelcast --replicas=4
``` ```
Examine the status again by checking the logs and you should see the 4 members connected. Examine the status again by checking the logs and you should see the 4 members connected.
@ -253,7 +252,6 @@ Examine the status again by checking the logs and you should see the 4 members c
For those of you who are impatient, here is the summary of the commands we ran in this tutorial. For those of you who are impatient, here is the summary of the commands we ran in this tutorial.
```sh ```sh
# create a service to track all hazelcast nodes # create a service to track all hazelcast nodes
kubectl create -f examples/hazelcast/hazelcast-service.yaml kubectl create -f examples/hazelcast/hazelcast-service.yaml
@ -265,7 +263,6 @@ kubectl scale rc hazelcast --replicas=2
# scale up to 4 nodes # scale up to 4 nodes
kubectl scale rc hazelcast --replicas=4 kubectl scale rc hazelcast --replicas=4
``` ```
### Hazelcast Discovery Source ### Hazelcast Discovery Source