Skip to content

Commit

Permalink
Fall back to article ID on save when URL is missing (#470)
Browse files Browse the repository at this point in the history
* Fall back to article ID when URL is missing

* Add article forge to capyreader

* Add highlight color on click

* Fix toolbar padding offset
  • Loading branch information
jocmp authored Oct 27, 2024
1 parent adb3bae commit 91fe725
Show file tree
Hide file tree
Showing 39 changed files with 3,012 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
capy/src/main/res/raw/*.html linguist-generated=true
article_forge/articles/fixtures/**/* linguist-generated=true
article_forge/public/**/* linguist-generated=true
capy/src/main/assets/*.css linguist-generated=true
capy/src/main/assets/*.js linguist-generated=true
capy/src/main/res/raw/*.html linguist-generated=true
capy/src/test/resources/*.html linguist-generated=true
feedfinder/src/test/resources/*.html linguist-generated=true
feedfinder/src/test/resources/*.xml linguist-generated=true
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ FASTLANE ?= bundle exec fastlane

.PHONY: test release-secrets deploy-production

.PHONY: assets
assets:
cd article_forge && make

.PHONY: deps
deps: ## Install bumpver
pip install bumpver==2023.1129
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fun ArticleView(
},
reader = {
ArticlePullRefresh(
toolbars.show,
toolbars.show && !toolbars.pinned,
onToggleFullContent = onToggleFullContent,
onRequestNext = onRequestNext,
onRequestPrevious = onRequestPrevious,
Expand Down Expand Up @@ -174,7 +174,7 @@ private fun ArticleViewScaffold(

@Composable
fun ArticlePullRefresh(
showBars: Boolean,
includePadding: Boolean,
onToggleFullContent: () -> Unit,
onRequestNext: () -> Unit,
onRequestPrevious: () -> Unit,
Expand Down Expand Up @@ -207,15 +207,21 @@ fun ArticlePullRefresh(
} else {
Icons.Rounded.KeyboardArrowUp
},
indicatorPadding = PaddingValues(top = TopBarOffset),
indicatorPadding = PaddingValues(
top = if (includePadding) {
TopBarOffset
} else {
0.dp
}
),
onTriggerThreshold = { triggerThreshold() }
) {
SwipeRefresh(
onRefresh = { onRequestNext() },
swipeEnabled = bottomSwipe.enabled && articles.hasNext(),
onTriggerThreshold = { triggerThreshold() },
indicatorPadding = PaddingValues(
bottom = if (showBars) {
bottom = if (includePadding) {
BottomBarOffset
} else {
0.dp
Expand Down
62 changes: 62 additions & 0 deletions article_forge/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

.DS_Store

# Used by dotenv library to load environment variables.
# .env

# Ignore Byebug command history file.
.byebug_history

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*

# Project generated
dist/
./public/assets/stylesheet.css
6 changes: 6 additions & 0 deletions article_forge/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
15 changes: 15 additions & 0 deletions article_forge/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source "https://rubygems.org"

gem "rackup", require: false
gem "puma", require: false
gem "sinatra", require: false
gem "liquid"

group :development, :test do
gem "sass-embedded"
gem "rerun"
gem "terminal-notifier"
gem "rb-fsevent", "~> 0.11.2"
gem "standard"
gem "debug"
end
119 changes: 119 additions & 0 deletions article_forge/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.8)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
ffi (1.17.0-arm64-darwin)
google-protobuf (4.27.2-arm64-darwin)
bigdecimal
rake (>= 13)
io-console (0.7.2)
irb (1.14.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
liquid (5.5.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
nio4r (2.7.1)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
psych (5.1.2)
stringio
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (3.0.10)
rack-protection (4.0.0)
base64 (>= 0.1.0)
rack (>= 3.0.0, < 4)
rack-session (2.0.0)
rack (>= 3.0.0)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.0)
reline (0.5.9)
io-console (~> 0.5)
rerun (0.14.0)
listen (~> 3.0)
rexml (3.2.6)
rubocop (1.62.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sass-embedded (1.77.8-arm64-darwin)
google-protobuf (~> 4.26)
sinatra (4.0.0)
mustermann (~> 3.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.0.0)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
standard (1.35.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.62.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.3)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.3.1)
lint_roller (~> 1.1)
rubocop-performance (~> 1.20.2)
stringio (3.1.1)
terminal-notifier (2.0.0)
tilt (2.3.0)
unicode-display_width (2.5.0)
webrick (1.8.1)

PLATFORMS
arm64-darwin-23

DEPENDENCIES
debug
liquid
puma
rackup
rb-fsevent (~> 0.11.2)
rerun
sass-embedded
sinatra
standard
terminal-notifier

BUNDLED WITH
2.5.9
36 changes: 36 additions & 0 deletions article_forge/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
STYLE_OUT = ./dist/stylesheet.css
STYLE_DEST ?= ../capy/src/main/assets/stylesheet.css
TEMPLATE_OUT = ./dist/template.html
TEMPLATE_DEST ?= ../capy/src/main/res/raw/template.html
CUSTOM_EXTRACTOR_JS_DEST := ../capy/src/main/assets/custom-extractors.js
MEDIA_LISTENERS_JS_DEST := ../capy/src/main/assets/media.js

SHELL:=/usr/bin/env bash

.PHONY: forge clean

build: $(TEMPLATE_DEST) $(STYLE_DEST) $(MEDIA_LISTENERS_JS_DEST)

.PHONY: forge
forge:
bundle install
bundle exec rerun main.rb -b --ignore "*.css"

clean:
rm -f dist/*

$(STYLE_DEST): ./style/stylesheet.scss
ruby ./script/generate-android-style
cp $(STYLE_OUT) $(STYLE_DEST)

dist/template.html: ./views/template.liquid
ruby ./script/generate-android-template

$(TEMPLATE_DEST): dist/template.html
cp ./dist/template.html $(TEMPLATE_DEST)

$(CUSTOM_EXTRACTOR_JS_DEST): ./public/assets/custom-extractors.js
cp ./public/assets/custom-extractors.js $(CUSTOM_EXTRACTOR_JS_DEST)

$(MEDIA_LISTENERS_JS_DEST): ./public/assets/media.js
cp ./public/assets/media.js $(MEDIA_LISTENERS_JS_DEST)
21 changes: 21 additions & 0 deletions article_forge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Article Forge

A testbed to modify the HTML layout and stylesheet for [Capy Reader](https://github.com/jocmp/capyreader).

## Getting started

1. Ensure you have Ruby installed with the version found in `.ruby-version`.

2. Run the following command to start the server and navigate to http://127.0.0.1:4567.

```sh
make forge
```

## Fonts

The following fonts are licensed under the [SIL Open Font License](https://openfontlicense.org/)

- [Vollkorn](fonts.google.com/specimen/Vollkorn)
- [Atkinson Hyperlegible](https://fonts.google.com/specimen/Atkinson+Hyperlegible)
- [Poppins](https://fonts.google.com/specimen/Poppins)
Loading

0 comments on commit 91fe725

Please sign in to comment.