You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/11/08 11:17:59 UTC
[1/4] brooklyn-docs git commit: improve how we remove prompt chars
when copy-pasting bash
Repository: brooklyn-docs
Updated Branches:
refs/heads/master fe7d68ef1 -> 1bc3721da
improve how we remove prompt chars when copy-pasting bash
now applies to cmd-c as well as flash, and feedback is clearer too (for both)
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/f25797de
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/f25797de
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/f25797de
Branch: refs/heads/master
Commit: f25797de3a87514bf373679a6714fa7542518783
Parents: fe7d68e
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Nov 7 15:28:18 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Nov 7 15:28:18 2016 +0000
----------------------------------------------------------------------
_layouts/base.html | 70 ++++++++++++++++++++++++++++++----------
style/css/_code_blocks.scss | 10 ++++++
2 files changed, 63 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/f25797de/_layouts/base.html
----------------------------------------------------------------------
diff --git a/_layouts/base.html b/_layouts/base.html
index 0cc6de9..53d20f8 100644
--- a/_layouts/base.html
+++ b/_layouts/base.html
@@ -23,10 +23,8 @@ under the License.
{{ content }}
-
-<script src="{{ site.path.style }}/js/zeroclipboard/ZeroClipboard.min.js"></script>
-
<script language="JavaScript" type="application/javascript">
+
fix_padding_function = function () {
$('body').css('padding-top', parseInt($('#header').css("height"))+10);
$('body').css('padding-bottom', parseInt($('#footer').css("height"))+10);
@@ -65,32 +63,70 @@ $(function () {
}
});
-<!-- Clipboard support -->
- ZeroClipboard.config({ moviePath: '{{ site.path.style }}/js/zeroclipboard/ZeroClipboard.swf' });
+<!-- Copying and clipboard support -->
+
+// first make the $% line starts not selectable
+
+$(function() {
+ $('div.highlight').attr('oncopy', 'handleHideCopy(this)');
+ $('div.highlight').each(function(index,target) {
+ if ($(target).find('code.bash')) {
+ // Mark bash prompts from the start of each line (i.e. '$' or '%' characters
+ // at the very start, or immediately following any newline) as not-selectable.
+ // Handle continuation lines where a leading '$' or '%' is *not* a prompt character.
+ // (If example wants to exclude output, it can manually use class="nocopy".)
+ target.innerHTML = target.innerHTML.replace(/(^\s*|[^\\]\n)(<.*>)?([$%]|>) /g, '$1$2<span class="nocopy bash_prompt">$3 </span>');
+ }
+ });
+});
+
+// normal cmd-C (non-icon) copying
+
+function handleHideCopy(el) {
+// var origHtml = $(el).clone();
+ console.log("handling copy", el);
+ $(el).addClass('copying');
+ $(el).find('.nocopy').hide();
+ $(el).find('.clipboard_button').addClass('manual-clipboard-is-active');
+ setTimeout(function(){
+ $(el).removeClass('copying');
+ $(el).find('.clipboard_button').removeClass('manual-clipboard-is-active');
+ $(el).find('.nocopy').show();
+// $(el).html(origHtml);
+ }, 600);
+}
+
+// and icon (flash) copying
+
+</script>
+
+<script src="{{ site.path.style }}/js/zeroclipboard/ZeroClipboard.min.js"></script>
+
+<script language="JavaScript" type="application/javascript">
+
+ZeroClipboard.config({ moviePath: '{{ site.path.style }}/js/zeroclipboard/ZeroClipboard.swf' });
$(function() {
$('div.highlight').prepend(
- $('<div class="clipboard_container" title="Copy to Clipboard">'+
- '<div class="fa clipboard_button">'+
- '<div class="on-active"><div>Copied to Clipboard</div></div>'+
- '</div></div>'));
+ $('<div class="clipboard_container" title="Copy to Clipboard">'+
+ '<div class="fa clipboard_button">'+
+ '<div class="on-active"><div>Copied to Clipboard</div></div>'+
+ '</div></div>'));
$('div.clipboard_container').each(function(index) {
var clipboard = new ZeroClipboard();
clipboard.clip( $(this).find(":first")[0], $(this)[0] );
- var target = $(this).next();
- var txt = target.text().trim();
- if (target.find('code.bash')) {
- // Strip out bash prompts from the start of each line (i.e. '$' or '%' characters
- // at the very start, or immediately following any newline). Correctly handles continuation
- // lines, where a leading '$' or '%' is *not* a prompt character.
- txt = txt.replace(/(^|[^\\]\n)[$%] /g, "$1");
- }
+ var target0 = $(this).next();
+ var target = target0.clone();
+ target.find('.nocopy').remove();
+ var txt = target.text();
clipboard.on( 'dataRequested', function (client, args) {
+ handleHideCopy( target0.closest('div.highlight') ); //not necessary but nicer feedback
client.setText( txt );
});
});
});
+
<!-- search -->
$(function() {
$('#simple_google')
http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/f25797de/style/css/_code_blocks.scss
----------------------------------------------------------------------
diff --git a/style/css/_code_blocks.scss b/style/css/_code_blocks.scss
index 3e25172..934bac5 100644
--- a/style/css/_code_blocks.scss
+++ b/style/css/_code_blocks.scss
@@ -70,6 +70,9 @@ a code {
.clipboard_button.zeroclipboard-is-active .on-active {
display: inherit;
}
+.clipboard_button.manual-clipboard-is-active .on-active {
+ display: inherit;
+}
.clipboard_button .on-active {
// z-index often doesn't help here (diff stacking context to the side menu)... but it shouldn't hurt!
z-index: 10;
@@ -96,3 +99,10 @@ a code {
padding: 3px 7px;
@include transform('translateX(-50%)');
}
+
+
+span.bash_prompt {
+ color: #bb60d5;
+ font-weight: bold;
+}
+
[3/4] brooklyn-docs git commit: use the new/experimental
`user-select` label, with notes
Posted by he...@apache.org.
use the new/experimental `user-select` label, with notes
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/5575d8fe
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/5575d8fe
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/5575d8fe
Branch: refs/heads/master
Commit: 5575d8fe1cd3ecda3b6784fe5bbcf2b0592cd733
Parents: 68291a3
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Nov 7 16:09:17 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Nov 7 16:09:17 2016 +0000
----------------------------------------------------------------------
style/css/_code_blocks.scss | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/5575d8fe/style/css/_code_blocks.scss
----------------------------------------------------------------------
diff --git a/style/css/_code_blocks.scss b/style/css/_code_blocks.scss
index 934bac5..142eb6a 100644
--- a/style/css/_code_blocks.scss
+++ b/style/css/_code_blocks.scss
@@ -100,9 +100,16 @@ a code {
@include transform('translateX(-50%)');
}
-
span.bash_prompt {
color: #bb60d5;
font-weight: bold;
}
+.nocopy {
+ // still experimental, and seems to affect rendering rather and not what is actually copied to clipboard
+ // our JS removes these blocks explicitly on copy events, but nice to add that it doesn't appear highlighted
+ user-select: none;
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+}
[2/4] brooklyn-docs git commit: tidies for prompt chars,
esp multi-line
Posted by he...@apache.org.
tidies for prompt chars, esp multi-line
and fix broken link
cf https://github.com/apache/brooklyn-docs/pull/97
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/68291a39
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/68291a39
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/68291a39
Branch: refs/heads/master
Commit: 68291a398f4205b79af8021744db9ca0d081e46a
Parents: f25797d
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Nov 7 15:29:33 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Nov 7 15:29:33 2016 +0000
----------------------------------------------------------------------
guide/start/policies.md | 16 ++++++++--------
guide/start/running.md | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/68291a39/guide/start/policies.md
----------------------------------------------------------------------
diff --git a/guide/start/policies.md b/guide/start/policies.md
index a1b2001..ef73c3c 100644
--- a/guide/start/policies.md
+++ b/guide/start/policies.md
@@ -355,8 +355,8 @@ Tomcat on the vagrant VMs named "byon1" to "byon4":
{% highlight bash %}
$ for i in byon{1..4}; do
-$ vagrant ssh ${i} --command 'ps aux | grep -i tomcat | grep -v grep | awk '\''{print $2}'\'' | xargs kill -9'
-$ done
+> vagrant ssh ${i} --command 'ps aux | grep -i tomcat | grep -v grep | awk '\''{print $2}'\'' | xargs kill -9'
+> done
{% endhighlight %}
You can view the state of the Tomcat server with the command below (which drills into the
@@ -437,12 +437,12 @@ you could use a load generator like jmeter, or use a script such as the one show
{% highlight bash %}
$ URL=http://10.10.10.101:8000/
$ for i in {1..600}; do
-$ for j in {1..50}; do
-$ curl -saefafefj ${URL} > /dev/null || echo "Curl failed with exit code $?"
-$ done
-$ echo "Finished batch $i"
-$ sleep 1
-$ done
+> for j in {1..50}; do
+> curl -saefafefj ${URL} > /dev/null || echo "Curl failed with exit code $?"
+> done
+> echo "Finished batch $i"
+> sleep 1
+> done
{% endhighlight %}
While those curl commands run in a separate terminal, you can look at the metrics for the first
http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/68291a39/guide/start/running.md
----------------------------------------------------------------------
diff --git a/guide/start/running.md b/guide/start/running.md
index 4b1be82..025628d 100644
--- a/guide/start/running.md
+++ b/guide/start/running.md
@@ -253,6 +253,6 @@ For details on the CLI, see the [Client CLI Reference]({{ site.path.guide }}/ops
<div class="started-pdf-exclude">
-The first thing we want to do with Brooklyn is **[deploy a blueprint]({{ site.path.guide }}/ops/blueprints.html)**.
+The first thing we want to do with Brooklyn is **[deploy a blueprint]({{ site.path.guide }}/start/blueprints.html)**.
</div>
[4/4] brooklyn-docs git commit: This closes #123
Posted by he...@apache.org.
This closes #123
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/1bc3721d
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/1bc3721d
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/1bc3721d
Branch: refs/heads/master
Commit: 1bc3721da46c7f1a0253e48f2bfa7511550337cd
Parents: fe7d68e 5575d8f
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Nov 8 11:17:43 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Nov 8 11:17:43 2016 +0000
----------------------------------------------------------------------
_layouts/base.html | 70 ++++++++++++++++++++++++++++++----------
guide/start/policies.md | 16 ++++-----
guide/start/running.md | 2 +-
style/css/_code_blocks.scss | 17 ++++++++++
4 files changed, 79 insertions(+), 26 deletions(-)
----------------------------------------------------------------------