Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Chapter 2: Attribute operations #31

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ jobs:
enable-pull-request-comment: true
enable-commit-comment: false
enable-commit-status: true
overwrites-pull-request-comment: false
overwrites-pull-request-comment: true
timeout-minutes: 1
9 changes: 9 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[deps]
AlgebraOfGraphics = "cbdf2221-f076-402e-a563-3d30da359d67"
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataFramesMeta = "1313f7d8-7da2-5740-9ea0-a2ca25f37964"
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
GeoDataFrames = "62cb38b5-d8d2-4862-a48e-6a340996859f"
GeoFormatTypes = "68eda718-8dee-11e9-39e7-89f7f65f511f"
Expand All @@ -10,10 +13,16 @@ GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9"
GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6"
GeometryOps = "3251bfac-6a57-4b6d-aa61-ac1fef2975ab"
LibGEOS = "a90b1aa1-3769-5649-ba7e-abc5a9d163eb"
LightOSM = "d1922b25-af4e-4ba3-84af-fe9bea896051"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
OSMToolset = "a1c25ae6-0f93-4b3a-bddf-c248cb99b9fa"
OpenStreetMapX = "86cd37e6-c0ff-550b-95fe-21d72c8d4fc9"
Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
Query = "1a8c2f83-1ff3-5112-b086-8aa67b057ba1"
Rasters = "a3a2b9e3-a471-40c9-b274-f788e487c689"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TidierData = "fe2206b3-d496-4ee9-a338-6a095c4ece80"

[compat]
GeometryOps = "0.1.12"
6 changes: 6 additions & 0 deletions _extensions/jjallaire/code-visibility/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: Code Visibility
author: fast.ai
version: 1.0.0
contributes:
filters:
- code-visibility.lua
51 changes: 51 additions & 0 deletions _extensions/jjallaire/code-visibility/code-visibility.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@



-- remove any lines with the hide_line directive.
function CodeBlock(el)
if el.classes:includes('cell-code') then
el.text = filter_lines(el.text, function(line)
return not line:match("#| ?hide_line%s*$")
end)
return el
end
end

-- apply filter_stream directive to cells
function Div(el)
if el.classes:includes("cell") then
local filters = el.attributes["filter_stream"]
if filters then
-- process cell-code
return pandoc.walk_block(el, {
CodeBlock = function(el)
-- CodeBlock that isn't `cell-code` is output
if not el.classes:includes("cell-code") then
for filter in filters:gmatch("[^%s,]+") do
el.text = filter_lines(el.text, function(line)
return not line:find(filter, 1, true)
end)
end
return el
end
end
})

end

end

end

function filter_lines(text, filter)
local lines = pandoc.List()
local code = text .. "\n"
for line in code:gmatch("([^\r\n]*)[\r\n]") do
if filter(line) then
lines:insert(line)
end
end
return table.concat(lines, "\n")
end


3 changes: 3 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ project:
output-dir: docs
execute-dir: project

filters:
- code-visibility

book:
title: "Geocomputation with Julia"
page-footer: "Geocomputation with Julia was written by Maarten Pronk, Rafael Schouten, Anshul Singhvi, Felix Cremer and Jakub Nowosad."
Expand Down
Loading
Loading