forked from realaravinth/libmedium
Compare commits
42 commits
Author | SHA1 | Date | |
---|---|---|---|
|
8fc0f8f0d5 | ||
|
ecbcf02d4d | ||
|
ea24dca77d | ||
|
3714d29a23 | ||
|
4f6d4b709e | ||
|
95616fef4a | ||
|
0b3a43088b | ||
|
ac503b0b06 | ||
|
883c609412 | ||
|
d44cf2d5c6 | ||
|
8ee266d846 | ||
|
c07c5798d9 | ||
|
63ef7f75ba | ||
|
b53ac22ba4 | ||
|
88c7914f96 | ||
|
a9dc57e77a | ||
|
cad6e4cff9 | ||
|
220295bfde | ||
|
ecc9baf2b1 | ||
|
534028fc7f | ||
|
9308f4f344 | ||
|
d7f47273b2 | ||
|
df5f8c38b0 | ||
|
0ae9390417 | ||
|
864262394d | ||
|
41e84b8a57 | ||
|
3f01a5ff0a | ||
|
0dc45f8fe6 | ||
|
c7f50a4359 | ||
|
a6bb64d209 | ||
|
8199005f84 | ||
|
55c368bd63 | ||
|
e98a5132a0 | ||
|
304cfe46cd | ||
|
d3b4ae0952 | ||
|
603ceeba76 | ||
|
e53c128538 | ||
|
5b1a8bea86 | ||
|
f96cb38f3d | ||
|
6467697558 | ||
|
16a6044773 | ||
|
d2dcd6b048 |
43
.github/workflows/clippy-fmt.yml
vendored
43
.github/workflows/clippy-fmt.yml
vendored
|
@ -1,43 +0,0 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
fmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rustfmt
|
||||
- name: Check with rustfmt
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
override: true
|
||||
|
||||
- name: Check with Clippy
|
||||
uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --workspace --tests --all-features
|
49
.github/workflows/coverage.yml
vendored
49
.github/workflows/coverage.yml
vendored
|
@ -1,49 +0,0 @@
|
|||
name: Coverage
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version:
|
||||
- nightly
|
||||
|
||||
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: ⚡ Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Install ${{ matrix.version }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Generate coverage file
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'pull_request')
|
||||
uses: actions-rs/tarpaulin@v0.1
|
||||
with:
|
||||
args: "-t 1200"
|
||||
env:
|
||||
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61
|
||||
|
||||
- name: Upload to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
if: github.ref == 'refs/heads/master'
|
70
.github/workflows/linux.yml
vendored
70
.github/workflows/linux.yml
vendored
|
@ -1,70 +0,0 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version:
|
||||
#- 1.51.0
|
||||
- stable
|
||||
# - nightly
|
||||
|
||||
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: ⚡ Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
/var/lib/docker
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/libmedium'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Install ${{ matrix.version }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: build
|
||||
run: make
|
||||
|
||||
- name: run tests
|
||||
run: make test
|
||||
|
||||
- name: build and publish docker images
|
||||
run: make docker-publish
|
||||
|
||||
- name: generate documentation
|
||||
if: matrix.version == 'stable' && (github.repository == 'realaravinth/libmedium')
|
||||
run: make doc
|
||||
env:
|
||||
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
|
||||
|
||||
- name: Deploy to GitHub libmedium
|
||||
if: matrix.version == 'stable' && (github.repository == 'realaravinth/libmedium')
|
||||
uses: JamesIves/github-pages-deploy-action@3.7.1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-libmedium
|
||||
FOLDER: target/doc
|
1042
Cargo.lock
generated
1042
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,7 @@ actix-rt = "2"
|
|||
actix-web = "4.0.1"
|
||||
bincode = "1.3.3"
|
||||
chrono = "0.4.23"
|
||||
config = "0.13"
|
||||
config = "0.14"
|
||||
derive_more = "0.99"
|
||||
futures = "0.3.17"
|
||||
lazy_static = "1.4"
|
||||
|
@ -34,7 +34,7 @@ sha256 = "1.5.0"
|
|||
|
||||
[dependencies.graphql_client]
|
||||
features = ["reqwest"]
|
||||
version = "0.13.0"
|
||||
version = "0.14.0"
|
||||
|
||||
[dependencies.reqwest]
|
||||
features = ["json"]
|
||||
|
|
|
@ -57,7 +57,7 @@ business.
|
|||
| http://md.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/ | N/A | Hetzner | [~vern](https://vern.cc) |
|
||||
| http://vernaqj2qr2pijpgvf3od6ssc3ulz3nv52gwr3hba5l6humuzmgq.b32.i2p/ | N/A | Hetzner | [~vern](https://vern.cc) |
|
||||
| https://medium.hostux.net | France | Gandi | [hostux](https://hostux.net) |
|
||||
| https://read.sudovanilla.com | US | Cloudflare | [SudoVanilla](https://sudovanilla.com) |
|
||||
| https://r.sudovanilla.org | US | Selfhosted | [SudoVanilla](https://sudovanilla.org) |
|
||||
| https://libmedium.ducks.party | DE | Datalix | [ducks.party](https://ducks.party) |
|
||||
## Deploy
|
||||
|
||||
|
|
12
renovate.json
Normal file
12
renovate.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["config:recommended", ":dependencyDashboard"],
|
||||
"labels": ["renovate-bot"],
|
||||
"prHourlyLimit": 0,
|
||||
"timezone": "Asia/kolkata",
|
||||
"prCreation": "immediate",
|
||||
"vulnerabilityAlerts": {
|
||||
"enabled": true,
|
||||
"labels": ["renovate-bot", "renovate-security", "security"]
|
||||
}
|
||||
}
|
34
src/post.rs
34
src/post.rs
|
@ -345,6 +345,7 @@ pub fn apply_markup(
|
|||
) -> Vec<String> {
|
||||
let mut paragraphs: Vec<String> = Vec::with_capacity(data.content.body_model.paragraphs.len());
|
||||
let mut state = ListState::default();
|
||||
let mut no_render_html = false;
|
||||
for (pindex, p) in data.content.body_model.paragraphs.iter().enumerate() {
|
||||
let mut pos = PositionMap::default();
|
||||
if p.type_ == "H3" && pindex == 0 {
|
||||
|
@ -383,33 +384,42 @@ pub fn apply_markup(
|
|||
}
|
||||
|
||||
let mut content = String::with_capacity(p.text.len());
|
||||
content += &Markup::start(p, gists, pindex, &mut state);
|
||||
let start = &Markup::start(p, gists, pindex, &mut state);
|
||||
content += start;
|
||||
if start == "<pre>" {
|
||||
no_render_html = true;
|
||||
}
|
||||
pos.arr.sort();
|
||||
let mut page = String::default();
|
||||
if let Some(first) = pos.arr.first() {
|
||||
//content += p.text.substring(cur, *first as usize);
|
||||
content += p.text.slice(cur..*first as usize);
|
||||
page += p.text.slice(cur..*first as usize);
|
||||
cur = incr_cur(cur, *first);
|
||||
for point in pos.arr.iter() {
|
||||
//content.push(p.text.substring(start, start + point);
|
||||
// if *point != 0 {
|
||||
|
||||
if cur != *point as usize {
|
||||
// content += p.text.substring(cur, *point as usize);
|
||||
content += p.text.slice(cur..*point as usize);
|
||||
page += p.text.slice(cur..*point as usize);
|
||||
}
|
||||
// }
|
||||
let pos_markups = pos.map.get(point).unwrap();
|
||||
for m in pos_markups.iter() {
|
||||
content += &m.apply_markup(pindex);
|
||||
page += &m.apply_markup(pindex);
|
||||
}
|
||||
cur = incr_cur(cur, *point);
|
||||
}
|
||||
log::debug!("LAST");
|
||||
content += p.text.slice(cur..);
|
||||
content += &Markup::end(p, pindex, &mut state);
|
||||
page += p.text.slice(cur..);
|
||||
let end = &Markup::end(p, pindex, &mut state);
|
||||
if end == "</pre>" {
|
||||
no_render_html = false;
|
||||
}
|
||||
content += &page;
|
||||
content += end;
|
||||
} else {
|
||||
log::debug!("LAST WITH NO MARKUP");
|
||||
content += p.text.slice(cur..);
|
||||
page += p.text.slice(cur..);
|
||||
if no_render_html {
|
||||
page = page.replace("<", "<").replace(">", ">");
|
||||
}
|
||||
content += &page;
|
||||
content += &Markup::end(p, pindex, &mut state);
|
||||
}
|
||||
paragraphs.push(content);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
body {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
|
|
|
@ -317,7 +317,6 @@ padding: 0;
|
|||
body {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
main {
|
||||
width: 35em;
|
||||
|
|
Loading…
Reference in a new issue