Skip to content

Commit

Permalink
Literate programming (#515)
Browse files Browse the repository at this point in the history
* add script to parse code blocks

* add extra checks, remove current checks

* add code-blocks to style-guide

* ignore generated files

* print only severe messages

* fix newlines

* fix comma regex, addresses getodk/docs#471

* custom check for but, addresses getodk/docs#467

* exclude inbuilt but and spelling checks, addresses getodk/docs#467

* add encoding

* improve uk us check, addresses getodk/docs#471 (comment)

* fix messages

* separate checks for jargon

* add comment for uk-us check

* add extra latin abbr

* add new adverbs

* remove repeated phrase

* fix message writing style

* fix variable naming

* add function to remove generated scripts

* add show hide feature for style test code blocks

* add python directive to ignore list

* add math directive to ignore list
  • Loading branch information
ankita240796 authored and adammichaelwood committed Feb 27, 2018
1 parent 5b60683 commit 5252b6c
Show file tree
Hide file tree
Showing 18 changed files with 467 additions and 319 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
style-checks.py
extra.py
build/
__pycache__/
.DS_Store
Expand Down
17 changes: 16 additions & 1 deletion src/_static/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ $(function(){
"<div class='details'></div>"
)
});

// Wrap style-test code blocks with a details div.
$(".style-checks, .extra-checks, .proselint-extra-checks").each(function(){
$(this).wrap(
"<div class='details'></div>"
)
});
// Add a toggler to each details element.
var id = 1000000
$(".details").each(function(index){
Expand All @@ -16,13 +23,13 @@ $(function(){
$(this).before(togl);
$(this).addClass('hidden');
$(this).has("img:only-child").addClass('screenshot-only');
$(this).has(".style-checks, .extra-checks, .proselint-extra-checks").addClass('code-only');
if ( $(this).is("img") ) {
$(this).addClass("screenshot-only");
}
});

// Add class to list items that include togglers

$("li").has(".details").each(function(index){
$(this).addClass("has-details");
});
Expand All @@ -32,12 +39,16 @@ $(function(){
showing_label = "[<span class='toggle-sign'>&minus;</span>] hide details";
ss_hiding_label = "[<span class='toggle-sign'>&plus;</span>] show screenshot";
ss_showing_label = "[<span class='toggle-sign'>&minus;</span>] hide screenshot";
code_hiding_label = "[<span class='toggle-sign'>&plus;</span>] show code<br>";
code_showing_label = "[<span class='toggle-sign'>&minus;</span>] hide code<br>";


// Add labels and onclick function to togglers
$(".toggler").each(function(index){
if ($(this).siblings().hasClass('screenshot-only')) {
$(this).html(ss_hiding_label);
} else if ($(this).siblings().hasClass('code-only')) {
$(this).html(code_hiding_label);
} else {
$(this).html(hiding_label);
}
Expand All @@ -48,6 +59,8 @@ $(function(){
toggle_image.removeClass("hidden");
if ($(this).siblings().hasClass('screenshot-only')) {
$(this).html(ss_showing_label);
} else if ($(this).siblings().hasClass('code-only')) {
$(this).html(code_showing_label);
} else {
$(this).html(showing_label);
}
Expand All @@ -56,6 +69,8 @@ $(function(){
toggle_image.addClass("hidden");
if ($(this).siblings().hasClass('screenshot-only')) {
$(this).html(ss_hiding_label);
} else if ($(this).siblings().hasClass('code-only')) {
$(this).html(code_hiding_label);
} else {
$(this).html(hiding_label);
}
Expand Down
Loading

0 comments on commit 5252b6c

Please sign in to comment.