Skip to content

Commit d6d1bbb

Browse files
committed
Add editor structure outline to the developer guide on the website
1 parent 765092f commit d6d1bbb

File tree

18 files changed

+426
-558
lines changed

18 files changed

+426
-558
lines changed

.github/workflows/website.yml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,34 @@ jobs:
4444
# Remove the INDEX_HTML_HEAD_INCLUSION environment variable for build links (not master deploys)
4545
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_INCLUSION=""
4646
47+
- name: 💿 Obtain cache of auto-generated code docs artifacts
48+
id: cache-website-code-docs
49+
uses: actions/cache/restore@v3
50+
with:
51+
path: artifacts
52+
key: website-code-docs
53+
54+
- name: 📁 Fallback in case auto-generated code docs artifacts weren't cached
55+
if: steps.cache-website-code-docs.outputs.cache-hit != 'true'
56+
run: |
57+
echo "🦀 Initial system version of Rust:"
58+
rustc --version
59+
rustup update stable
60+
echo "🦀 Latest updated version of Rust:"
61+
rustc --version
62+
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
63+
mkdir artifacts
64+
mv hierarchical_message_system_tree.txt artifacts/hierarchical_message_system_tree.txt
65+
66+
- name: 🚚 Move `artifacts` contents to `website/other/editor-structure`
67+
run: |
68+
mv artifacts/* website/other/editor-structure
69+
70+
- name: 🔧 Build auto-generated code docs artifacts into HTML
71+
run: |
72+
cd website/other/editor-structure
73+
node generate.js hierarchical_message_system_tree.txt replacement.html
74+
4775
- name: 🌐 Build Graphite website with Zola
4876
env:
4977
MODE: prod
@@ -84,29 +112,6 @@ jobs:
84112
mkdir -p website/public
85113
mv website/other/dist/* website/public
86114
87-
- name: 💿 Obtain cache of auto-generated code docs artifacts
88-
id: cache-website-code-docs
89-
uses: actions/cache/restore@v3
90-
with:
91-
path: artifacts
92-
key: website-code-docs
93-
94-
- name: 📁 Fallback in case auto-generated code docs artifacts weren't cached
95-
if: steps.cache-website-code-docs.outputs.cache-hit != 'true'
96-
run: |
97-
echo "🦀 Initial system version of Rust:"
98-
rustc --version
99-
rustup update stable
100-
echo "🦀 Latest updated version of Rust:"
101-
rustc --version
102-
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
103-
mkdir artifacts
104-
mv hierarchical_message_system_tree.txt artifacts/hierarchical_message_system_tree.txt
105-
106-
- name: 🚚 Move `artifacts` contents to `website/public`
107-
run: |
108-
mv artifacts/* website/public
109-
110115
- name: 📤 Publish to Cloudflare Pages
111116
id: cloudflare
112117
uses: cloudflare/pages-action@1

proc-macros/src/helpers.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ pub fn clean_rust_type_syntax(input: String) -> String {
7272
chars.next();
7373
}
7474
}
75+
'-' => {
76+
if let Some('>') = chars.peek() {
77+
while let Some(' ') = result.chars().rev().next() {
78+
result.pop();
79+
}
80+
result.push_str(" -> ");
81+
chars.next();
82+
while let Some(' ') = chars.peek() {
83+
chars.next();
84+
}
85+
} else {
86+
result.push(c);
87+
}
88+
}
7589
':' => {
7690
if let Some(':') = chars.peek() {
7791
while let Some(' ') = result.chars().rev().next() {

proc-macros/src/message_handler_data_attr.rs

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,42 +33,24 @@ pub fn message_handler_data_attr_impl(attr: TokenStream, input_item: TokenStream
3333
let message_type = &args.args[0];
3434
let data_type = &args.args[1];
3535

36-
// Check if the attribute is "CustomData"
37-
let is_custom_data = attr.to_string().contains("CustomData");
38-
3936
let impl_item = match data_type {
4037
syn::GenericArgument::Type(t) => {
4138
match t {
4239
syn::Type::Path(type_path) if !type_path.path.segments.is_empty() => {
4340
// Get just the base identifier (ToolMessageData) without generics
4441
let type_name = &type_path.path.segments.first().unwrap().ident;
4542

46-
if is_custom_data {
47-
quote! {
48-
#input_item
49-
impl #message_type {
50-
pub fn message_handler_data_str() -> MessageData {
51-
custom_data()
52-
}
53-
pub fn message_handler_str() -> MessageData {
54-
MessageData::new(format!("{}",stringify!(#input_type)), #input_type::field_types(), #input_type::path())
43+
quote! {
44+
#input_item
45+
impl #message_type {
46+
pub fn message_handler_data_str() -> MessageData
47+
{
48+
MessageData::new(format!("{}", stringify!(#type_name)), #type_name::field_types(), #type_name::path())
5549

56-
}
5750
}
58-
}
59-
} else {
60-
quote! {
61-
#input_item
62-
impl #message_type {
63-
pub fn message_handler_data_str() -> MessageData
64-
{
65-
MessageData::new(format!("{}",stringify!(#type_name)), #type_name::field_types(), #type_name::path())
66-
67-
}
68-
pub fn message_handler_str() -> MessageData {
69-
MessageData::new(format!("{}",stringify!(#input_type)), #input_type::field_types(), #input_type::path())
51+
pub fn message_handler_str() -> MessageData {
52+
MessageData::new(format!("{}", stringify!(#input_type)), #input_type::field_types(), #input_type::path())
7053

71-
}
7254
}
7355
}
7456
}
@@ -77,7 +59,7 @@ pub fn message_handler_data_attr_impl(attr: TokenStream, input_item: TokenStream
7759
#input_item
7860
impl #message_type {
7961
pub fn message_handler_str() -> MessageData {
80-
MessageData::new(format!("{}",stringify!(#input_type)), #input_type::field_types(), #input_type::path())
62+
MessageData::new(format!("{}", stringify!(#input_type)), #input_type::field_types(), #input_type::path())
8163
}
8264
}
8365
},
@@ -92,11 +74,11 @@ pub fn message_handler_data_attr_impl(attr: TokenStream, input_item: TokenStream
9274
#input_item
9375
impl #message_type {
9476
pub fn message_handler_data_str() -> MessageData {
95-
MessageData::new(format!("{}", #tr),#type_ident::field_types(), #type_ident::path())
77+
MessageData::new(format!("{}", #tr), #type_ident::field_types(), #type_ident::path())
9678
}
9779

9880
pub fn message_handler_str() -> MessageData {
99-
MessageData::new(format!("{}",stringify!(#input_type)), #input_type::field_types(), #input_type::path())
81+
MessageData::new(format!("{}", stringify!(#input_type)), #input_type::field_types(), #input_type::path())
10082

10183
}
10284
}

website/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ public/
33
static/fonts/
44
static/syntax-highlighting.css
55
static/text-balancer.js
6+
other/editor-structure/replacement.html

website/content/volunteer/guide/_unpublished/product-design/_index.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

website/content/volunteer/guide/_unpublished/product-design/glossary-of-terminology.md

Lines changed: 0 additions & 68 deletions
This file was deleted.

website/content/volunteer/guide/_unpublished/product-design/product-outline.md

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)