Skip to content

Commit

Permalink
#111 simple check, w3c doesnt work
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 17, 2024
1 parent 6050452 commit bb3309f
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target/
.DS_Store
.DS_Store
coverage/
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ gem 'minitest-reporters', '1.7.1', require: false
gem 'rake', '13.2.1', require: false
gem 'redcarpet', '~>3.5'
gem 'rubocop', '1.65.1', require: false
gem 'simplecov', '0.22.0', require: false
gem 'simplecov-cobertura', '2.1.0', require: false
gem 'w3c_validators', '1.3.7', require: false
gem 'webmock', '3.23.1', require: false
12 changes: 12 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ GEM
bigdecimal
rexml
decoor (0.0.1)
docile (1.4.1)
drb (2.2.1)
ethon (0.16.0)
ffi (>= 1.15.0)
Expand Down Expand Up @@ -173,6 +174,15 @@ GEM
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
securerandom (0.3.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
strscan (3.1.0)
tago (0.0.2)
typhoeus (1.4.1)
Expand Down Expand Up @@ -218,6 +228,8 @@ DEPENDENCIES
rake (= 13.2.1)
redcarpet (~> 3.5)
rubocop (= 1.65.1)
simplecov (= 0.22.0)
simplecov-cobertura (= 2.1.0)
w3c_validators (= 1.3.7)
webmock (= 3.23.1)

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# SOFTWARE.

.ONESHELL:
.PHONY: clean all assets install
.PHONY: clean all assets install rake
.SILENT:
.SHELLFLAGS := -x -e -o pipefail -c
SHELL := bash
Expand All @@ -38,7 +38,7 @@ SAXON = target/saxon.jar

export

all: assets $(HTMLS) entry rmi verify
all: assets $(HTMLS) rake entry rmi verify

assets: $(XSLS) $(JS) $(CSS)

Expand Down Expand Up @@ -68,6 +68,9 @@ target/fb/%.fb: tests/%.yml Makefile | target/fb
if [ -e "$@" ]; then $(JUDGES) trim --query='(always)' "$@"; fi
$(JUDGES) import "$<" "$@"

rake:
bundle exec rake

$(CSS): sass/*.scss Makefile | target/css
sass --no-source-map --style=compressed --no-quiet --stop-on-error sass/main.scss "$@"

Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
require 'rubygems'
require 'rake'

task default: %i[clean test judges rubocop]
task default: %i[test judges rubocop]

require 'rake/clean'
CLEAN.include('target', 'test')
CLEAN.include('target')

require 'rake/testtask'
desc 'Run all unit tests'
Expand Down
2 changes: 1 addition & 1 deletion entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fi
html=${INPUT_OUTPUT}/${name}-vitals.html
java -jar "${SELF}/target/saxon.jar" \
"-s:${INPUT_OUTPUT}/${name}.rich.xml" \
"-xsl:${SELF}/target/xsl/index.xsl" \
"-xsl:${SELF}/target/xsl/vitals.xsl" \
"-o:${html}" \
"today=${INPUT_TODAY}" \
"version=${VERSION}" \
Expand Down
18 changes: 17 additions & 1 deletion test/pages/test_vitals.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@
class TestVitals < Minitest::Test
def test_validate_html
WebMock.enable_net_connect!
puts 1
html = File.join(__dir__, '../../target/html/simple-vitals.html')
skip unless File.exist?(html)
doc = File.read(html)
xml =
begin
Nokogiri::XML.parse(doc) do |c|
c.norecover
c.strict
end
rescue StandardError => e
raise "#{doc}\n\n#{e}"
end
assert(xml.errors.empty?, xml)
assert(!xml.xpath('/html').empty?, xml)
# WebMock.enable_net_connect!
# v = W3CValidators::NuValidator.new.validate_file(html)
# assert(v.errors.empty?, "#{doc}\n\n#{v.errors.join('; ')}")
end
end
2 changes: 1 addition & 1 deletion xsl/awards.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:z="https://www.zerocracy.com" version="2.0" exclude-result-prefixes="xs">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:z="https://www.zerocracy.com" version="2.0" exclude-result-prefixes="xs z">
<xsl:variable name="fb" select="/fb"/>
<xsl:variable name="days" select="z:pmp(/fb, 'hr', 'days_of_running_balance', 28)"/>
<xsl:variable name="weeks" select="xs:integer(ceiling(xs:float($days) div 7))"/>
Expand Down
2 changes: 1 addition & 1 deletion xsl/dot.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:z="https://www.zerocracy.com" exclude-result-prefixes="xs">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:z="https://www.zerocracy.com" exclude-result-prefixes="xs z">
<xsl:variable name="dot_facts" select="/fb/f[what='dimensions-of-terrain' and xs:dateTime(when) &gt; $since]"/>
<xsl:template match="/" mode="dot">
<xsl:choose>
Expand Down
2 changes: 1 addition & 1 deletion xsl/qo-section.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs z">
<xsl:template name="qo-section">
<xsl:param name="what" as="xs:string"/>
<xsl:param name="title" as="xs:string"/>
Expand Down
10 changes: 5 additions & 5 deletions xsl/index.xsl → xsl/vitals.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:z="https://www.zerocracy.com">
<xsl:output method="xml" doctype-system="about:legacy-compat" encoding="UTF-8" indent="yes"/>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:z="https://www.zerocracy.com" exclude-result-prefixes="xs z">
<xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
<xsl:param name="today"/>
<xsl:param name="css"/>
<xsl:param name="js"/>
Expand Down Expand Up @@ -90,14 +90,14 @@ SOFTWARE.
</script>
</xsl:template>
<xsl:template match="/">
<xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html&gt;</xsl:text>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="UTF-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>
<xsl:value-of select="$name"/>
</title>
<meta charset="UTF-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<link rel="icon" href="https://www.zerocracy.com/svg/logo.svg" type="image/svg"/>
<link href="https://cdn.jsdelivr.net/gh/yegor256/tacit@gh-pages/tacit-css.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/gh/yegor256/drops@gh-pages/drops.min.css" rel="stylesheet"/>
Expand Down

0 comments on commit bb3309f

Please sign in to comment.