Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5882880
Extract Syntax enum
istathar Jan 10, 2026
3052a6c
Extract writing logic to new output module in application crate
istathar Jan 10, 2026
48bc766
Implement preliminary template options to render subcommand
istathar Jan 10, 2026
faa5a0d
Bump version reflecting command-line changes
istathar Jan 10, 2026
6d48933
Formatting and imports
istathar Jan 15, 2026
90e66a2
Add drivers license example
istathar Feb 19, 2026
f2f51d1
Add ISS crew procedure example
istathar Feb 19, 2026
a1fb2ac
Utility methods for extracting structure from AST
istathar Mar 3, 2026
b2e2dd5
Ignore reference documentation
istathar Mar 5, 2026
aff74a6
Add traits for Template, Adapter, and Renderer
istathar Mar 5, 2026
3e59f9e
Rename rendering module to highlighting
istathar Mar 5, 2026
79bfe8e
Implenent engine as templating infrastructure
istathar Mar 5, 2026
1fae572
Add checklist renderer
istathar Mar 5, 2026
6ef6e98
Add procedure renderer
istathar Mar 5, 2026
9b8bf4b
Wire template types into main
istathar Mar 5, 2026
903de55
Merge branch 'main' into 'render-via-template'
istathar Mar 5, 2026
dd32114
Refine extraction of step content when invocations present
istathar Mar 6, 2026
22f166e
Include code expression elements in inline invocations
istathar Mar 6, 2026
8a716bc
Test step content extraction
istathar Mar 6, 2026
0db94e8
Add tests for adapters and renderers
istathar Mar 6, 2026
db1079e
Add Database Upgrade example procedure
istathar Mar 6, 2026
f30bd1a
Refine layout of procedure template
istathar Mar 6, 2026
07200d0
Refine --template command-line option behaviour
istathar Mar 7, 2026
590df3b
Handle top-level procedures and section chunks
istathar Mar 7, 2026
ddd62a4
Improve help text
istathar Mar 7, 2026
ac9a769
Generalize procedure template to better follow source Technique
istathar Mar 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# rendered code fragments
/*.pdf

# documentation symlinks
/doc/references
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "technique"
version = "0.4.6"
version = "0.5.0"
edition = "2021"
description = "A domain specific language for procedures."
authors = [ "Andrew Cowie" ]
Expand Down
39 changes: 39 additions & 0 deletions examples/prototype/AirlockPowerdown.tq
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
% technique v1
! PD; © 2003 National Aeronautics and Space Administration, Canadian Space Agency, European Space Agency, and Others
& nasa-flight-plan,v4.0

emergency_procedures :

# ISS Powerdown and Recovery

1. <rs_load_powerdown>
2. <node1_htr_avail_16>
3. <node1_htr_avail_79>

rs_load_powerdown :

# RS Load Powerdown

ARCU deactivation is requested by MCC-H and performed after MCC-M concurrence.

node1_htr_avail_16 :

# Inhibiting Node 1 B HTRS (1 to 6)

@pcs
{ foreach node in seq(6) }
1. Check Availability
2. Perform { cmd("Inhibit") }
3. Check Availability
'Inhibited'

node1_htr_avail_79 :

# Inhibiting Node 1 B HTRS (7 to 9)

@pcs
{ foreach node in seq(9) }
1. Check Availability
2. Perform { cmd("Inhibit") }
3. Check Availability
'Inhibited'
75 changes: 75 additions & 0 deletions examples/prototype/DatabaseUpgrade.tq
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
% technique v1
& procedure

database_upgrade :

# Production Database Upgrade

In order to launch the next version of our e-commerce platform, we need to
upgrade the schema of the core database at the heart of the application. We
also have an outstanding requirement to upgrade the underlying database
software, as we have had trouble with several bugs therein which the vendor
reports fixed.

I. Take site down

site_down :

# Take site down

Before taking the database offline for its upgrade, we put the site into
maintenance mode and safely down the servers. The start time is critical due
to expected duration of the database schema upgrade scripts.

1. Enter maintenance mode
@fozzie
a. Put web site into maintenance mode (load balancer redirect to
alternate web servers with static pages)
@gonzo
b. Activate IVR maintenance mode
2. Down services
@kermit
a. Stop all VMs
b. Stop GFS on database1, database2
c. Ensure RAID filesystems still mounted
@gonzo
d. Stop Apache on web1, web2
3. Verification
@kermit
a. Verify maintenance mode is active
b. Verify all VMs down
c. GO / NO-GO FOR UPGRADE

II. Database work

software_update :

# Database Software Upgrade

Run an export of the database in order to ensure we have a good backup prior
to upgrading the database software and running the schema change scripts.
There is not much concurrent activity here, so those not directly involved in
database activity will head for breakfast.

4. Database safety
@beaker
a. Database to single user mode
b. Export database to secondary storage
c. Stop database
@gonzo
d. Run out to get coffees for everyone
5. Software upgrade
@fozzie
a. Install database software upgrade
6. Restart database
@beaker
a. Start database
7. Preliminary database testing
@beaker
a. Run access check scripts
b. Run health check scripts
@fozzie
c. Restart database monitoring
8. Schema upgrade
@beaker
a. Run database schema upgrade scripts
4 changes: 2 additions & 2 deletions src/editor/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use technique::formatting::Identity;
use technique::language::{Document, Technique};
use tracing::{debug, error, info, warn};

use crate::formatting;
use crate::highlighting;
use crate::parsing;
use crate::parsing::ParsingError;
use crate::problem::{calculate_column_number, calculate_line_number, Present};
Expand Down Expand Up @@ -353,7 +353,7 @@ impl TechniqueLanguageServer {
}
};

let result = formatting::render(&Identity, &document, 78);
let result = highlighting::render(&Identity, &document, 78);

// convert to LSP type for return to editor.
let edit = TextEdit {
Expand Down
4 changes: 2 additions & 2 deletions src/formatting/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub mod formatter;
mod renderer;
mod syntax;

// Re-export all public symbols
pub use formatter::*;
pub use renderer::*;
pub use syntax::*;
47 changes: 47 additions & 0 deletions src/formatting/syntax.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//! Renderers for colourizing Technique language

/// Types of content that can be rendered with different styles
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Syntax {
Neutral, // default
Indent,
Newline,
Header,
Declaration,
Description,
Forma,
StepItem,
CodeBlock,
Variable,
Section,
String,
Numeric,
Response,
Invocation,
Title,
Keyword,
Function,
Multiline,
Label,
Operator,
Quote,
Language,
Attribute,
Structure,
}

/// Trait for different rendering backends (the no-op no-markup one, ANSI
/// escapes for terminal colouring, Typst markup for documents)
pub trait Render {
/// Apply styling to content with the specified syntax type
fn style(&self, content_type: Syntax, content: &str) -> String;
}

/// Returns content unchanged, with no markup applied
pub struct Identity;

impl Render for Identity {
fn style(&self, _syntax: Syntax, content: &str) -> String {
content.to_string()
}
}
9 changes: 9 additions & 0 deletions src/highlighting/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//! Rendering of Technique source code with syntax highlighting

mod renderer;
mod terminal;
mod typst;

pub use renderer::render;
pub use terminal::Terminal;
pub use typst::Typst;
47 changes: 1 addition & 46 deletions src/formatting/renderer.rs → src/highlighting/renderer.rs
Original file line number Diff line number Diff line change
@@ -1,53 +1,8 @@
//! Renderers for colourizing Technique language

use crate::formatting::*;
use crate::language::*;

/// Types of content that can be rendered with different styles
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Syntax {
Neutral, // default
Indent,
Newline,
Header,
Declaration,
Description,
Forma,
StepItem,
CodeBlock,
Variable,
Section,
String,
Numeric,
Response,
Invocation,
Title,
Keyword,
Function,
Multiline,
Label,
Operator,
Quote,
Language,
Attribute,
Structure,
}

/// Trait for different rendering backends (the no-op no-markup one, ANSI
/// escapes for terminal colouring, Typst markup for documents)
pub trait Render {
/// Apply styling to content with the specified syntax type
fn style(&self, content_type: Syntax, content: &str) -> String;
}

/// Returns content unchanged, with no markup applied
pub struct Identity;

impl Render for Identity {
fn style(&self, _syntax: Syntax, content: &str) -> String {
content.to_string()
}
}

/// We do the code formatting in two passes. First we convert from our
/// Abstract Syntax Tree types into a Vec of "fragments" (Syntax tag, String
/// pairs). Then second we apply the specified renderer to each pair to result
Expand Down
2 changes: 1 addition & 1 deletion src/rendering/terminal.rs → src/highlighting/terminal.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Renderers for colourizing Technique language

use crate::formatting::*;
use owo_colors::OwoColorize;
use technique::formatting::*;

/// Embellish fragments with ANSI escapes to create syntax highlighting in
/// terminal output.
Expand Down
2 changes: 1 addition & 1 deletion src/rendering/typst.rs → src/highlighting/typst.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Renderers for colourizing Technique language

use crate::formatting::*;
use std::borrow::Cow;
use technique::formatting::*;

/// Add markup around syntactic elements for use when including
/// Technique source in Typst documents.
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pub mod formatting;
pub mod highlighting;
pub mod language;
pub mod parsing;
pub mod regex;
pub mod templating;
Loading