Skip to content
Myr

orgmode.rs

This file

Path

src/export/orgmode.rs

51 lines · 1.2 KiB · Rust

Last changed by

Dependency and MSRV update (#934)David Peterbefore adoption4d073e0

History of this file

Take it

The walk stopped after 200 commits: lines older than 0f91d0c point at it.

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

lines 1–11why, one step back
1use super::markup::Alignment;
2use crate::export::markup::MarkupExporter;34#[derive(Default)]5pub struct OrgmodeExporter {}67impl MarkupExporter for OrgmodeExporter {8 fn table_row(&self, cells: &[&str]) -> String {9 format!(10 "| {} | {} |\n",11 cells.first().unwrap(),

Dependency and MSRV update (#934)David Peterbefore adoption4d073e0

line 12why, one step back
12 cells[1..].join(" | ")

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

lines 13–20why, one step back
13 )
14 }1516 fn table_divider(&self, cell_aligmnents: &[Alignment]) -> String {17 format!("|{}--|\n", "--+".repeat(cell_aligmnents.len() - 1))18 }1920 fn command(&self, cmd: &str) -> String {

style: simplify string interpolationHamir Mahalbefore adoptionef12632

line 21why, one step back
21 format!("={cmd}=")

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

lines 22–51why, one step back
22 }
23}2425/// Check Emacs org-mode data row formatting26#[test]27fn test_orgmode_formatter_table_data() {28 let exporter = OrgmodeExporter::default();2930 let actual = exporter.table_row(&["a", "b", "c"]);31 let expect = "| a | b | c |\n";3233 assert_eq!(expect, actual);34}3536/// Check Emacs org-mode horizontal line formatting37#[test]38fn test_orgmode_formatter_table_line() {39 let exporter = OrgmodeExporter::default();4041 let actual = exporter.table_divider(&[42 Alignment::Left,43 Alignment::Left,44 Alignment::Left,45 Alignment::Left,46 Alignment::Left,47 ]);48 let expect = "|--+--+--+--+--|\n";4950 assert_eq!(expect, actual);51}